[lld] r221972 - [ELF] Dynamic section was not aligned properly.

Shankar Easwaran shankare at codeaurora.org
Thu Nov 13 20:57:22 PST 2014


Author: shankare
Date: Thu Nov 13 22:57:21 2014
New Revision: 221972

URL: http://llvm.org/viewvc/llvm-project?rev=221972&view=rev
Log:
[ELF] Dynamic section was not aligned properly.

The dynamic section was not aligned properly. The alignment of the section is
determined by the word size of the architecture.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
    lld/trunk/test/elf/Hexagon/dynlib-hash.test
    lld/trunk/test/elf/Hexagon/dynlib-syms.test
    lld/trunk/test/elf/Mips/exe-dynamic.test
    lld/trunk/test/elf/Mips/exe-fileheader.test
    lld/trunk/test/elf/Mips/gp-sym-1.test
    lld/trunk/test/elf/Mips/hilo16-1.test
    lld/trunk/test/elf/Mips/hilo16-2.test
    lld/trunk/test/elf/Mips/hilo16-3.test
    lld/trunk/test/elf/Mips/hilo16-4.test
    lld/trunk/test/elf/Mips/la25-stub.test
    lld/trunk/test/elf/Mips/plt-header.test
    lld/trunk/test/elf/Mips/r26-1.test
    lld/trunk/test/elf/Mips/r26-2.test
    lld/trunk/test/elf/Mips/rel-dynamic-03.test
    lld/trunk/test/elf/Mips/rel-dynamic-05.test
    lld/trunk/test/elf/Mips/rel-dynamic-07.test
    lld/trunk/test/elf/Mips/rel-dynamic-11.test
    lld/trunk/test/elf/Mips/tls-1.test
    lld/trunk/test/elf/ifunc.test
    lld/trunk/test/elf/phdr.test

Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Thu Nov 13 22:57:21 2014
@@ -41,7 +41,8 @@ public:
   Section(const ELFLinkingContext &context, StringRef name,
           typename Chunk<ELFT>::Kind k = Chunk<ELFT>::Kind::ELFSection)
       : Chunk<ELFT>(name, k, context), _parent(nullptr), _flags(0), _entSize(0),
-        _type(0), _link(0), _info(0), _segmentType(SHT_NULL) {}
+        _type(0), _link(0), _info(0), _isFirstSectionInMerge(false),
+        _segmentType(SHT_NULL) {}
 
   /// \brief Modify the section contents before assigning virtual addresses
   //  or assigning file offsets
@@ -94,13 +95,20 @@ public:
 
   virtual bool findAtomAddrByName(StringRef, uint64_t &) { return false; }
 
-  void setMergedSection(MergedSections<ELFT> *ms) { _parent = ms; }
+  void setMergedSection(MergedSections<ELFT> *ms, bool isFirst = false) {
+    _parent = ms;
+    _isFirstSectionInMerge = isFirst;
+  }
 
   static bool classof(const Chunk<ELFT> *c) {
     return c->kind() == Chunk<ELFT>::Kind::ELFSection ||
            c->kind() == Chunk<ELFT>::Kind::AtomSection;
   }
 
+  uint64_t align2() const override {
+    return _isFirstSectionInMerge ? _parent->align2() : this->_align2;
+  }
+
 protected:
   /// \brief MergedSections this Section is a member of, or nullptr.
   MergedSections<ELFT> *_parent;
@@ -114,6 +122,8 @@ protected:
   uint32_t _link;
   /// \brief the sh_info field.
   uint32_t _info;
+  /// \brief Is this the first section in the merged section list.
+  bool _isFirstSectionInMerge;
   /// \brief the output ELF segment type of this section.
   Layout::SegmentType _segmentType;
 };
@@ -503,7 +513,7 @@ MergedSections<ELFT>::appendSection(Chun
     _type = section->getType();
     if (_flags < section->getFlags())
       _flags = section->getFlags();
-    section->setMergedSection(this);
+    section->setMergedSection(this, (_sections.size() == 0));
   }
   _kind = c->kind();
   _sections.push_back(c);
@@ -1022,7 +1032,7 @@ public:
       : Section<ELFT>(context, str), _layout(layout) {
     this->setOrder(order);
     this->_entSize = sizeof(Elf_Dyn);
-    this->_align2 = llvm::alignOf<Elf_Dyn>();
+    this->_align2 = ELFT::Is64Bits ? 8 : 4;
     // Reserve space for the DT_NULL entry.
     this->_fsize = sizeof(Elf_Dyn);
     this->_msize = sizeof(Elf_Dyn);

Modified: lld/trunk/test/elf/Hexagon/dynlib-hash.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Hexagon/dynlib-hash.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Hexagon/dynlib-hash.test (original)
+++ lld/trunk/test/elf/Hexagon/dynlib-hash.test Thu Nov 13 22:57:21 2014
@@ -4,6 +4,6 @@ RUN: llvm-objdump -s %t > %t1
 RUN: FileCheck -check-prefix=CHECKHASH %s < %t1
 
 CHECKHASH: Contents of section .hash:
-CHECKHASH: 00a0 03000000 07000000 06000000 01000000  ................
-CHECKHASH: 00b0 04000000 00000000 00000000 00000000  ................
-CHECKHASH: 00c0 00000000 03000000 02000000 05000000  ................
+CHECKHASH: 0094 03000000 07000000 06000000 01000000
+CHECKHASH: 00a4 04000000 00000000 00000000 00000000
+CHECKHASH: 00b4 00000000 03000000 02000000 05000000

Modified: lld/trunk/test/elf/Hexagon/dynlib-syms.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Hexagon/dynlib-syms.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Hexagon/dynlib-syms.test (original)
+++ lld/trunk/test/elf/Hexagon/dynlib-syms.test Thu Nov 13 22:57:21 2014
@@ -3,5 +3,5 @@ RUN:   -o %t --noinhibit-exec -shared
 RUN: llvm-nm -n -M %t > %t1
 RUN: FileCheck -check-prefix=CHECKSYMS %s < %t1
 
-CHECKSYMS: 0000026c A _DYNAMIC
+CHECKSYMS: 0000025c A _DYNAMIC
 CHECKSYMS: 00001008 A _GLOBAL_OFFSET_TABLE_

Modified: lld/trunk/test/elf/Mips/exe-dynamic.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/exe-dynamic.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/exe-dynamic.test (original)
+++ lld/trunk/test/elf/Mips/exe-dynamic.test Thu Nov 13 22:57:21 2014
@@ -15,24 +15,24 @@
 # CHECK: LoadName:
 # CHECK: DynamicSection [ (18 entries)
 # CHECK:   Tag        Type                 Name/Value
-# CHECK-NEXT:   0x00000004 HASH                 0x400110
-# CHECK-NEXT:   0x00000005 STRTAB               0x400144
-# CHECK-NEXT:   0x00000006 SYMTAB               0x400124
-# CHECK-NEXT:   0x0000000A STRSZ                28 (bytes)
-# CHECK-NEXT:   0x0000000B SYMENT               16 (bytes)
-# CHECK-NEXT:   0x00000002 PLTRELSZ             8 (bytes)
-# CHECK-NEXT:   0x70000032 MIPS_PLTGOT          0x402000
-# CHECK-NEXT:   0x00000014 PLTREL               REL
-# CHECK-NEXT:   0x00000017 JMPREL               0x400160
-# CHECK-NEXT:   0x70000001 MIPS_RLD_VERSION     1
-# CHECK-NEXT:   0x70000005 MIPS_FLAGS           NOTPOT
-# CHECK-NEXT:   0x70000006 MIPS_BASE_ADDRESS    0x400000
-# CHECK-NEXT:   0x7000000A MIPS_LOCAL_GOTNO     2
-# CHECK-NEXT:   0x70000011 MIPS_SYMTABNO        2
-# CHECK-NEXT:   0x70000013 MIPS_GOTSYM          0x2
-# CHECK-NEXT:   0x00000003 PLTGOT               0x401000
-# CHECK-NEXT:   0x00000001 NEEDED               SharedLibrary (exe-dynamic.test.{{.*}})
-# CHECK-NEXT:   0x00000000 NULL                 0x0
+# CHECK-NEXT:  0x00000004 HASH                 0x400104
+# CHECK-NEXT:  0x00000005 STRTAB               0x400138
+# CHECK-NEXT:  0x00000006 SYMTAB               0x400118
+# CHECK-NEXT:  0x0000000A STRSZ                28 (bytes)
+# CHECK-NEXT:  0x0000000B SYMENT               16 (bytes)
+# CHECK-NEXT:  0x00000002 PLTRELSZ             8 (bytes)
+# CHECK-NEXT:  0x70000032 MIPS_PLTGOT          0x402000
+# CHECK-NEXT:  0x00000014 PLTREL               REL
+# CHECK-NEXT:  0x00000017 JMPREL               0x400154
+# CHECK-NEXT:  0x70000001 MIPS_RLD_VERSION     1
+# CHECK-NEXT:  0x70000005 MIPS_FLAGS           NOTPOT 
+# CHECK-NEXT:  0x70000006 MIPS_BASE_ADDRESS    0x400000
+# CHECK-NEXT:  0x7000000A MIPS_LOCAL_GOTNO     2
+# CHECK-NEXT:  0x70000011 MIPS_SYMTABNO        2
+# CHECK-NEXT:  0x70000013 MIPS_GOTSYM          0x2
+# CHECK-NEXT:  0x00000003 PLTGOT               0x401000
+# CHECK-NEXT:  0x00000001 NEEDED               SharedLibrary (exe-dynamic.test.tmp.so)
+# CHECK-NEXT:  0x00000000 NULL                 0x0
 # CHECK-NEXT: ]
 
 # so.o

Modified: lld/trunk/test/elf/Mips/exe-fileheader.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/exe-fileheader.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/exe-fileheader.test (original)
+++ lld/trunk/test/elf/Mips/exe-fileheader.test Thu Nov 13 22:57:21 2014
@@ -26,7 +26,7 @@
 # CHECK:   Type: Executable (0x2)
 # CHECK:   Machine: EM_MIPS (0x8)
 # CHECK:   Version: 1
-# CHECK:   Entry: 0x4001A0
+# CHECK:   Entry: 0x400190
 # CHECK:   ProgramHeaderOffset: 0x34
 # CHECK:   SectionHeaderOffset: 0x2280
 # CHECK:   Flags [ (0x70001005)

Modified: lld/trunk/test/elf/Mips/gp-sym-1.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/gp-sym-1.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/gp-sym-1.test (original)
+++ lld/trunk/test/elf/Mips/gp-sym-1.test Thu Nov 13 22:57:21 2014
@@ -11,9 +11,9 @@
 # SYM-NEXT: Value: 0x408FF0
 
 # SEC:      Contents of section .text:
-# SEC-NEXT:  4001a0 41000000 f08f0000 64001000  A.......d...
+# SEC-NEXT:  400190 41000000 f08f0000 60001000
 # SEC:      Contents of section .got:
-# SEC-NEXT:  401000 00000000 00000080           ........
+# SEC-NEXT:  401000 00000000 00000080        
 
 # so.o
 ---

Modified: lld/trunk/test/elf/Mips/hilo16-1.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/hilo16-1.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/hilo16-1.test (original)
+++ lld/trunk/test/elf/Mips/hilo16-1.test Thu Nov 13 22:57:21 2014
@@ -16,7 +16,7 @@
 # CHECK-NEXT: {{[0-9a-f]+}}: 3e 00 08 3c  lui     $8, 62
 # CHECK-NEXT: {{[0-9a-f]+}}: 40 02 08 3c  lui     $8, 576
 # CHECK-NEXT: {{[0-9a-f]+}}: 40 fe 08 3c  lui     $8, 65088
-# CHECK-NEXT: {{[0-9a-f]+}}: 65 01 08 85  lh      $8, 357($8)
+# CHECK-NEXT: {{[0-9a-f]+}}: 55 01 08 85  lh      $8, 341($8)
 
 # CHECK: SYMBOL TABLE:
 # CHECK: {{[0-9a-f]+}} g F .text  00000024 glob1

Modified: lld/trunk/test/elf/Mips/hilo16-2.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/hilo16-2.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/hilo16-2.test (original)
+++ lld/trunk/test/elf/Mips/hilo16-2.test Thu Nov 13 22:57:21 2014
@@ -12,22 +12,22 @@
 
 # CHECK: Disassembly of section .text:
 # CHECK: glob1:
-# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui  $8, 64
-# CHECK-NEXT: {{[0-9a-f]+}}:  81 01 08 85  lh   $8, 385($8)
-# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui  $8, 64
-# CHECK-NEXT: {{[0-9a-f]+}}:  7f 01 08 85  lh   $8, 383($8)
-# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui  $8, 64
-# CHECK-NEXT: {{[0-9a-f]+}}:  7f 03 08 85  lh   $8, 895($8)
-# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui  $8, 64
-# CHECK-NEXT: {{[0-9a-f]+}}:  81 ff 08 85  lh   $8, -127($8)
-# CHECK-NEXT: {{[0-9a-f]+}}:  42 00 08 3c  lui  $8, 66
-# CHECK-NEXT: {{[0-9a-f]+}}:  7f 01 08 85  lh   $8, 383($8)
-# CHECK-NEXT: {{[0-9a-f]+}}:  3e 00 08 3c  lui  $8, 62
-# CHECK-NEXT: {{[0-9a-f]+}}:  81 01 08 85  lh   $8, 385($8)
-# CHECK-NEXT: {{[0-9a-f]+}}:  40 02 08 3c  lui  $8, 576
-# CHECK-NEXT: {{[0-9a-f]+}}:  7f 01 08 85  lh   $8, 383($8)
-# CHECK-NEXT: {{[0-9a-f]+}}:  40 fe 08 3c  lui  $8, 65088
-# CHECK-NEXT: {{[0-9a-f]+}}:  81 01 08 85  lh   $8, 385($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui	$8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}:  71 01 08 85  lh	$8, 369($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui	$8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}:  6f 01 08 85  lh	$8, 367($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui	$8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}:  6f 03 08 85  lh	$8, 879($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  40 00 08 3c  lui	$8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}:  71 ff 08 85  lh	$8, -143($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  42 00 08 3c  lui	$8, 66
+# CHECK-NEXT: {{[0-9a-f]+}}:  6f 01 08 85  lh	$8, 367($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  3e 00 08 3c  lui	$8, 62
+# CHECK-NEXT: {{[0-9a-f]+}}:  71 01 08 85  lh	$8, 369($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  40 02 08 3c  lui	$8, 576
+# CHECK-NEXT: {{[0-9a-f]+}}:  6f 01 08 85  lh	$8, 367($8)
+# CHECK-NEXT: {{[0-9a-f]+}}:  40 fe 08 3c  lui	$8, 65088
+# CHECK-NEXT: {{[0-9a-f]+}}:  71 01 08 85  lh	$8, 369($8)
 
 # CHECK: SYMBOL TABLE:
 # CHECK: {{[0-9a-f]+}}  g F .text  00000040 glob1

Modified: lld/trunk/test/elf/Mips/hilo16-3.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/hilo16-3.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/hilo16-3.test (original)
+++ lld/trunk/test/elf/Mips/hilo16-3.test Thu Nov 13 22:57:21 2014
@@ -13,15 +13,15 @@
 # CHECK: Disassembly of section .text:
 # CHECK: glob1:
 # CHECK-NEXT: {{[0-9a-f]+}}: 01 00 08 3c  lui     $8, 1
-# CHECK-NEXT: {{[0-9a-f]+}}: f1 8e 08 85  lh      $8, -28943($8)
+# CHECK-NEXT: {{[0-9a-f]+}}: 01 8f 08 85  lh      $8, -28927($8)
 # CHECK-NEXT: {{[0-9a-f]+}}: 01 00 08 3c  lui     $8, 1
-# CHECK-NEXT: {{[0-9a-f]+}}: e7 8e 08 85  lh      $8, -28953($8)
+# CHECK-NEXT: {{[0-9a-f]+}}: f7 8e 08 85  lh      $8, -28937($8)
 # CHECK-NEXT: {{[0-9a-f]+}}: 01 00 08 3c  lui     $8, 1
-# CHECK-NEXT: {{[0-9a-f]+}}: df 90 08 85  lh      $8, -28449($8)
+# CHECK-NEXT: {{[0-9a-f]+}}: ef 90 08 85  lh      $8, -28433($8)
 # CHECK-NEXT: {{[0-9a-f]+}}: 01 00 08 3c  lui     $8, 1
-# CHECK-NEXT: {{[0-9a-f]+}}: d9 8c 08 85  lh      $8, -29479($8)
+# CHECK-NEXT: {{[0-9a-f]+}}: e9 8c 08 85  lh      $8, -29463($8)
 # CHECK-NEXT: {{[0-9a-f]+}}: 03 00 08 3c  lui     $8, 3
-# CHECK-NEXT: {{[0-9a-f]+}}: cf 8e 08 85  lh      $8, -28977($8)
+# CHECK-NEXT: {{[0-9a-f]+}}: df 8e 08 85  lh      $8, -28961($8)
 
 # CHECK: SYMBOL TABLE:
 # CHECK: {{[0-9a-f]+}}  g F  .text  00000028 glob1

Modified: lld/trunk/test/elf/Mips/hilo16-4.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/hilo16-4.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/hilo16-4.test (original)
+++ lld/trunk/test/elf/Mips/hilo16-4.test Thu Nov 13 22:57:21 2014
@@ -7,20 +7,20 @@
 
 # CHECK: Disassembly of section .text:
 # CHECK: glob1:
-# CHECK-NEXT:  400140:  40 00 04 3c  lui  $4, 64
-# CHECK-NEXT:  400144:  ff 9f a6 8c  lw   $6, -24577($5)
+# CHECK-NEXT:  400130:  40 00 04 3c  lui  $4, 64
+# CHECK-NEXT:  400134:  ff 9f a6 8c  lw   $6, -24577($5)
 
 # CHECK: glob2:
-# CHECK-NEXT:  400148:  00 20 c7 80  lb   $7, 8192($6)
-# CHECK-NEXT:  40014c:  04 20 c8 80  lb   $8, 8196($6)
+# CHECK-NEXT:  400138:  00 20 c7 80  lb   $7, 8192($6)
+# CHECK-NEXT:  40013c:  04 20 c8 80  lb   $8, 8196($6)
 
 # CHECK: glob3:
-# CHECK-NEXT:  400150:  40 80 05 3c  lui  $5, 32832
+# CHECK-NEXT:  400140:  40 80 05 3c  lui  $5, 32832
 
 # CHECK: SYMBOL TABLE:
-# CHECK: 00400140 g     F .text  00000008 glob1
-# CHECK: 00400148 g     F .text  00000008 glob2
-# CHECK: 00400150 g     F .text  00000004 glob3
+# CHECK: 00400130 g     F .text  00000008 glob1
+# CHECK: 00400138 g     F .text  00000008 glob2
+# CHECK: 00400140 g     F .text  00000004 glob3
 # CHECK: 00402000 g       .data  0000000c X
 
 !ELF

Modified: lld/trunk/test/elf/Mips/la25-stub.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/la25-stub.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/la25-stub.test (original)
+++ lld/trunk/test/elf/Mips/la25-stub.test Thu Nov 13 22:57:21 2014
@@ -11,25 +11,25 @@
 # RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=ASM %s
 
 # SYM:      Name: loc (13)
-# SYM-NEXT: Value: 0x400144
+# SYM-NEXT: Value: 0x400134
 # SYM:      Name: T1N (1)
-# SYM-NEXT: Value: 0x400120
+# SYM-NEXT: Value: 0x400110
 # SYM:      Name: T1 (5)
-# SYM-NEXT: Value: 0x400130
+# SYM-NEXT: Value: 0x400120
 # SYM:      Name: glob (8)
-# SYM-NEXT: Value: 0x400134
+# SYM-NEXT: Value: 0x400124
 
 # ASM:      Contents of section .text:
-# ASM-NEXT:  400120 00000000 00000000 00000000 00000000  ................
-# ASM-NEXT:  400130 00000000 00000000 00000000 4d001000  ............M...
-#           0x10004d << 2 == 0x400134 (glob) --^
-# ASM-NEXT:  400140 00000000 4d001000 00000000 48001000  ....M.......H...
-#                            ^-- 0x10004d << 2 == 0x400134 (glob)
-#               0x100048 << 2 == 0x400120 (T1N) --^
-# ASM-NEXT:  400150 00000000 58001000 00000000 00000000  ....X...........
-#                            ^-- 0x100058 << 2 == 0x400160 (T1 stub)
-# ASM-NEXT:  400160 4000193c 4c001008 30013927 00000000  @..<L...0.9'....
-#                            ^-- j 0x400130 (T1)
+# ASM-NEXT:  400110 00000000 00000000 00000000 00000000
+# ASM-NEXT:  400120 00000000 00000000 00000000 49001000
+#           0x100049 << 2 == 0x400124 (glob) --^
+# ASM-NEXT:  400130 00000000 49001000 00000000 44001000
+#                            ^-- 0x100049 << 2 == 0x400124 (glob)
+#               0x100044 << 2 == 0x400110 (T1N) --^
+# ASM-NEXT:  400140 00000000 54001000 00000000 00000000
+#                            ^-- 0x100054 << 2 == 0x400150 (T1 stub)
+# ASM-NEXT:  400150 4000193c 48001008 20013927 00000000
+#                            ^-- j 0x400120 (T1)
 
 # npic.o
 ---

Modified: lld/trunk/test/elf/Mips/plt-header.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/plt-header.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/plt-header.test (original)
+++ lld/trunk/test/elf/Mips/plt-header.test Thu Nov 13 22:57:21 2014
@@ -15,18 +15,18 @@
 # EXE: Disassembly of section .plt:
 # EXE: .plt:
 # PLT0 entry. Points to the .got.plt[0]
-# EXE-NEXT:   400170:  40 00 1c 3c  lui     $gp, 64
-# EXE-NEXT:   400174:  00 20 99 8f  lw      $25, 8192($gp)
-# EXE-NEXT:   400178:  00 20 9c 27  addiu   $gp, $gp, 8192
-# EXE-NEXT:   40017c:  23 c0 1c 03  subu    $24, $24, $gp
-# EXE-NEXT:   400180:  21 78 e0 03  move    $15, $ra
-# EXE-NEXT:   400184:  82 c0 18 00  srl     $24, $24, 2
-# EXE-NEXT:   400188:  09 f8 20 03  jalr    $25
-# EXE-NEXT:   40018c:  fe ff 18 27  addiu   $24, $24, -2
+# EXE-NEXT:   400160:  40 00 1c 3c  lui     $gp, 64
+# EXE-NEXT:   400164:  00 20 99 8f  lw      $25, 8192($gp)
+# EXE-NEXT:   400168:  00 20 9c 27  addiu   $gp, $gp, 8192
+# EXE-NEXT:   40016c:  23 c0 1c 03  subu    $24, $24, $gp
+# EXE-NEXT:   400170:  21 78 e0 03  move    $15, $ra
+# EXE-NEXT:   400174:  82 c0 18 00  srl     $24, $24, 2
+# EXE-NEXT:   400178:  09 f8 20 03  jalr    $25
+# EXE-NEXT:   40017c:  fe ff 18 27  addiu   $24, $24, -2
 
 # EXE: Sections:
 # EXE: Idx Name          Size      Address          Type
-# EXE:   6 .plt          00000030 0000000000400170 TEXT DATA
+# EXE:   6 .plt          00000030 0000000000400160 TEXT DATA
 # EXE:  10 .got.plt      0000000c 0000000000402000 DATA
 
 # so.o

Modified: lld/trunk/test/elf/Mips/r26-1.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/r26-1.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/r26-1.test (original)
+++ lld/trunk/test/elf/Mips/r26-1.test Thu Nov 13 22:57:21 2014
@@ -34,32 +34,32 @@
 # EXE: Disassembly of section .plt:
 # EXE: .plt:
 # PLTA entry. Points to the .got.plt[1]
-# EXE:        400190:  40 00 0f 3c  lui     $15, 64
-# EXE-NEXT:   400194:  08 20 f9 8d  lw      $25, 8200($15)
-# EXE-NEXT:   400198:  08 00 20 03  jr      $25
-# EXE-NEXT:   40019c:  08 20 f8 25  addiu   $24, $15, 8200
+# EXE:        400180:  40 00 0f 3c  lui     $15, 64
+# EXE-NEXT:   400184:  08 20 f9 8d  lw      $25, 8200($15)
+# EXE-NEXT:   400188:  08 00 20 03  jr      $25
+# EXE-NEXT:   40018c:  08 20 f8 25  addiu   $24, $15, 8200
 
 # EXE: Disassembly of section .text:
 # EXE: glob:
-# EXE-NEXT:   4001a0:  09 f8 20 03  jalr    $25
-# EXE-NEXT:   4001a4:  00 00 00 00  nop
+# EXE-NEXT:   400190:  09 f8 20 03  jalr    $25
+# EXE-NEXT:   400194:  00 00 00 00  nop
 #
 # Jump to 'loc' label address
-# EXE-NEXT:   4001a8:  6c 00 10 0c  jal     4194736
-# EXE-NEXT:   4001ac:  00 00 00 00  nop
+# EXE-NEXT:   400198:  68 00 10 0c  jal     4194720
+# EXE-NEXT:   40019c:  00 00 00 00  nop
 #
 # EXE: loc:
 # Jump to 'glob' label address
-# EXE-NEXT:   4001b0:  68 00 10 0c  jal     4194720
-# EXE-NEXT:   4001b4:  00 00 00 00  nop
+# EXE-NEXT:   4001a0:  64 00 10 0c  jal 4194704
+# EXE-NEXT:   4001a4:  00 00 00 00  nop
 #
 # Jump to the first PLT entry (.plt + 32) for T1 entry
-# EXE-NEXT:   4001b8:  64 00 10 0c  jal     4194704
-# EXE-NEXT:   4001bc:  00 00 00 00  nop
+# EXE-NEXT:   4001a8:  60 00 10 0c  jal 4194688
+# EXE-NEXT:   4001ac:  00 00 00 00  nop
 
 # EXE: Sections:
 # EXE: Idx Name          Size      Address          Type
-# EXE:   6 .plt          00000030 0000000000400170 TEXT DATA
+# EXE:   6 .plt          00000030 0000000000400160 TEXT DATA
 # EXE:  10 .got.plt      0000000c 0000000000402000 DATA
 
 # so.o

Modified: lld/trunk/test/elf/Mips/r26-2.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/r26-2.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/r26-2.test (original)
+++ lld/trunk/test/elf/Mips/r26-2.test Thu Nov 13 22:57:21 2014
@@ -7,25 +7,25 @@
 
 # CHECK: Disassembly of section .text:
 # CHECK-NEXT: __start:
-# CHECK-NEXT:   400120:  00 00 00 00  nop
-# CHECK-NEXT:   400124:  48 70 10 0c  jal  4309280
-#   0x107048 << 2 = 0x41C120 = _start  + (0x7000 << 2)
-# CHECK-NEXT:   400128:  00 00 00 00  nop
+# CHECK-NEXT:   400110:  00 00 00 00   nop
+# CHECK-NEXT:   400114:  44 70 10 0c  jal  4309264
+#   0x107044 << 2 = 0x41C110 = _start  + (0x7000 << 2)
+# CHECK-NEXT:   400118:  00 00 00 00  nop
 #
 # CHECK: loc:
-# CHECK-NEXT:   40012c:  4b 70 10 0c  jal  4309292
-#   0x10704B << 2 = 0x41C12C = loc  + (0x7000 << 2)
+# CHECK-NEXT:   40011c:  47 70 10 0c  jal  4309276
+#   0x107047 << 2 = 0x41C11C = loc  + (0x7000 << 2)
+# CHECK-NEXT:   400120:  00 00 00 00  nop
+# CHECK-NEXT:   400124:  43 00 10 0c  jal  4194572
+#   0x100043 << 2 = 0x40010C = _start - 4
+# CHECK-NEXT:   400128:  00 00 00 00  nop
+# CHECK-NEXT:   40012c:  46 00 10 0c  jal  4194584
+#   0x100046 << 2 = 0x400118 = loc - 4
 # CHECK-NEXT:   400130:  00 00 00 00  nop
-# CHECK-NEXT:   400134:  47 00 10 0c  jal  4194588
-#   0x100047 << 2 = 0x40011C = _start - 4
-# CHECK-NEXT:   400138:  00 00 00 00  nop
-# CHECK-NEXT:   40013c:  4a 00 10 0c  jal  4194600
-#   0x10004A << 2 = 0x400128 = loc - 4
-# CHECK-NEXT:   400140:  00 00 00 00  nop
 
 # CHECK: SYMBOL TABLE:
-# CHECK: 0040012c l  F .text  00000018 loc
-# CHECK: 00400120 g  F .text  0000000c __start
+# CHECK: 0040011c l  F .text  00000018 loc
+# CHECK: 00400110 g  F .text  0000000c __start
 
 !ELF
 FileHeader: !FileHeader

Modified: lld/trunk/test/elf/Mips/rel-dynamic-03.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-03.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-03.test (original)
+++ lld/trunk/test/elf/Mips/rel-dynamic-03.test Thu Nov 13 22:57:21 2014
@@ -20,19 +20,19 @@
 
 # PLT: Disassembly of section .plt:
 # PLT-NEXT: .plt:
-# PLT-NEXT:   400170:  40 00 1c 3c  lui     $gp, 64
-# PLT-NEXT:   400174:  00 20 99 8f  lw      $25, 8192($gp)
-# PLT-NEXT:   400178:  00 20 9c 27  addiu   $gp, $gp, 8192
-# PLT-NEXT:   40017c:  23 c0 1c 03  subu    $24, $24, $gp
-# PLT-NEXT:   400180:  21 78 e0 03  move    $15, $ra
-# PLT-NEXT:   400184:  82 c0 18 00  srl     $24, $24, 2
-# PLT-NEXT:   400188:  09 f8 20 03  jalr    $25
-# PLT-NEXT:   40018c:  fe ff 18 27  addiu   $24, $24, -2
+# PLT-NEXT:   400160:  40 00 1c 3c  lui     $gp, 64
+# PLT-NEXT:   400164:  00 20 99 8f  lw      $25, 8192($gp)
+# PLT-NEXT:   400168:  00 20 9c 27  addiu   $gp, $gp, 8192
+# PLT-NEXT:   40016c:  23 c0 1c 03  subu    $24, $24, $gp
+# PLT-NEXT:   400170:  21 78 e0 03  move    $15, $ra
+# PLT-NEXT:   400174:  82 c0 18 00  srl     $24, $24, 2
+# PLT-NEXT:   400178:  09 f8 20 03  jalr    $25
+# PLT-NEXT:   40017c:  fe ff 18 27  addiu   $24, $24, -2
 #
-# PLT-NEXT:   400190:  40 00 0f 3c  lui     $15, 64
-# PLT-NEXT:   400194:  08 20 f9 8d  lw      $25, 8200($15)
-# PLT-NEXT:   400198:  08 00 20 03  jr      $25
-# PLT-NEXT:   40019c:  08 20 f8 25  addiu   $24, $15, 8200
+# PLT-NEXT:   400180:  40 00 0f 3c  lui     $15, 64
+# PLT-NEXT:   400184:  08 20 f9 8d  lw      $25, 8200($15)
+# PLT-NEXT:   400188:  08 00 20 03  jr      $25
+# PLT-NEXT:   40018c:  08 20 f8 25  addiu   $24, $15, 8200
 #
 # PLT-SYM:      Relocations [
 # PLT-SYM-NEXT:   Section (5) .rel.plt {
@@ -41,7 +41,7 @@
 # PLT-SYM-NEXT: ]
 
 # PLT-SYM:      Name: T1@ (1)
-# PLT-SYM-NEXT: Value: 0x400190
+# PLT-SYM-NEXT: Value: 0x400180
 # PLT-SYM-NEXT: Size: 0
 # PLT-SYM-NEXT: Binding: Global (0x1)
 # PLT-SYM-NEXT: Type: Function (0x2)

Modified: lld/trunk/test/elf/Mips/rel-dynamic-05.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-05.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-05.test (original)
+++ lld/trunk/test/elf/Mips/rel-dynamic-05.test Thu Nov 13 22:57:21 2014
@@ -24,8 +24,8 @@
 # PLT-NEXT:    Flags [ (0x2)
 # PLT-NEXT:      SHF_ALLOC (0x2)
 # PLT-NEXT:    ]
-# PLT-NEXT:    Address: 0x40019C
-# PLT-NEXT:    Offset: 0x19C
+# PLT-NEXT:    Address: 0x400190
+# PLT-NEXT:    Offset: 0x190
 # PLT-NEXT:    Size: 24
 # PLT-NEXT:    Link: 3
 # PLT-NEXT:    Info: 0
@@ -40,8 +40,8 @@
 # PLT-NEXT:      SHF_ALLOC (0x2)
 # PLT-NEXT:      SHF_EXECINSTR (0x4)
 # PLT-NEXT:    ]
-# PLT-NEXT:    Address: 0x4001C0
-# PLT-NEXT:    Offset: 0x1C0
+# PLT-NEXT:    Address: 0x4001B0
+# PLT-NEXT:    Offset: 0x1B0
 # PLT-NEXT:    Size: 80
 # PLT-NEXT:    Link: 0
 # PLT-NEXT:    Info: 0
@@ -69,7 +69,7 @@
 # PLT-NEXT:   }
 # PLT-NEXT:   Symbol {
 # PLT-NEXT:     Name: T3@ (1)
-# PLT-NEXT:     Value: 0x400200
+# PLT-NEXT:     Value: 0x4001F0
 # PLT-NEXT:     Size: 0
 # PLT-NEXT:     Binding: Global (0x1)
 # PLT-NEXT:     Type: Function (0x2)
@@ -78,7 +78,7 @@
 # PLT-NEXT:   }
 # PLT-NEXT:   Symbol {
 # PLT-NEXT:     Name: T1@ (4)
-# PLT-NEXT:     Value: 0x4001E0
+# PLT-NEXT:     Value: 0x4001D0
 # PLT-NEXT:     Size: 0
 # PLT-NEXT:     Binding: Global (0x1)
 # PLT-NEXT:     Type: Function (0x2)
@@ -87,7 +87,7 @@
 # PLT-NEXT:   }
 # PLT-NEXT:   Symbol {
 # PLT-NEXT:     Name: T2@ (7)
-# PLT-NEXT:     Value: 0x4001F0
+# PLT-NEXT:     Value: 0x4001E0
 # PLT-NEXT:     Size: 0
 # PLT-NEXT:     Binding: Global (0x1)
 # PLT-NEXT:     Type: Function (0x2)

Modified: lld/trunk/test/elf/Mips/rel-dynamic-07.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-07.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-07.test (original)
+++ lld/trunk/test/elf/Mips/rel-dynamic-07.test Thu Nov 13 22:57:21 2014
@@ -42,7 +42,7 @@
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Symbol {
 # CHECK-NEXT:     Name: T0@ (1)
-# CHECK-NEXT:     Value: 0x224
+# CHECK-NEXT:     Value: 0x214
 # CHECK-NEXT:     Size: 8
 # CHECK-NEXT:     Binding: Global (0x1)
 # CHECK-NEXT:     Type: Function (0x2)

Modified: lld/trunk/test/elf/Mips/rel-dynamic-11.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-11.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-11.test (original)
+++ lld/trunk/test/elf/Mips/rel-dynamic-11.test Thu Nov 13 22:57:21 2014
@@ -18,7 +18,7 @@
 # PLT-SYM:      Relocations [
 # PLT-SYM-NEXT:   Section (4) .rel.dyn {
 # PLT-SYM-NEXT:     0x2000 R_MIPS_REL32 T1 0x0
-# PLT-SYM-NEXT:     0x160 R_MIPS_REL32 T1 0x0
+# PLT-SYM-NEXT:     0x150 R_MIPS_REL32 T1 0x0
 # PLT-SYM-NEXT:   }
 # PLT-SYM-NEXT: ]
 #

Modified: lld/trunk/test/elf/Mips/tls-1.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/tls-1.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/tls-1.test (original)
+++ lld/trunk/test/elf/Mips/tls-1.test Thu Nov 13 22:57:21 2014
@@ -5,7 +5,7 @@
 # RUN: llvm-objdump -s %t.exe | FileCheck %s
 
 # CHECK: Contents of section .text:
-# CHECK:  400160 00000000 01000000 03800000 04800000  ................
+# CHECK:  400150 00000000 01000000 03800000 04800000  ................
 
 !ELF
 FileHeader:

Modified: lld/trunk/test/elf/ifunc.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ifunc.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/ifunc.test (original)
+++ lld/trunk/test/elf/ifunc.test Thu Nov 13 22:57:21 2014
@@ -58,7 +58,7 @@ BIN-NEXT: {{[0-9a-f]+}} 00000000 0000000
 
 RELATIVEADDEND:      Relocations [
 RELATIVEADDEND-NEXT:   Section (1) .rela.plt {
-RELATIVEADDEND-NEXT:     0x401000 R_X86_64_IRELATIVE - 0x400120
+RELATIVEADDEND-NEXT:     0x401000 R_X86_64_IRELATIVE - 0x400110
 RELATIVEADDEND-NEXT:   }
 RELATIVEADDEND-NEXT: ]
 

Modified: lld/trunk/test/elf/phdr.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/phdr.test?rev=221972&r1=221971&r2=221972&view=diff
==============================================================================
--- lld/trunk/test/elf/phdr.test (original)
+++ lld/trunk/test/elf/phdr.test Thu Nov 13 22:57:21 2014
@@ -92,7 +92,7 @@ I386-NEXT:     MemSize: 48
 I386-NEXT:     Flags [ (0x4)
 I386-NEXT:       PF_R (0x4)
 I386-NEXT:     ]
-I386-NEXT:     Alignment: 2
+I386-NEXT:     Alignment: 4
 I386-NEXT:   }
 
 X86_64: LOAD off    0x0000000000000000





More information about the llvm-commits mailing list