This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Allow deduplicate-literals to be overridden
ClosedPublic

Authored by thevinster on Jan 14 2022, 11:11 PM.

Details

Reviewers
int3
Group Reviewers
Restricted Project
Commits
rGe5347f2556cb: [lld-macho] Allow deduplicate-literals to be overridden
Summary

It's still uncertain but whether we want to have deduplicate-literals be the
default flag for LLD out of the box or not. If deduplicate-literals is the default
behavior, then we will need a way override it and not deduplicate. Luckily, we
have no_deduplicate to fill this gap. For now, I've set the default to be false
which aligns with the existing behavior. That can only always be changed after
discussions on D117250.

Diff Detail

Event Timeline

thevinster created this revision.Jan 14 2022, 11:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2022, 11:11 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
thevinster published this revision for review.Jan 14 2022, 11:18 PM
thevinster edited the summary of this revision. (Show Details)
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2022, 11:19 PM
int3 accepted this revision.Jan 15 2022, 12:53 PM
int3 added a subscriber: int3.

lgtm

This revision is now accepted and ready to land.Jan 15 2022, 12:53 PM

It's worth noting that -no_deduplicate in ld64 actually turns off ICF, not string merging. I don't know if ld64 even has a way to turn off string merging, since IIRC it's implemented in the symbol table itself.

lld/MachO/Driver.cpp
1285

I'm confused ... was the second argument meant to be OPT_no_deduplicate? The test seems to be passing though...

int3 added inline comments.Jan 17 2022, 9:52 PM
lld/MachO/Driver.cpp
1285

-no_deduplicate aliases to setting OPT_icf_eq to false :)

thevinster marked 2 inline comments as done.Jan 18 2022, 12:46 PM

It's worth noting that -no_deduplicate in ld64 actually turns off ICF, not string merging. I don't know if ld64 even has a way to turn off string merging, since IIRC it's implemented in the symbol table itself.

Yup. LLD's -no_deduplicate also turns off ICF but it _also_ turns off string merging. It's probably worth documenting this as well.

Update differences in rst