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
Unknown Object (File)
Wed, Apr 17, 8:01 AM
Unknown Object (File)
Sat, Apr 13, 7:08 PM
Unknown Object (File)
Wed, Apr 10, 1:18 AM
Unknown Object (File)
Tue, Apr 9, 7:48 PM
Unknown Object (File)
Sun, Apr 7, 5:33 PM
Unknown Object (File)
Fri, Apr 5, 12:52 PM
Unknown Object (File)
Mon, Apr 1, 1:13 PM
Unknown Object (File)
Mar 11 2024, 4:53 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38569
Build 35458: arc lint + arc unit

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 ↗(On Diff #85416)

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.