Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld.bfd: unrecognized option --exclude-libs #343

Open
yogo1212 opened this issue Jan 25, 2024 · 2 comments
Open

ld.bfd: unrecognized option --exclude-libs #343

yogo1212 opened this issue Jan 25, 2024 · 2 comments

Comments

@yogo1212
Copy link
Contributor

CROSS_COMPILE=riscv64-elf- make -C build/opensbi PLATFORM=generic FW_TEXT_START=0x40000000 FW_OPTIONS=0
 ELF       platform/generic/firmware/payloads/test.elf
/usr/lib/gcc/riscv64-elf/12.2.0/../../../../riscv64-elf/bin/ld.bfd: unrecognized option '--exclude-libs'
/usr/lib/gcc/riscv64-elf/12.2.0/../../../../riscv64-elf/bin/ld.bfd: use the --help option for usage information
collect2: error: ld returned 1 exit status

Is this because the toolchain is for bare-metal?
Should the toolchain be checked before --exclude-libs is added to ELFFLAGS?

@yogo1212
Copy link
Contributor Author

Without the --exclude-libs, there's a failure linking fw_dynamic.elf:

/usr/lib/gcc/riscv64-elf/12.2.0/../../../../riscv64-elf/bin/ld.bfd:/home/leon/git/arch-star64-img/build/opensbi/build/platform/generic/firmware/fw_dynamic.elf.ld:54: undefined section `.dynsym' referenced in expression

@yogo1212
Copy link
Contributor Author

Simply removing SIZEOF(.dynsym) from the sum in the linker script re-enables the build.
Am I confident in the resulting image? 🤷

If there are exported symbols, there's no need for a dynsym section, or am I wrong?
I'll create a PR discarding the section.

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 a pull request may close this issue.

1 participant