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

John Brawn john.brawn at arm.com
Fri Jul 31 03:32:14 PDT 2015


john.brawn added a comment.

In http://reviews.llvm.org/D10966#215452, @ab wrote:

> 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!


Ah, I see, and that directive gets emitted by ARMAsmPrinter::EmitEndOfAsmFile. I'll upload a new patch that disables merging of globals on Mach-O.


http://reviews.llvm.org/D10966







More information about the llvm-commits mailing list