Page MenuHomeFreeBSD

Consolidate duplicated logic in csu Makefiles to lib/csu/Makefile.inc.
ClosedPublic

Authored by jhb on Jul 1 2020, 5:13 PM.

Details

Test Plan
  • make tinderbox, readelf -n of resulting /bin/sh, libc.so.7

Diff Detail

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

Event Timeline

jhb created this revision.Jul 1 2020, 5:13 PM
jhb requested review of this revision.Jul 1 2020, 5:13 PM
jhb added a comment.Jul 1 2020, 5:16 PM

I got tired of reworking the crt changes with lots of conflicts as I moved the ABI tag note around, so wanted to pause and simplify the build glue first so that the diffs would be smaller and more obvious.

The next step after this I think is to switch to having most of Makefile.inc in lib/csu/Makefile itself where the MD Makefiles become Makefile.inc so it's more like how libc's Makefile works, but I think this is a useful checkpoint before doing that.

lib/csu/amd64/Makefile
8 ↗(On Diff #73975)

crtbrand.o is surely MI, but I'm not sure if ignore_init is MI as well or if it should remain MD (all arch do it, but I'm not sure if that's by design).

kib accepted this revision.Jul 2 2020, 3:02 AM
kib added inline comments.
lib/csu/amd64/Makefile
8 ↗(On Diff #73975)

In theory it is up to the compiler (i.e. not even part of the ABI). Practically, I remember that gcc auto-detects where the constructors are called, from crt1 or by ld-elf.so, and adapts to the platform. And glibc was converted to contructors from ld-elf, which was the reason why we followed the suit.

I think we can claim that not calling constructors from crt is no longer MD.

This revision is now accepted and ready to land.Jul 2 2020, 3:02 AM
jhb updated this revision to Diff 74032.Jul 2 2020, 11:11 PM
  • Centralize MI CTRT1OBJS.
This revision now requires review to proceed.Jul 2 2020, 11:11 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 3 2020, 12:09 AM
This revision was automatically updated to reflect the committed changes.