This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Only enable `__DATA_CONST` for newer platforms
ClosedPublic

Authored by int3 on Jun 28 2021, 8:59 PM.

Details

Summary

Matches ld64.

Diff Detail

Event Timeline

int3 created this revision.Jun 28 2021, 8:59 PM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Jun 28 2021, 8:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2021, 8:59 PM
This revision is now accepted and ready to land.Jun 28 2021, 9:09 PM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Jul 2 2021, 7:15 PM
thakis added inline comments.
lld/MachO/Driver.cpp
852

(Please feel free to ignore!)

PlatformKind is an enum with sequential numbers.

The code as is at first execution creates a red-black tree with 8 entries, then walks it.

A switch statement on the other hand should produce much smaller and simpler machine code, without being more verbose.

I doubt it matters in practice, but it's a good opportunity for more "silicon sympathy" :)

int3 added inline comments.Jul 4 2021, 1:16 PM
lld/MachO/Driver.cpp
852

a switch statement would put every VersionTuple on a different line than the case, and would also require another line for the breaks, so it's considerably more verbose...

good point about the sequential numbers though, a lookup array would probably be better here.