summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-01-27 22:55:29 +0000
committerRui Ueyama <ruiu@google.com>2015-01-27 22:55:29 +0000
commitdd88e86b5752452c1257ae879ab19ac1351a46a7 (patch)
tree6695e9b03df4d67f35ee6fadf059153e9f8188b2
parente745728fada85268fae8db15879d63eba1851ceb (diff)
downloadbcm5719-llvm-dd88e86b5752452c1257ae879ab19ac1351a46a7.tar.gz
bcm5719-llvm-dd88e86b5752452c1257ae879ab19ac1351a46a7.zip
Remove kindInGroup reference.
That kind of reference was used only in ELFFile, and the use of that reference there didn't seem to make sense. All test still pass (after adjusting symbol names) without that code. LLD is still be able to link LLD and Clang. Looks like we just don't need this. http://reviews.llvm.org/D7189 llvm-svn: 227259
-rw-r--r--lld/include/lld/Core/Reference.h9
-rw-r--r--lld/include/lld/Passes/LayoutPass.h4
-rw-r--r--lld/lib/Core/Reader.cpp1
-rw-r--r--lld/lib/Passes/LayoutPass.cpp71
-rw-r--r--lld/lib/ReaderWriter/ELF/ELFFile.h9
-rw-r--r--lld/test/core/ingroup-test-big.objtxt57
-rw-r--r--lld/test/core/ingroup-test-loop.objtxt20
-rw-r--r--lld/test/core/ingroup-test-with-layout-after.objtxt50
-rw-r--r--lld/test/core/ingroup-test.objtxt38
-rw-r--r--lld/test/elf/Mips/ctors-order.test9
-rw-r--r--lld/test/elf/Mips/dynlib-dynsym-micro.test2
-rw-r--r--lld/test/elf/Mips/dynlib-dynsym.test2
-rw-r--r--lld/test/elf/Mips/got16-micro.test20
13 files changed, 18 insertions, 274 deletions
diff --git a/lld/include/lld/Core/Reference.h b/lld/include/lld/Core/Reference.h
index cbe574445e1..181d4583cb3 100644
--- a/lld/include/lld/Core/Reference.h
+++ b/lld/include/lld/Core/Reference.h
@@ -82,16 +82,15 @@ public:
/// KindValues used with KindNamespace::all and KindArch::all.
enum {
- kindInGroup = 1,
// kindLayoutAfter is treated as a bidirected edge by the dead-stripping
// pass.
- kindLayoutAfter = 2,
+ kindLayoutAfter = 1,
// kindLayoutBefore is currently used only by PECOFF port, and will
// be removed soon. To enforce layout, use kindLayoutAfter instead.
- kindLayoutBefore = 3,
+ kindLayoutBefore,
// kindGroupChild is treated as a bidirected edge too.
- kindGroupChild = 4,
- kindAssociate = 5,
+ kindGroupChild,
+ kindAssociate,
};
// A value to be added to the value of a target
diff --git a/lld/include/lld/Passes/LayoutPass.h b/lld/include/lld/Passes/LayoutPass.h
index 9d28c062d51..9275d6f517d 100644
--- a/lld/include/lld/Passes/LayoutPass.h
+++ b/lld/include/lld/Passes/LayoutPass.h
@@ -52,10 +52,6 @@ private:
// reference type
void buildFollowOnTable(MutableFile::DefinedAtomRange &range);
- // Build the followOn atoms chain as specified by the kindInGroup
- // reference type
- void buildInGroupTable(MutableFile::DefinedAtomRange &range);
-
// Build a map of Atoms to ordinals for sorting the atoms
void buildOrdinalOverrideMap(MutableFile::DefinedAtomRange &range);
diff --git a/lld/lib/Core/Reader.cpp b/lld/lib/Core/Reader.cpp
index 6027c14ebfe..96a0c450391 100644
--- a/lld/lib/Core/Reader.cpp
+++ b/lld/lib/Core/Reader.cpp
@@ -52,7 +52,6 @@ Registry::loadFile(std::unique_ptr<MemoryBuffer> mb,
}
static const Registry::KindStrings kindStrings[] = {
- {Reference::kindInGroup, "in-group"},
{Reference::kindLayoutAfter, "layout-after"},
{Reference::kindLayoutBefore, "layout-before"},
{Reference::kindGroupChild, "group-child"},
diff --git a/lld/lib/Passes/LayoutPass.cpp b/lld/lib/Passes/LayoutPass.cpp
index 1ac4ee0b5dd..89fd1350af1 100644
--- a/lld/lib/Passes/LayoutPass.cpp
+++ b/lld/lib/Passes/LayoutPass.cpp
@@ -400,74 +400,6 @@ void LayoutPass::buildFollowOnTable(MutableFile::DefinedAtomRange &range) {
}
}
-/// This pass builds the followon tables using InGroup relationships
-/// The algorithm follows a very simple approach
-/// a) If the rootAtom is not part of any root, create a new root with the
-/// as the head
-/// b) If the current Atom root is not found, then make the current atoms root
-/// point to the rootAtom
-/// c) If the root of the current Atom is itself a root of some other tree
-/// make all the atoms in the chain point to the ingroup reference
-/// d) Check to see if the current atom is part of the chain from the rootAtom
-/// if not add the atom to the chain, so that the current atom is part of the
-/// the chain where the rootAtom is in
-void LayoutPass::buildInGroupTable(MutableFile::DefinedAtomRange &range) {
- ScopedTask task(getDefaultDomain(), "LayoutPass::buildInGroupTable");
- // This table would convert precededby references to follow on
- // references so that we have only one table
- for (const DefinedAtom *ai : range) {
- for (const Reference *r : *ai) {
- if (r->kindNamespace() != lld::Reference::KindNamespace::all ||
- r->kindValue() != lld::Reference::kindInGroup)
- continue;
- const DefinedAtom *rootAtom = dyn_cast<DefinedAtom>(r->target());
- // If the root atom is not part of any root
- // create a new root
- if (_followOnRoots.count(rootAtom) == 0) {
- _followOnRoots[rootAtom] = rootAtom;
- }
- // If the current Atom has not been seen yet and there is no root
- // that has been set, set the root of the atom to the targetAtom
- // as the targetAtom points to the ingroup root
- auto iter = _followOnRoots.find(ai);
- if (iter == _followOnRoots.end()) {
- _followOnRoots[ai] = rootAtom;
- } else if (iter->second == ai) {
- if (iter->second != rootAtom)
- setChainRoot(iter->second, rootAtom);
- } else {
- // TODO : Flag an error that the root of the tree
- // is different, Here is an example
- // Say there are atoms
- // chain 1 : a->b->c
- // chain 2 : d->e->f
- // and e,f have their ingroup reference as a
- // this could happen only if the root of e,f that is d
- // has root as 'a'
- continue;
- }
-
- // Check if the current atom is part of the chain
- bool isAtomInChain = false;
- const DefinedAtom *lastAtom = rootAtom;
- for (;;) {
- AtomToAtomT::iterator followOnAtomsIter =
- _followOnNexts.find(lastAtom);
- if (followOnAtomsIter != _followOnNexts.end()) {
- lastAtom = followOnAtomsIter->second;
- if (lastAtom != ai)
- continue;
- isAtomInChain = true;
- }
- break;
- }
-
- if (!isAtomInChain)
- _followOnNexts[lastAtom] = ai;
- }
- }
-}
-
/// Build an ordinal override map by traversing the followon chain, and
/// assigning ordinals to each atom, if the atoms have their ordinals
/// already assigned skip the atom and move to the next. This is the
@@ -520,9 +452,6 @@ void LayoutPass::perform(std::unique_ptr<MutableFile> &mergedFile) {
// Build follow on tables
buildFollowOnTable(atomRange);
- // Build Ingroup reference table
- buildInGroupTable(atomRange);
-
// Check the structure of followon graph if running in debug mode.
DEBUG(checkFollowonChain(atomRange));
diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.h b/lld/lib/ReaderWriter/ELF/ELFFile.h
index 6be5fca9514..bddb56fb25f 100644
--- a/lld/lib/ReaderWriter/ELF/ELFFile.h
+++ b/lld/lib/ReaderWriter/ELF/ELFFile.h
@@ -632,7 +632,6 @@ template <class ELFT> std::error_code ELFFile<ELFT>::createAtoms() {
}
ELFDefinedAtom<ELFT> *previousAtom = nullptr;
- ELFDefinedAtom<ELFT> *inGroupAtom = nullptr;
ELFReference<ELFT> *anonFollowedBy = nullptr;
for (auto si = symbols.begin(), se = symbols.end(); si != se; ++si) {
@@ -717,20 +716,12 @@ template <class ELFT> std::error_code ELFFile<ELFT>::createAtoms() {
// Set the followon atom to the weak atom that we have created, so
// that they would alias when the file gets written.
followOn->setTarget(anonAtom ? anonAtom : newAtom);
-
- // Add a preceded-by reference only if the current atom is not a weak
- // atom.
- if (symbol->getBinding() != llvm::ELF::STB_WEAK)
- 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) {
diff --git a/lld/test/core/ingroup-test-big.objtxt b/lld/test/core/ingroup-test-big.objtxt
deleted file mode 100644
index f666328bb4c..00000000000
--- a/lld/test/core/ingroup-test-big.objtxt
+++ /dev/null
@@ -1,57 +0,0 @@
-# RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER
-
----
-defined-atoms:
- - name: A
- scope: global
- references:
- - kind: layout-after
- offset: 0
- target: B
- - name: B
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
- - kind: layout-after
- offset: 0
- target: C
- - name: C
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
- - name: E
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: E
- - kind: layout-after
- offset: 0
- target: F
- - name: F
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: E
- - name: D
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
- - kind: layout-after
- offset: 0
- target: E
-...
-
-# CHKORDER: - name: A
-# CHKORDER: - name: B
-# CHKORDER: - name: C
-# CHKORDER: - name: D
-# CHKORDER: - name: E
-# CHKORDER: - name: F
diff --git a/lld/test/core/ingroup-test-loop.objtxt b/lld/test/core/ingroup-test-loop.objtxt
deleted file mode 100644
index b22dcb8b589..00000000000
--- a/lld/test/core/ingroup-test-loop.objtxt
+++ /dev/null
@@ -1,20 +0,0 @@
-# RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER
-
----
-defined-atoms:
- - name: A
- scope: global
- references:
- - kind: layout-after
- offset: 0
- target: E
- - name: E
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
-...
-
-# CHKORDER: - name: A
-# CHKORDER: - name: E
diff --git a/lld/test/core/ingroup-test-with-layout-after.objtxt b/lld/test/core/ingroup-test-with-layout-after.objtxt
deleted file mode 100644
index d93e194446d..00000000000
--- a/lld/test/core/ingroup-test-with-layout-after.objtxt
+++ /dev/null
@@ -1,50 +0,0 @@
-# RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER
-
----
-defined-atoms:
- - name: A
- scope: global
- references:
- - kind: layout-after
- offset: 0
- target: B
- - name: B
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
- - kind: layout-after
- offset: 0
- target: E
- - name: F
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: E
- - kind: layout-after
- offset: 0
- target: G
- - name: G
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: E
- - name: E
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
- - kind: layout-after
- offset: 0
- target: F
-...
-
-# CHKORDER: - name: A
-# CHKORDER: - name: B
-# CHKORDER: - name: E
-# CHKORDER: - name: F
-# CHKORDER: - name: G
diff --git a/lld/test/core/ingroup-test.objtxt b/lld/test/core/ingroup-test.objtxt
deleted file mode 100644
index b5eeebe73c7..00000000000
--- a/lld/test/core/ingroup-test.objtxt
+++ /dev/null
@@ -1,38 +0,0 @@
-# RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER
-
----
-defined-atoms:
- - name: A
- scope: global
-
- - name: B
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
- - name: F
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: E
- - name: G
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: E
- - name: E
- scope: global
- references:
- - kind: in-group
- offset: 0
- target: A
-...
-
-# CHKORDER: - name: A
-# CHKORDER: - name: B
-# CHKORDER: - name: E
-# CHKORDER: - name: F
-# CHKORDER: - name: G
diff --git a/lld/test/elf/Mips/ctors-order.test b/lld/test/elf/Mips/ctors-order.test
index b8bf0126f69..9c2d0d12d1e 100644
--- a/lld/test/elf/Mips/ctors-order.test
+++ b/lld/test/elf/Mips/ctors-order.test
@@ -10,8 +10,7 @@
# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=RAW %s
# CHECK: defined-atoms:
-# CHECK-NEXT: - ref-name: L000
-# CHECK-NEXT: type: data
+# CHECK-NEXT: - type: data
# CHECK-NEXT: alignment: 2^2
# CHECK-NEXT: section-choice: custom-required
# CHECK-NEXT: section-name: .ctors
@@ -25,10 +24,6 @@
# CHECK-NEXT: alignment: 2^2
# CHECK-NEXT: section-choice: custom-required
# CHECK-NEXT: section-name: .ctors
-# CHECK-NEXT: references:
-# CHECK-NEXT: - kind: in-group
-# CHECK-NEXT: offset: 0
-# CHECK-NEXT: target: L000
# CHECK-NEXT: - type: data
# CHECK-NEXT: content: [ 11, 11, 11, 11 ]
# CHECK-NEXT: alignment: 2^2
@@ -39,7 +34,7 @@
# CHECK-NEXT: alignment: 2^2
# CHECK-NEXT: section-choice: custom-required
# CHECK-NEXT: section-name: .ctors.2
-# CHECK-NEXT: - ref-name: L005
+# CHECK-NEXT: - ref-name: L003
# CHECK-NEXT: type: data
# CHECK-NEXT: alignment: 2^2
# CHECK-NEXT: section-choice: custom-required
diff --git a/lld/test/elf/Mips/dynlib-dynsym-micro.test b/lld/test/elf/Mips/dynlib-dynsym-micro.test
index bcd4bcf340b..25b54b0bcab 100644
--- a/lld/test/elf/Mips/dynlib-dynsym-micro.test
+++ b/lld/test/elf/Mips/dynlib-dynsym-micro.test
@@ -122,7 +122,7 @@
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
# CHECK-GOT: offset: 0
# CHECK-GOT: target: ext1
-# CHECK-GOT: - ref-name: L009
+# CHECK-GOT: - ref-name: L008
# CHECK-GOT: type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
diff --git a/lld/test/elf/Mips/dynlib-dynsym.test b/lld/test/elf/Mips/dynlib-dynsym.test
index c29caa42950..8bef139ba34 100644
--- a/lld/test/elf/Mips/dynlib-dynsym.test
+++ b/lld/test/elf/Mips/dynlib-dynsym.test
@@ -118,7 +118,7 @@
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
# CHECK-GOT: offset: 0
# CHECK-GOT: target: ext1
-# CHECK-GOT: - ref-name: L009
+# CHECK-GOT: - ref-name: L008
# CHECK-GOT: type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
diff --git a/lld/test/elf/Mips/got16-micro.test b/lld/test/elf/Mips/got16-micro.test
index c2c48ab1efa..eb642ad05ef 100644
--- a/lld/test/elf/Mips/got16-micro.test
+++ b/lld/test/elf/Mips/got16-micro.test
@@ -11,7 +11,7 @@
# RUN: | FileCheck -check-prefix RAW %s
# Local GOT entries:
-# YAML: - ref-name: L002
+# YAML: - ref-name: L001
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
@@ -22,7 +22,7 @@
# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16
# YAML-NEXT: offset: 0
# YAML-NEXT: target: data_1
-# YAML-NEXT: - ref-name: L003
+# YAML-NEXT: - ref-name: L002
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
@@ -33,7 +33,7 @@
# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16
# YAML-NEXT: offset: 0
# YAML-NEXT: target: data_2
-# YAML-NEXT: - ref-name: L004
+# YAML-NEXT: - ref-name: L003
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
@@ -46,7 +46,7 @@
# YAML-NEXT: target: data_h
# Global GOT entries:
-# YAML-NEXT: - ref-name: L005
+# YAML-NEXT: - ref-name: L004
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
@@ -60,7 +60,7 @@
# YAML-NEXT: - kind: R_MIPS_32
# YAML-NEXT: offset: 0
# YAML-NEXT: target: bar
-# YAML-NEXT: - ref-name: L006
+# YAML-NEXT: - ref-name: L005
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
@@ -83,25 +83,25 @@
# YAML: references:
# YAML-NEXT: - kind: R_MICROMIPS_GOT16
# YAML-NEXT: offset: 0
-# YAML-NEXT: target: L002
+# YAML-NEXT: target: L001
# YAML-NEXT: - kind: R_MICROMIPS_LO16
# YAML-NEXT: offset: 4
# YAML-NEXT: target: data_1
# YAML-NEXT: - kind: R_MICROMIPS_GOT16
# YAML-NEXT: offset: 8
-# YAML-NEXT: target: L003
+# YAML-NEXT: target: L002
# YAML-NEXT: - kind: R_MICROMIPS_LO16
# YAML-NEXT: offset: 12
# YAML-NEXT: target: data_2
# YAML-NEXT: - kind: R_MICROMIPS_GOT16
# YAML-NEXT: offset: 16
-# YAML-NEXT: target: L004
+# YAML-NEXT: target: L003
# YAML-NEXT: - kind: R_MICROMIPS_CALL16
# YAML-NEXT: offset: 20
-# YAML-NEXT: target: L005
+# YAML-NEXT: target: L004
# YAML-NEXT: - kind: R_MICROMIPS_CALL16
# YAML-NEXT: offset: 24
-# YAML-NEXT: target: L006
+# YAML-NEXT: target: L005
# RAW: Disassembly of section .text:
# RAW: main:
OpenPOWER on IntegriCloud