[PATCH] D72194: [MC][ELF] Ensure that mergeable globals with an explicit section are assigned to SHF_MERGE sections with compatible entsizes

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 17:28:06 PST 2020


bd1976llvm marked 4 inline comments as done.
bd1976llvm added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:608
+      UniqueID = i.first->second;
+    }
   }
----------------
rjmccall wrote:
> This looks like it should work.  I don't know the MC code design well enough to have an opinion about whether it's better to handle this here or in `getELFSection`.
It is better to handle this here, associated symbols are handled in a similar manner.


================
Comment at: llvm/test/CodeGen/X86/explict-section-mergeable.ll:12
+
+; UNIQUE:     .section        ".clang-section-pragma","aM", at progbits,4,unique,1
+; UNIQUE-NOT: .section
----------------
nickdesaulniers wrote:
> I don't understand the `,unique,1` part. Can you clarify?
> https://sourceware.org/binutils/docs/as/Section.html
Hi Nick,

The "unique 1" here is an LLVM extension to allow for multiple sections with the same name to be created and referenced in assembly. 
The GNU assembler only allows the creation of a single section for a given name.. if you try to create a second section with the same name as a previous section but different properties then the assembler instead switches the current section back to the original section and ignores the properties you specified.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72194/new/

https://reviews.llvm.org/D72194





More information about the llvm-commits mailing list