[PATCH] D10966: [ARM] Make GlobalMerge merge extern globals by default

Ahmed Bougacha ahmed.bougacha at gmail.com
Thu Jul 30 11:36:50 PDT 2015


ab added a comment.

In http://reviews.llvm.org/D10966#200255, @john.brawn wrote:

> In http://reviews.llvm.org/D10966#199852, @ab wrote:
>
> > For instance, this won't work on Mach-O, most importantly because aliases are just regular symbols, and symbols are (usually) assumed atomic;  __MergedGlobals wouldn't be in this case.
>
>
> Do you know where I could find out more about this? Looking at the Apple Mach-O documentation (https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/MachORuntime/index.html) I don't see anything like this.
>  What exactly do you mean by 'atomic' here?


With the ".subsections_via_symbols" directive, each section is split up into "subsections", each one associated with a single symbol.  The linker is free to strip or reorder these subsections.  Since aliases are just regular symbols, aliases into _MergedGlobals could potentially cause it to be broken apart in the final binary, thus making the offset-addressing code invalid (since the code should only reference the first symbol, the rest might get dead-stripped).

Hope that helps, sorry for the delay!


http://reviews.llvm.org/D10966







More information about the llvm-commits mailing list