[lld][Hexagon] Enable Hexagon sdata sorting test
authorShankar Easwaran <shankare@codeaurora.org>
Thu, 22 Aug 2013 03:02:17 +0000 (03:02 +0000)
committerShankar Easwaran <shankare@codeaurora.org>
Thu, 22 Aug 2013 03:02:17 +0000 (03:02 +0000)
llvm-svn: 188981

lld/lib/ReaderWriter/ELF/Hexagon/HexagonSectionChunks.h
lld/test/elf/hexagon-quickdata-sortcommon.test

index 0d103db..82755ac 100644 (file)
@@ -54,11 +54,18 @@ template <class HexagonELFType>
 void SDataSection<HexagonELFType>::doPreFlight() {
   // sort the atoms on the alignments they have been set
   std::stable_sort(this->_atoms.begin(), this->_atoms.end(),
-                   [](const lld::AtomLayout * A, const lld::AtomLayout * B) {
+                                             [](const lld::AtomLayout * A,
+                                                const lld::AtomLayout * B) {
     const DefinedAtom *definedAtomA = cast<DefinedAtom>(A->_atom);
     const DefinedAtom *definedAtomB = cast<DefinedAtom>(B->_atom);
     int64_t align2A = 1 << definedAtomA->alignment().powerOf2;
     int64_t align2B = 1 << definedAtomB->alignment().powerOf2;
+    if (align2A == align2B) {
+      if (definedAtomA->merge() == DefinedAtom::mergeAsTentative)
+        return false;
+      if (definedAtomB->merge() == DefinedAtom::mergeAsTentative)
+        return true;
+    }
     return align2A < align2B;
   });
 
index 4c2d4a9..f7b2d06 100644 (file)
@@ -1,7 +1,6 @@
 RUN: lld -flavor gnu -target hexagon -o %t1 --noinhibit-exec \
 RUN:     %p/Inputs/quickdata-sortcommon-test.o.elf-hexagon 
 RUN: llvm-nm -n %t1 | FileCheck %s -check-prefix=quickdataSortCommon
-XFAIL: *
 
 quickdataSortCommon: 00002000 D A1
 quickdataSortCommon: 00002001 D AA1