[lld] r200675 - [ELF] change LayoutBefore Reference to InGroup Reference
Shankar Easwaran
shankare at codeaurora.org
Sun Feb 2 20:01:15 PST 2014
Author: shankare
Date: Sun Feb 2 22:01:14 2014
New Revision: 200675
URL: http://llvm.org/viewvc/llvm-project?rev=200675&view=rev
Log:
[ELF] change LayoutBefore Reference to InGroup Reference
This makes it a lot easier for Section Group design.
Modified:
lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
lld/trunk/test/elf/Hexagon/hexagon-plt-setup.test
lld/trunk/test/elf/Mips/got16.test
lld/trunk/test/elf/X86_64/multi-weak-layout.test
lld/trunk/test/elf/X86_64/weak-override.test
lld/trunk/test/elf/X86_64/weak-zero-sized.test
lld/trunk/test/elf/ifunc.test
lld/trunk/test/elf/mergeconstants.test
lld/trunk/test/elf/reloc.test
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Sun Feb 2 22:01:14 2014
@@ -626,6 +626,7 @@ template <class ELFT> error_code ELFFile
}
ELFDefinedAtom<ELFT> *previousAtom = nullptr;
+ ELFDefinedAtom<ELFT> *inGroupAtom = nullptr;
ELFReference<ELFT> *anonFollowedBy = nullptr;
for (auto si = symbols.begin(), se = symbols.end(); si != se; ++si) {
@@ -688,8 +689,6 @@ template <class ELFT> error_code ELFFile
anonAtom->setOrdinal(++_ordinal);
symbolData = ArrayRef<uint8_t>();
- if (previousAtom)
- createEdge(anonAtom, previousAtom, lld::Reference::kindLayoutBefore);
// If this is the last atom, let's not create a followon reference.
if (anonAtom && (si + 1) != se) {
anonFollowedBy = new (_readerStorage)
@@ -715,13 +714,16 @@ template <class ELFT> error_code ELFFile
// Add a preceded-by reference only if the current atom is not a weak
// atom.
if (symbol->getBinding() != llvm::ELF::STB_WEAK)
- createEdge(newAtom, previousAtom, lld::Reference::kindLayoutBefore);
+ createEdge(newAtom, inGroupAtom, lld::Reference::kindInGroup);
}
// The previous atom is always the atom created before unless the atom
// is a weak atom.
previousAtom = anonAtom ? anonAtom : newAtom;
+ if (!inGroupAtom)
+ inGroupAtom = previousAtom;
+
_definedAtoms._atoms.push_back(newAtom);
_symbolToAtomMapping.insert(std::make_pair(&*symbol, newAtom));
if (anonAtom)
Modified: lld/trunk/test/elf/Hexagon/hexagon-plt-setup.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Hexagon/hexagon-plt-setup.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/Hexagon/hexagon-plt-setup.test (original)
+++ lld/trunk/test/elf/Hexagon/hexagon-plt-setup.test Sun Feb 2 22:01:14 2014
@@ -10,6 +10,3 @@ CHECK: offset: 4
CHECK: - kind: R_HEX_B22_PCREL
CHECK: offset: 8
target:
-CHECK: - kind: layout-before
-CHECK: offset: 0
-CHECK: target: fn1
Modified: lld/trunk/test/elf/Mips/got16.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/got16.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/got16.test (original)
+++ lld/trunk/test/elf/Mips/got16.test Sun Feb 2 22:01:14 2014
@@ -6,84 +6,78 @@
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t2 %t1
# RUN: llvm-objdump -t -disassemble %t2 | FileCheck -check-prefix RAW %s
-# YAML: - ref-name: L003
-# YAML: type: got
-# YAML: content: [ 00, 00, 00, 00 ]
-# YAML: alignment: 2^2
-# YAML: section-choice: custom-required
-# YAML: section-name: .got
-# YAML: permissions: rw-
-# YAML: references:
-# YAML: - kind: R_MIPS_32
-# YAML: offset: 0
-# YAML: target: L004
-# YAML: - ref-name: L005
-# YAML: type: got
-# YAML: content: [ 00, 00, 00, 00 ]
-# YAML: alignment: 2^2
-# YAML: section-choice: custom-required
-# YAML: section-name: .got
-# YAML: permissions: rw-
-# YAML: references:
-# YAML: - kind: R_MIPS_32
-# YAML: offset: 0
-# YAML: target: hidden
-# YAML: - ref-name: L006
-# YAML: type: got
-# YAML: content: [ 00, 00, 00, 00 ]
-# YAML: alignment: 2^2
-# YAML: section-choice: custom-required
-# YAML: section-name: .got
-# YAML: permissions: rw-
-# YAML: references:
-# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT
-# YAML: offset: 0
-# YAML: target: glob
-# YAML: - kind: R_MIPS_32
-# YAML: offset: 0
-# YAML: target: glob
-# YAML: - ref-name: L007
-# YAML: type: got
-# YAML: content: [ 00, 00, 00, 00 ]
-# YAML: alignment: 2^2
-# YAML: section-choice: custom-required
-# YAML: section-name: .got
-# YAML: permissions: rw-
-# YAML: references:
-# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT
-# YAML: offset: 0
-# YAML: target: extern
-# YAML: - ref-name: L008
-# YAML: alignment: 2^2
-# YAML: references:
-# YAML: - kind: layout-after
-# YAML: offset: 0
-# YAML: target: glob
-# YAML: - name: glob
-# YAML: scope: global
-# YAML: content: [ 00, 00, 84, 8F, 00, 00, 84, 24, 00, 00, 84, 8F,
-# YAML: 00, 00, 84, 8F, 00, 00, 84, 8F ]
-# YAML: alignment: 2^2
-# YAML: references:
-# YAML: - kind: R_MIPS_GOT16
-# YAML: offset: 0
-# YAML: target: L003
-# YAML: - kind: R_MIPS_LO16
-# YAML: offset: 4
-# YAML: target: L004
-# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT16
-# YAML: offset: 8
-# YAML: target: L005
-# YAML: - kind: R_MIPS_CALL16
-# YAML: offset: 12
-# YAML: target: L006
-# YAML: - kind: R_MIPS_CALL16
-# YAML: offset: 16
-# YAML: target: L007
-# YAML: - kind: layout-before
-# YAML: offset: 0
-# YAML: target: L008
+# YAML: - ref-name: [[L002:[-a-zA-Z0-9_]+]]
+# YAML: type: got
+# YAML: content: [ 00, 00, 00, 00 ]
+# YAML: alignment: 2^2
+# YAML: section-choice: custom-required
+# YAML: section-name: .got
+# YAML: permissions: rw-
+# YAML: references:
+# YAML: - kind: R_MIPS_32
+# YAML: offset: 0
+# YAML: target: [[L003:[-a-zA-Z0-9_]+]]
+# YAML: - ref-name: [[L004:[-a-zA-Z0-9_]+]]
+# YAML: type: got
+# YAML: content: [ 00, 00, 00, 00 ]
+# YAML: alignment: 2^2
+# YAML: section-choice: custom-required
+# YAML: section-name: .got
+# YAML: permissions: rw-
+# YAML: references:
+# YAML: - kind: R_MIPS_32
+# YAML: offset: 0
+# YAML: target: hidden
+# YAML: - ref-name: [[L005:[-a-zA-Z0-9_]+]]
+# YAML: type: got
+# YAML: content: [ 00, 00, 00, 00 ]
+# YAML: alignment: 2^2
+# YAML: section-choice: custom-required
+# YAML: section-name: .got
+# YAML: permissions: rw-
+# YAML: references:
+# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT
+# YAML: offset: 0
+# YAML: target: glob
+# YAML: - kind: R_MIPS_32
+# YAML: offset: 0
+# YAML: target: glob
+# YAML: - ref-name: [[L006:[-a-zA-Z0-9_]+]]
+# YAML: type: got
+# YAML: content: [ 00, 00, 00, 00 ]
+# YAML: alignment: 2^2
+# YAML: section-choice: custom-required
+# YAML: section-name: .got
+# YAML: permissions: rw-
+# YAML: references:
+# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT
+# YAML: offset: 0
+# YAML: target: extern
+# YAML: - ref-name: [[L007:[-a-zA-Z0-9_]+]]
+# YAML: alignment: 2^2
+# YAML: references:
+# YAML: - kind: layout-after
+# YAML: offset: 0
+# YAML: target: glob
+# YAML: - name: glob
+# YAML: scope: global
+# YAML: content: [ 00, 00, 84, 8F, 00, 00, 84, 24, 00, 00, 84, 8F,
+# YAML: 00, 00, 84, 8F, 00, 00, 84, 8F ]
+# YAML: alignment: 2^2
+# YAML: references:
+# YAML: - kind: R_MIPS_LO16
+# YAML: offset: 4
+# YAML: target: [[L003]]
+# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT16
+# YAML: offset: 8
+# YAML: target: [[L004]]
+# YAML: - kind: R_MIPS_CALL16
+# YAML: offset: 12
+# YAML: target: [[L005]]
+# YAML: - kind: R_MIPS_CALL16
+# YAML: offset: 16
+# YAML: target: [[L006]]
# RAW: Disassembly of section .text:
# RAW: glob:
Modified: lld/trunk/test/elf/X86_64/multi-weak-layout.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/multi-weak-layout.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/multi-weak-layout.test (original)
+++ lld/trunk/test/elf/X86_64/multi-weak-layout.test Sun Feb 2 22:01:14 2014
@@ -5,42 +5,48 @@ RUN: lld -flavor gnu -target x86_64 %p/I
RUN: --noinhibit-exec -static --output-filetype=yaml -o %t
RUN: FileCheck %s -check-prefix=WEAKSYMS < %t
-WEAKSYMS: - ref-name: [[SYMA:[-a-zA-Z0-9_]+]]
-WEAKSYMS: type: data
+WEAKSYMS: - type: data
+WEAKSYMS: alignment: 2^3
WEAKSYMS: references:
WEAKSYMS: - kind: layout-after
-WEAKSYMS: target: [[SYMB:[-a-zA-Z0-9_]+]]
+WEAKSYMS: offset: 0
+WEAKSYMS: target: [[L001:[-a-zA-Z0-9_]+]]
WEAKSYMS: - name: myfn2
WEAKSYMS: scope: global
WEAKSYMS: type: data
WEAKSYMS: merge: as-weak
+WEAKSYMS: alignment: 2^3
WEAKSYMS: references:
WEAKSYMS: - kind: layout-after
-WEAKSYMS: target: [[SYMB]]
-WEAKSYMS: - ref-name: [[SYMB]]
+WEAKSYMS: offset: 0
+WEAKSYMS: target: [[L001]]
+WEAKSYMS: - ref-name: [[L001]]
WEAKSYMS: scope: global
WEAKSYMS: type: data
WEAKSYMS: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
+WEAKSYMS: alignment: 2^3
WEAKSYMS: references:
WEAKSYMS: - kind: R_X86_64_64
+WEAKSYMS: offset: 0
WEAKSYMS: target: test
-WEAKSYMS: - kind: layout-before
-WEAKSYMS: target: [[SYMA]]
WEAKSYMS: - kind: layout-after
-WEAKSYMS: target: [[SYMC:[-a-zA-Z0-9_]+]]
+WEAKSYMS: offset: 0
+WEAKSYMS: target: [[L003:[-a-zA-Z0-9_]+]]
WEAKSYMS: - name: myfn1
WEAKSYMS: scope: global
WEAKSYMS: type: data
WEAKSYMS: merge: as-weak
+WEAKSYMS: alignment: 2^3
WEAKSYMS: references:
WEAKSYMS: - kind: layout-after
-WEAKSYMS: target: [[SYMC]]
-WEAKSYMS: - ref-name: [[SYMC]]
+WEAKSYMS: offset: 0
+WEAKSYMS: target: [[L003]]
+WEAKSYMS: - ref-name: [[L003]]
WEAKSYMS: scope: global
WEAKSYMS: type: data
WEAKSYMS: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
+WEAKSYMS: alignment: 2^3
WEAKSYMS: references:
WEAKSYMS: - kind: R_X86_64_64
+WEAKSYMS: offset: 0
WEAKSYMS: target: test
-WEAKSYMS: - kind: layout-before
-WEAKSYMS: target: [[SYMB]]
Modified: lld/trunk/test/elf/X86_64/weak-override.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/weak-override.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/weak-override.test (original)
+++ lld/trunk/test/elf/X86_64/weak-override.test Sun Feb 2 22:01:14 2014
@@ -22,9 +22,6 @@ WEAKATOMSORDER: scope: glob
WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00,
WEAKATOMSORDER: 00, 00, 5D, C3 ]
WEAKATOMSORDER: references:
-WEAKATOMSORDER: - kind: layout-before
-WEAKATOMSORDER: offset: 0
-WEAKATOMSORDER: target: fn
WEAKATOMSORDER: - kind: layout-after
WEAKATOMSORDER: offset: 0
WEAKATOMSORDER: target: main
@@ -37,9 +34,6 @@ WEAKATOMSORDER: - kind:
WEAKATOMSORDER: offset: 10
WEAKATOMSORDER: target: f
WEAKATOMSORDER: addend: -4
-WEAKATOMSORDER: - kind: layout-before
-WEAKATOMSORDER: offset: 0
-WEAKATOMSORDER: target: [[CONSTSTRA]]
WEAKATOMSORDER: - ref-name: {{[0-9A-Z]+}}
WEAKATOMSORDER: references:
WEAKATOMSORDER: - kind: layout-after
@@ -49,6 +43,3 @@ WEAKATOMSORDER: - name: f
WEAKATOMSORDER: scope: global
WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00,
WEAKATOMSORDER: 00, 00, 5D, C3 ]
-WEAKATOMSORDER: references:
-WEAKATOMSORDER: - kind: layout-before
-WEAKATOMSORDER: offset: 0
Modified: lld/trunk/test/elf/X86_64/weak-zero-sized.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/weak-zero-sized.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/X86_64/weak-zero-sized.test (original)
+++ lld/trunk/test/elf/X86_64/weak-zero-sized.test Sun Feb 2 22:01:14 2014
@@ -8,24 +8,19 @@ RUN: FileCheck -check-prefix=WEAKATOMSOR
WEAKORDER: 004001a4 T _start
-WEAKATOMSORDER: - ref-name: [[TARGETA:[-a-zA-Z0-9_]+]]
WEAKATOMSORDER: alignment: 2^2
WEAKATOMSORDER: - kind: layout-after
WEAKATOMSORDER: offset: 0
-WEAKATOMSORDER: target: [[TARGETB:[-a-zA-Z0-9_]+]]
-WEAKATOMSORDER: - name: _start
+WEAKATOMSORDER: target: [[TARGETC:[-a-zA-Z0-9_]+]]
+WEAKATOMSORDER: - name: [[TARGETA:[-a-zA-Z0-9_]+]]
WEAKATOMSORDER: scope: global
WEAKATOMSORDER: merge: as-weak
WEAKATOMSORDER: alignment: 2^2
WEAKATOMSORDER: references:
WEAKATOMSORDER: - kind: layout-after
WEAKATOMSORDER: offset: 0
-WEAKATOMSORDER: target: [[TARGETB]]
-WEAKATOMSORDER: - ref-name: [[TARGETB]]
+WEAKATOMSORDER: target: [[TARGETC]]
+WEAKATOMSORDER: - ref-name: [[TARGETC]]
WEAKATOMSORDER: scope: global
WEAKATOMSORDER: content: [ C3 ]
WEAKATOMSORDER: alignment: 2^2
-WEAKATOMSORDER: references:
-WEAKATOMSORDER: - kind: layout-before
-WEAKATOMSORDER: offset: 0
-WEAKATOMSORDER: target: [[TARGETA]]
Modified: lld/trunk/test/elf/ifunc.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ifunc.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/ifunc.test (original)
+++ lld/trunk/test/elf/ifunc.test Sun Feb 2 22:01:14 2014
@@ -30,8 +30,6 @@ PLT: scope: global
PLT: references:
PLT: kind: R_X86_64_PC32
PLT: target: [[PLTNAME:[-a-zA-Z0-9_]+]]
-PLT: kind: layout-before
-PLT: target: __hey_1
PLT: name: main
PLT: scope: global
Modified: lld/trunk/test/elf/mergeconstants.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/mergeconstants.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/mergeconstants.test (original)
+++ lld/trunk/test/elf/mergeconstants.test Sun Feb 2 22:01:14 2014
@@ -18,6 +18,3 @@ mergeAtoms: references:
mergeAtoms: - kind: R_X86_64_64
mergeAtoms: offset: 3
mergeAtoms: target: [[CONSTANT]]
-mergeAtoms: - kind: layout-before
-mergeAtoms: offset: 0
-mergeAtoms: target: bar
Modified: lld/trunk/test/elf/reloc.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/reloc.test?rev=200675&r1=200674&r2=200675&view=diff
==============================================================================
--- lld/trunk/test/elf/reloc.test (original)
+++ lld/trunk/test/elf/reloc.test Sun Feb 2 22:01:14 2014
@@ -30,9 +30,6 @@ ELF-i386: - kind: R_386
ELF-i386: offset: 17
ELF-i386: target: puts
ELF-i386: addend: 252
-ELF-i386: - kind: layout-before
-ELF-i386: offset: 0
-ELF-i386: target: [[STRNAMEB]]
ELF-i386: undefined-atoms:
ELF-i386: - name: puts
ELF-i386: absolute-atoms:
More information about the llvm-commits
mailing list