Page MenuHomeFreeBSD

linker_set: fix globl/weak symbol redefinitions to work on clang 12
ClosedPublic

Authored by arichardson on Mar 9 2021, 7:50 PM.
Tags
None
Referenced Files
F102579944: D29159.id87766.diff
Thu, Nov 14, 8:09 AM
F102559360: D29159.id87766.diff
Thu, Nov 14, 1:43 AM
Unknown Object (File)
Tue, Nov 5, 11:47 PM
Unknown Object (File)
Mon, Nov 4, 4:43 PM
Unknown Object (File)
Sun, Oct 20, 6:22 PM
Unknown Object (File)
Sat, Oct 19, 8:27 AM
Unknown Object (File)
Fri, Oct 18, 5:54 AM
Unknown Object (File)
Oct 6 2024, 4:06 AM
Subscribers

Details

Summary

In clang 12.0.0.rc2, going from weak to global is now a hard error:

/usr/src/stand/libsa/amd64/_setjmp.S:67:25: error: _longjmp changed binding to STB_GLOBAL
.text; .p2align 4,0x90; .globl _longjmp; .type _longjmp,@function; _longjmp:; .cfi_startproc

And the other way is a warning, but we have -Werror:

error: __start_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm]
error: __stop_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm]

ref: https://reviews.llvm.org/D90108

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

val_packett.cool created this revision.
val_packett.cool edited the summary of this revision. (Show Details)
stand/libsa/amd64/_setjmp.S
66

This was not present in the i386 version at all, what is it doing here?

sys/sys/linker_set.h
64

I just went with the most similar-to-existing-code solution, but maybe it should just do the same C decls as SET_DECLARE here? Or something else?

libsa has been fixed by 59b2caef, dev/md by 69e18c9b7b12 (by just removing, heh)

Oops, the sets were not fixed

error: __start_set_cam_xpt_xport_set changed binding to STB_WEAK [-Werror,-Winline-asm]
error: __stop_set_cam_xpt_xport_set changed binding to STB_WEAK [-Werror,-Winline-asm]
val_packett.cool retitled this revision from Fix globl/weak symbol redefinitions to pacify clang 12 to linker_set: fix globl/weak symbol redefinitions to work on clang 12.
val_packett.cool added a reviewer: arichardson.

Only include linker_set changes

Sorry didn't see this revision. I chose a slightly different approach in D29495

Actually I think this solution is probably better than D29495. I just encountered some annoying errors where depending on ifdefs the set can be either empty or non-empty. Probably better to just always declare them weak.

sys/sys/cdefs.h
569–571

I think this should be sufficient.

arichardson edited reviewers, added: val_packett.cool; removed: arichardson.
This revision is now accepted and ready to land.Apr 15 2021, 10:32 AM

Will commit this version on Monday unless anyone has further comments.