[PATCH] D65837: For explicit sections, limit unique section ids to when fintegrated-as=true.

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 17:24:00 PDT 2019


rahmanl created this revision.
rahmanl added a reviewer: pcc.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
rahmanl added a reviewer: dblaikie.
rahmanl added a subscriber: brooksmoses.

This limits the applicability of r367501 to the integrated assembler because the gnu-assembler does not recognize unique section ids.

Tested locally by adding the -no-integrated-as to llc and checking that the unique ids are not used.


Repository:
  rL LLVM

https://reviews.llvm.org/D65837

Files:
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp


Index: lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -588,15 +588,18 @@
 
   bool EmitUniqueSection = false;
 
-  // If we have -ffunction-sections or -fdata-sections then we should emit the
-  // global value to a uniqued section of the same name.
-  if (!(Flags & ELF::SHF_MERGE) && !Kind.isCommon()) {
-    if (Kind.isText())
-      EmitUniqueSection = TM.getFunctionSections();
-    else
-      EmitUniqueSection = TM.getDataSections();
+  if (TM.getMCAsmInfo()->useIntegratedAssembler()) {
+    // If we are using the integrated assembler and we have -ffunction-sections
+    // or -fdata-sections, then we emit the global value into a uniqued section
+    // of the same name.
+    if (!(Flags & ELF::SHF_MERGE) && !Kind.isCommon()) {
+      if (Kind.isText())
+        EmitUniqueSection = TM.getFunctionSections();
+      else
+        EmitUniqueSection = TM.getDataSections();
+    }
+    EmitUniqueSection |= GO->hasComdat();
   }
-  EmitUniqueSection |= GO->hasComdat();
 
   // A section can have at most one associated section. Put each global with
   // MD_associated in a unique section.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65837.213754.patch
Type: text/x-patch
Size: 1270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190807/3d3601d9/attachment.bin>


More information about the llvm-commits mailing list