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)
Mon, Mar 11, 4:53 AM
Unknown Object (File)
Fri, Mar 1, 2:43 PM
Unknown Object (File)
Feb 13 2024, 7:20 PM
Unknown Object (File)
Feb 12 2024, 9:03 AM
Unknown Object (File)
Dec 20 2023, 9:24 AM
Unknown Object (File)
Dec 20 2023, 7:51 AM
Unknown Object (File)
Dec 14 2023, 10:10 PM
Unknown Object (File)
Nov 26 2023, 10:36 PM
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 ↗(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.