[llvm] r368204 - Revert r367501 "Create unique, but identically-named ELF sections..."
Bob Haarman via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 13:45:23 PDT 2019
Author: inglorion
Date: Wed Aug 7 13:45:23 2019
New Revision: 368204
URL: http://llvm.org/viewvc/llvm-project?rev=368204&view=rev
Log:
Revert r367501 "Create unique, but identically-named ELF sections..."
This reverts commit fbc563e2cb6c5f1d0200b390513506b6aca4d2e9 "Create
unique, but identically-named ELF sections for explicitly-sectioned
functions and globals when using -function-sections and
-data-sections."
Reason for revert: sections are created with potentially wrong
attributes.
Removed:
llvm/trunk/test/CodeGen/X86/explicit-elf-sections.ll
Modified:
llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/trunk/test/CodeGen/X86/elf-associated.ll
Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=368204&r1=368203&r2=368204&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Wed Aug 7 13:45:23 2019
@@ -586,30 +586,15 @@ MCSection *TargetLoweringObjectFileELF::
Flags |= ELF::SHF_GROUP;
}
- 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();
- }
- EmitUniqueSection |= GO->hasComdat();
-
// A section can have at most one associated section. Put each global with
// MD_associated in a unique section.
+ unsigned UniqueID = MCContext::GenericSectionID;
const MCSymbolELF *AssociatedSymbol = getAssociatedSymbol(GO, TM);
if (AssociatedSymbol) {
- EmitUniqueSection = true;
+ UniqueID = NextUniqueID++;
Flags |= ELF::SHF_LINK_ORDER;
}
- unsigned UniqueID = MCContext::GenericSectionID;
- if (EmitUniqueSection)
- UniqueID = NextUniqueID++;
-
MCSectionELF *Section = getContext().getELFSection(
SectionName, getELFSectionType(SectionName, Kind), Flags,
getEntrySizeForKind(Kind), Group, UniqueID, AssociatedSymbol);
Modified: llvm/trunk/test/CodeGen/X86/elf-associated.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/elf-associated.ll?rev=368204&r1=368203&r2=368204&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/elf-associated.ll (original)
+++ llvm/trunk/test/CodeGen/X86/elf-associated.ll Wed Aug 7 13:45:23 2019
@@ -1,5 +1,5 @@
-; RUN: llc -data-sections=1 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s --check-prefix=DSECTIONS --check-prefix=CHECK
-; RUN: llc -data-sections=0 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s --check-prefix=NDSECTIONS --check-prefix=CHECK
+; RUN: llc -data-sections=1 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
+; RUN: llc -data-sections=0 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
@a = global i32 1
@b = global i32 2, !associated !0
@@ -28,14 +28,9 @@
@j = global i32 1, section "bbb", !associated !4
@k = global i32 1, !associated !4
!4 = !{i32* @h}
-; NDSECTIONS-DAG: .section aaa,"aw", at progbits
-; NDSECTIONS-DAG: .section bbb,"awo", at progbits,h,unique,1
-; NDSECTIONS-DAG: .section bbb,"awo", at progbits,h,unique,2
-
-; DSECTIONS-DAG: .section aaa,"aw", at progbits,unique,1
-; DSECTIONS-DAG: .section bbb,"awo", at progbits,h,unique,2
-; DSECTIONS-DAG: .section bbb,"awo", at progbits,h,unique,3
-
+; CHECK-DAG: .section aaa,"aw", at progbits
+; CHECK-DAG: .section bbb,"awo", at progbits,h,unique,1
+; CHECK-DAG: .section bbb,"awo", at progbits,h,unique,2
; CHECK-DAG: .section .data.k,"awo", at progbits,h
; Non-GlobalValue metadata.
@@ -52,5 +47,4 @@
@n = alias i32, i32* inttoptr (i64 add (i64 ptrtoint (i32* @a to i64), i64 1297036692682702848) to i32*)
@o = global i32 1, section "eee", !associated !7
!7 = !{i32* @n}
-; NDSECTIONS-DAG: .section eee,"awo", at progbits,n,unique,3
-; DSECTIONS-DAG: .section eee,"awo", at progbits,n,unique,6
+; CHECK-DAG: .section eee,"awo", at progbits,n,unique,3
Removed: llvm/trunk/test/CodeGen/X86/explicit-elf-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/explicit-elf-sections.ll?rev=368203&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/explicit-elf-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/explicit-elf-sections.ll (removed)
@@ -1,65 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections=1 -data-sections=1 | FileCheck %s -check-prefix=SECTIONS
-; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections=0 -data-sections=0 | FileCheck %s -check-prefix=NSECTIONS
-
-define void @f() section "aaa" { ret void }
-define void @g() section "aaa" { ret void }
-
-define void @h() { ret void }
-
- at x = global i32 1, section "aaa"
- at y = global i32 1, section "aaa"
- at z = global i32 1
-
-define void @i() section "aaa" { ret void }
-
- at w = global i32 1, section "aaa"
-
-; NSECTIONS: .section aaa,"ax", at progbits
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: f:
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: g:
-; NSECTIONS: .text
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: h:
-; NSECTIONS: .section aaa,"ax", at progbits
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: i:
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: x:
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: y:
-; NSECTIONS: .data
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: z:
-; NSECTIONS: .section aaa,"ax", at progbits
-; NSECTIONS-NOT: {{\.section|\.text|\.data}}
-; NSECTIONS: w:
-
-
-; SECTIONS: .section aaa,"ax", at progbits,unique,1
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: f:
-; SECTIONS: .section aaa,"ax", at progbits,unique,2
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: g:
-; SECTIONS: .section .text.h,"ax", at progbits
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: h:
-; SECTIONS: .section aaa,"ax", at progbits,unique,3
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: i:
-; SECTIONS: .section aaa,"aw", at progbits,unique,4
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: x:
-; SECTIONS: .section aaa,"aw", at progbits,unique,5
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: y:
-; SECTIONS: .section .data.z,"aw", at progbits
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: z:
-; SECTIONS: .section aaa,"aw", at progbits,unique,6
-; SECTIONS-NOT: {{\.section|\.text|\.data}}
-; SECTIONS: w:
-
-
More information about the llvm-commits
mailing list