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

John Brawn john.brawn at arm.com
Tue Jul 7 05:54:08 PDT 2015


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?

Looking at the Mach-O object output of global-merge-external.ll I do see a couple of oddities (based on my understanding of the above document), but they appear to happen whether extern global merging is enabled or not:

- Both zero-initialized variables and a zero-initialized MergedGlobals go in a section named `__common`, but I would expect them to go in a section named `__data`: https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/Assembler/040-Assembler_Directives/asm_directives.html#//apple_ref/doc/uid/TP30000823-CJBDFFDF says of `__data` "The compiler places all non-const initialized data (even initialized to zero) in this section".
- Global variables and global aliases end up with symbol flag `REFERENCE_FLAG_UNDEFINED_NON_LAZY` but I would expect `REFERENCE_FLAG_DEFINED`.


Repository:
  rL LLVM

http://reviews.llvm.org/D10966







More information about the llvm-commits mailing list