This is an archive of the discontinued LLVM Phabricator instance.

[HWASan] Use a single .weak binding in asm.
ClosedPublic

Authored by morehouse on Sep 21 2021, 7:50 AM.

Details

Summary

Specifying .global and .weak causes a compiler warning:

`warning: __sigsetjmp changed binding to STB_WEAK`

Specifying only .weak should have the same effect without causing a
warning.

Diff Detail

Event Timeline

morehouse requested review of this revision.Sep 21 2021, 7:50 AM
morehouse created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2021, 7:50 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
eugenis accepted this revision.Sep 21 2021, 10:01 AM

Sure.
Of course, this is not clearly documented anywhere.
LGTM

This revision is now accepted and ready to land.Sep 21 2021, 10:01 AM
This revision was landed with ongoing or failed builds.Sep 22 2021, 9:35 AM
This revision was automatically updated to reflect the committed changes.

ELF has 3 main bindings: STB_LOCAL, STB_GLOBAL, STB_WEAK.
.local .globa?l .weak control them.
They are conceptually mutual exclusive.

The integrated assembler used to treat .weak .globl differently from GNU as .globl .weak.
To warn users about the potentially unintended consequence, MC started to warn.