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.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

greg_unrelenting.technology created this revision.
greg_unrelenting.technology edited the summary of this revision. (Show Details)
stand/libsa/amd64/_setjmp.S
66 ↗(On Diff #85416)

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

sys/sys/linker_set.h
63

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]
greg_unrelenting.technology 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.

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
568–570

I think this should be sufficient.

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.