Closed ccrause closed 5 months ago
@ccrause , I suppose it's because they are not intended to be full paths in linker script.
See ld documentation https://sourceware.org/binutils/docs/ld/File-Commands.html#:~:text=%2C%20file%2C%20%E2%80%A6)-,INPUT(file%20file%20%E2%80%A6),-The%20INPUT%20command
The behaviour between 11.2.0 and 13.2.0 was changed because fix for https://github.com/crosstool-ng/crosstool-ng/issues/2126 was added
@Lapshin, thank you for the explanation and references. It appears that the root cause of this issue is that sysroot is defined, which by design will append sysroot to a filename with a path starting with / (the situation leading to this issue). An unfortunate choice given that there are other alternatives to control when sysroot should be appended to paths.
Closing this issue since it is caused by upstream implementation details.
Issue submission guidelines
crosstool-NG version:
host OS and its version
The Free Pascal compiler (FPC) supports many targets, including the esp32 series. The support was developed based on esp-idf v4.x toolchain and uses the SDK provided assembler and linker. This worked fine, until I tried to update support to esp-idf v5+ when the binutils version was updated to 13.2.0. The linker script that FPC generates includes absolute paths to the libraries and object files that should be linked. This method works for many different Gnu binutils versions across many different CPU and OS combinations.
Using the linker from 13.2.0 gives an error when provided with libraries specified with absolute paths. When libraries/objects are specified using relative paths (or no paths), the linker can locate them (if the correct search paths are also supplied of course). Below please find an example call to the linker using the linker script link.res (attached)the verbose output of the first error when passing a linker script as currently generated by FPC which contains absolute paths to the various libraries and objects (linker script: link.txt):
The first error message is displayed (complete output in file linker-verbose.log):
The problem seems to be caused by the linker wrongly appending the absolute path to hello.o to the path pointing to the toolchain's bin folder.
The linker does however successfully locate libraries in the toolchain lib folder, see below output:
For reference performing the same linking step as above but using the linker from toolchain 11.2.0 succeeds, see verbose output (linker-verbose-11.2.0.log).
Also, providing just the list of libraries and objects in the linker script (linknopath.txt) do succeed when using toolchain 12.2.0 (linker-verbose-12.2.0-nopath.log).