This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Emit the right header flags for weak bindings/symbols
ClosedPublic

Authored by int3 on Aug 25 2020, 1:22 PM.

Details

Diff Detail

Event Timeline

int3 created this revision.Aug 25 2020, 1:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2020, 1:22 PM
int3 requested review of this revision.Aug 25 2020, 1:22 PM
smeenai accepted this revision.Aug 26 2020, 9:35 PM
smeenai added a subscriber: smeenai.

LGTM

lld/MachO/SyntheticSections.cpp
429

This is ridiculously nitty on my part, but if you write this instead, it'll get short-circuited.

lld/test/MachO/weak-header-flags.s
17

Nit: I'd prefer an --implicit-check-not MH_WEAK_DEFINES in the FileCheck command instead, to catch it both before or after the MH_BINDS_TO_WEAK (or you could also add the NOT check before as well). I recognize that readobj will probably print them in the order you're checking (and the above test would fail if that order changed anyway), so this is a purely hypothetical concern :)

This revision is now accepted and ready to land.Aug 26 2020, 9:35 PM
int3 updated this revision to Diff 288198.Aug 26 2020, 11:07 PM
int3 marked 2 inline comments as done.

address comments

lld/MachO/SyntheticSections.cpp
429

I know... I just hate that C++ doesn't support ||=. I'll change it :p

lld/test/MachO/weak-header-flags.s
17

I dislike how --implicit-check-not is placed far away from the other check statements, but putting it before and after the positive check here sounds good