Page MenuHomeFreeBSD

For riscv kernel builds, add -N to LDFLAGS instead of replacing the SYSTEM_LD variable.
ClosedPublic

Authored by ian on Dec 24 2019, 11:16 PM.

Details

Summary

This avoids duplicating the contents of SYSTEM_LD from kern.pre.mk just to add the -N flag to it. If the basic linker command ever needs to be changed, this will be one less place that has to be found and fixed.

Test Plan

Not tested at all, could a riscv person please test this?

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Does anyone know why riscv needs writable text segments? Or if it really does?

If you can find out why -N is needed, please add a comment. Otherwise we are good to go

This revision is now accepted and ready to land.Dec 24 2019, 11:45 PM
In D22920#502031, @ian wrote:

Does anyone know why riscv needs writable text segments? Or if it really does?

It doesn't seem to be required. It builds, boots and runs regression tests (although I've not run the full set yet) happily without the -N.

Just an update to note that the commit for this was reverted in r356078 due to CI build failures. I'm unable to install a working riscv toolchain for building and testing myself, apparently at least in part because I'm still running 12.0-stable (and if I try to upgrade from that my video card turns into a pumpkin).

In D22920#502165, @ian wrote:

Just an update to note that the commit for this was reverted in r356078 due to CI build failures. I'm unable to install a working riscv toolchain for building and testing myself, apparently at least in part because I'm still running 12.0-stable (and if I try to upgrade from that my video card turns into a pumpkin).

Adding -Bdynamic to LDFLAGS fixes the compile issue with the GCC toolchain.

If you are able, can you send me the error you get while trying to build using 12.0-stable? You should be able to build riscv using any supported FreeBSD version.