Skip to content

Restore ld_bfd finding libgcc to link with it, fix bootstrap build for linux-armhf#33

Open
illwieckz wants to merge 1 commit into
masterfrom
illwieckz/ldbfd-libgcc
Open

Restore ld_bfd finding libgcc to link with it, fix bootstrap build for linux-armhf#33
illwieckz wants to merge 1 commit into
masterfrom
illwieckz/ldbfd-libgcc

Conversation

@illwieckz

@illwieckz illwieckz commented Jul 3, 2026

Copy link
Copy Markdown
Member

Restore ld_bfd finding libgcc to link with it, fix bootstrap build for linux-armhf.

Fixup for:

Fixes:

arm-linux-gnueabihf-ld.bfd: nacl_bootstrap.dir/nacl_bootstrap.c.o: in function `iov_int_string':
nacl_bootstrap.c:118: undefined reference to `__aeabi_idivmod'

@illwieckz illwieckz requested a review from slipher July 3, 2026 05:05
@illwieckz illwieckz mentioned this pull request Jul 3, 2026
@illwieckz illwieckz changed the title ld_bfd: link with libgcc Restore ld_bfd finding libgcc to link with it, fix bootstrap build for linux-armhf Jul 3, 2026
@slipher

slipher commented Jul 3, 2026

Copy link
Copy Markdown
Member

How are you using it? It works for me in the Scons build for both GCC and Clang. With Clang (scons --mode=opt-host,nacl saigo=1 werror=0 platform=arm all_programs -j9) the command issued is:

env CXX='/usr/bin/clang++' /usr/bin/python3 /unv/nacl/src/trusted/service_runtime/linux/ld_bfd.py --compiler arm-linux-gnueabihf-g++ -m armelf_linux_eabi --build-id -static -z max-page-size=0x1000 --orphan-handling=discard --defsym RESERVE_TOP=0x40002000 --script /unv/nacl/src/trusted/service_runtime/linux/nacl_bootstrap.x -o scons-out/opt-linux-arm/obj/src/trusted/service_runtime/nacl_bootstrap_raw scons-out/opt-linux-arm/obj/src/trusted/service_runtime/linux/nacl_bootstrap.o

With GCC (scons --mode=opt-host,nacl saigo=1 werror=0 platform=arm all_programs -j9 --no-clang) the command issued is:

env CXX='arm-linux-gnueabihf-g++' /usr/bin/python3 /unv/nacl/src/trusted/service_runtime/linux/ld_bfd.py --compiler arm-linux-gnueabihf-g++ -m armelf_linux_eabi --build-id -static -z max-page-size=0x1000 --orphan-handling=discard --defsym RESERVE_TOP=0x40002000 --script /unv/nacl/src/trusted/service_runtime/linux/nacl_bootstrap.x -o scons-out/opt-linux-arm/obj/src/trusted/service_runtime/nacl_bootstrap_raw scons-out/opt-linux-arm/obj/src/trusted/service_runtime/linux/nacl_bootstrap.o

Anyway surely you don't need this junk? It was described as only being needed to avoid using gold but that hardly exists any more. I would have gotten rid of it but didn't feel like untangling everything at the moment. For a new build surely you could just set it in the toolchain file or whatever.

# We just have to hope the system binutils knows about the target platform
args = ["ld.bfd"] + args

libgcc = FindLibgcc(cxx_bin)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't adding libgcc be inside the g++ detection block?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I remember now that the "g++" string depends on what architecture was used, not what compiler...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have a libgcc on the system you compile with clang for, what matters there is to find libgcc when it's present (and then, less likely to be used).

@slipher slipher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK to merge as it doesn't break anything. Though I wonder if there is some unintended difference in the build that makes this required. And with the caveat that it would be probably nicer to just call the desired linker directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants