Page MenuHomeFreeBSD

Compile hack.c with normal CFLAGS + -shared -nostdlib.
ClosedPublic

Authored by jhb on Jan 25 2020, 10:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 2:11 PM
Unknown Object (File)
Oct 21 2024, 11:14 AM
Unknown Object (File)
Oct 10 2024, 8:47 PM
Unknown Object (File)
Oct 10 2024, 2:06 PM
Unknown Object (File)
Oct 10 2024, 3:44 AM
Unknown Object (File)
Oct 4 2024, 1:52 AM
Unknown Object (File)
Oct 3 2024, 11:59 PM
Unknown Object (File)
Oct 3 2024, 5:01 PM

Details

Summary

Originally, hack.c was compiled into a shard object with just -shared
-nostdlib. This assumed that ${CC} did not require any additional
flags for ABIs, cross-building, etc.

When kern.post.mk was created in r89509 by reducing duplication in
kernel Makefile.<arch> files, the -shared flag was moved into a
HACK_EXTRA_FLAGS variable so that sparc64 could override it with
-Wl,-shared. The sparc64 hack was removed in r111650, but
HACK_EXTRA_FLAGS was left in place. Over time, we have started
support toolchains that require flags to support alternate ABIs on
MIPS and PowerPC and started (ab)using HACK_EXTRA_FLAGS to set only
those flags.

I need to fix risc-v to pass -mno-relax to the hack.c build for lld in
llvm 10, and the patches to support cross-build from non-FreeBSD hosts
need to include -target for clang in CFLAGS for hack.c. Rather than
adding more hacks into HACK_EXTRA_FLAGS, just use the full set of
CFLAGS with hack.c.

Test Plan
  • make tinderbox
  • CheriBSD has used a similar-ish change (it copied the expresion from genoffsets.c to strip lto and one other flag, but I don't think those matter for the empty hack.c case)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

BTW I think that pico extension is not correct (as much as extension can be).

This revision is now accepted and ready to land.Jan 25 2020, 10:39 AM

Yes I agree, removing the LTO option is not necessary.
I think in https://github.com/CTSRD-CHERI/cheribsd/commit/8041a7e459d1d6e453d082ff57db2f3f94ca1a3c I just copied from the genassym.o line.

It used to be .So but was changed to .pico in https://svnweb.freebsd.org/base?view=revision&revision=306297. In this particular case there isn't a .so that it would collide with, so it could go back to .So perhaps, but I'm not going to bother with that anytime soon.

This revision was automatically updated to reflect the committed changes.