Page MenuHomeFreeBSD

Re-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around
ClosedPublic

Authored by kevans on Sep 18 2019, 2:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 9:38 PM
Unknown Object (File)
Fri, Mar 22, 9:22 PM
Unknown Object (File)
Fri, Mar 22, 9:22 PM
Unknown Object (File)
Fri, Mar 22, 9:22 PM
Unknown Object (File)
Fri, Mar 22, 9:22 PM
Unknown Object (File)
Sun, Mar 17, 5:46 PM
Unknown Object (File)
Mar 8 2024, 7:14 AM
Unknown Object (File)
Feb 29 2024, 3:39 AM
Subscribers

Details

Summary

Diff partially stolen from CheriBSD; these bits need -Wl,-z,notext in order to build in an LLVM world. They are needed for all flavors/sizes of MIPS. This will eventually get fixed in LLVM, but it's unclear when.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 26683

Event Timeline

share/mk/bsd.lib.mk
286

Maybe rename this to ALLOW_MIPS_SHARED_TEXTREL or something, if it really only applies to mips?

289

Looking at this, I think that you should simply check if ALLOW_SHARED_TEXTREL is defined or not, and stop using the "yes" and "no" values, as this is not a regular MK_FOO knob.

Otherwise, you would have to check for:

.if !defined(ALLOW_SHARED_TEXTREL) || ${ALLOW_SHARED_TEXTREL} != "yes"

instead.

290

I wonder if there is a way to really "fix" this, in the sense that we could get clang and lld to stop attempting to make those relocations? :)

292

Maybe best to decouple this from the -z,notext handling, as people might still want to have linker warnings on mips.

I'll address the rest of this later this morning.

share/mk/bsd.lib.mk
290

Simon plans to fix it, but he was not able to get me definitive timeline -- which is OK, since he does so much. =)

kevans marked 3 inline comments as done.
kevans retitled this revision from Re-add ALLOW_SHARED_TEXTREL, sprinkle it around to Re-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around.

Rename to ALLOW_MIPS_SHARED_TEXTREL and clean up the bsd.lib.mk segment quite a bit. Stop with silly yes/no, check for defined and only do something if mips.

Looks good. Although I'm not sure if we want this to be conditional on clang/lld since modern GCC+bfd should work (and maybe even clang+new bfd).

Looks good. Although I'm not sure if we want this to be conditional on clang/lld since modern GCC+bfd should work (and maybe even clang+new bfd).

IIRC clang+new bfd still fails as bfd checks object files and catches the relocation in read-only segment. I'll retest that, though, because my memory is dicy here.

share/mk/bsd.lib.mk
285

why yes here and empty string elsewhere?

297–299

Can we extend this comment slightly to indicate the conditions for eventual revert? Presumably a later version of lld would address this?

kevans marked an inline comment as done.
  • One last instance of "yes" where the value doesn't matter has been fixed.
  • Add enough explanation to make it clear that this won't spontaneously go away due to work in the FreeBSD tree, but rather from clang/lld revisions.
This revision is now accepted and ready to land.Oct 2 2019, 6:23 PM