This is an archive of the discontinued LLVM Phabricator instance.

[GlobalMerge] Use private linkage for MergedGlobals variables
ClosedPublic

Authored by john.brawn on Aug 11 2015, 7:12 AM.

Details

Summary

Other objects can never reference the MergedGlobals symbol so external linkage is never needed. Using private instead of internal linkage means the object is more similar to what it looks like when global merging is not enabled, with the only difference being that the merged variables are addressed indirectly relative to the start of the section they are in.

Also add aliases for merged variables with internal linkage, as this also makes the object be more like what it is when they are not merged.

Diff Detail

Repository
rL LLVM

Event Timeline

john.brawn updated this revision to Diff 31809.Aug 11 2015, 7:12 AM
john.brawn retitled this revision from to [GlobalMerge] Use private linkage for MergedGlobals variables.
john.brawn updated this object.
john.brawn added reviewers: rafael, ab.
john.brawn set the repository for this revision to rL LLVM.
john.brawn added a subscriber: llvm-commits.
rafael accepted this revision.Aug 11 2015, 8:11 AM
rafael edited edge metadata.

LGTM

This revision is now accepted and ready to land.Aug 11 2015, 8:11 AM
This revision was automatically updated to reflect the committed changes.
ab edited edge metadata.Aug 11 2015, 5:07 PM

This means we'll start emitting aliases even when -global-merge-on-external=false (mach-o), right? As I explained on the other review, this is probably not OK on darwin.

In D11942#222309, @ab wrote:

This means we'll start emitting aliases even when -global-merge-on-external=false (mach-o), right? As I explained on the other review, this is probably not OK on darwin.

Yes, I think you're right. Fixed in r244748, and also added some tests to check for that.