mold icon indicating copy to clipboard operation
mold copied to clipboard

`ENTRY` linker script token is unknown

Open beyarkay opened this issue 10 months ago • 1 comments

I'm trying to use mold for an ARM32 embedded project (so the gcc toolchain is necessarily out of date), and after removing references to the --cref flag which I'm not sure I need, I ran into this problem:

mold: fatal: /[...]/linker.ld:24: ENTRY(Reset_Handler)
                                  ^ unknown linker script token
collect2: error: ld returned 1 exit status
make: *** [/[...]/Makefile:985: /[...]/output.elf] Error 1

I looked around at other issues, and it seems like the mold linker does not intend to support the full linker script? Linking the project takes a long time at the moment, it would be great to use mold, but the ENTRY token is common for embedded applications. (ENTRY explainer)

Versions:

$ mold --version
mold 2.35.1 (3cb551424bfcfd41e0f21a821b45ded33d06a38b; compatible with GNU ld)

$ ./toolchain/gcc-arm-none-eabi/bin/arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ./toolchain/gcc-arm-none-eabi/bin/arm-none-eabi-ld --version
GNU ld (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 2.33.1.20191025
Copyright (C) 2019 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

beyarkay avatar Jan 24 '25 06:01 beyarkay

mold support a limited set of linker script commands. ENTRY is not supported, but you can use the -e command line option instead.

rui314 avatar Jan 24 '25 08:01 rui314