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)
Feb 14 2024, 11:19 PM
Unknown Object (File)
Jan 13 2024, 3:25 AM
Unknown Object (File)
Dec 20 2023, 3:35 AM
Unknown Object (File)
Nov 17 2023, 6:57 AM
Unknown Object (File)
Nov 9 2023, 11:34 AM
Unknown Object (File)
Nov 7 2023, 9:09 AM
Unknown Object (File)
Nov 6 2023, 3:16 PM
Unknown Object (File)
Oct 8 2023, 10:30 AM

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 Passed
Unit
No Test Coverage
Build Status
Buildable 28912
Build 26902: arc lint + arc unit

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.