[llvm-commits] [llvm] r114898 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp test/MC/ELF/basic-elf.ll test/MC/ELF/local-reloc.s test/MC/ELF/merge.s

Rafael Espindola rafael.espindola at gmail.com
Mon Sep 27 15:04:54 PDT 2010


Author: rafael
Date: Mon Sep 27 17:04:54 2010
New Revision: 114898

URL: http://llvm.org/viewvc/llvm-project?rev=114898&view=rev
Log:
Write relocations in the end of the file. This matches what gas does and
makes files easier to diff.

Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp
    llvm/trunk/test/MC/ELF/basic-elf.ll
    llvm/trunk/test/MC/ELF/local-reloc.s
    llvm/trunk/test/MC/ELF/merge.s

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=114898&r1=114897&r2=114898&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Sep 27 17:04:54 2010
@@ -839,8 +839,6 @@
   MCContext &Ctx = Asm.getContext();
   MCDataFragment *F;
 
-  WriteRelocations(Asm, Layout);
-
   const MCSection *SymtabSection;
   unsigned EntrySize = Is64Bit ? ELF::SYMENTRY_SIZE64 : ELF::SYMENTRY_SIZE32;
 
@@ -867,6 +865,7 @@
   StrtabSD.setAlignment(1);
   StringTableIndex = Asm.size();
 
+  WriteRelocations(Asm, Layout);
 
   // Symbol table
   F = new MCDataFragment(&SymtabSD);

Modified: llvm/trunk/test/MC/ELF/basic-elf.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/basic-elf.ll?rev=114898&r1=114897&r2=114898&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/basic-elf.ll (original)
+++ llvm/trunk/test/MC/ELF/basic-elf.ll Mon Sep 27 17:04:54 2010
@@ -20,6 +20,24 @@
 ; 32:   (('sh_name', 0) # ''
 
 ; 32:   # '.text'
+
+; 32: ('st_bind', 0)
+; 32: ('st_type', 3)
+
+; 32: ('st_bind', 0)
+; 32: ('st_type', 3)
+
+; 32: ('st_bind', 0)
+; 32: ('st_type', 3)
+
+; 32:   # 'main'
+; 32:   ('st_bind', 1)
+; 32-NEXT: ('st_type', 2)
+
+; 32:   # 'puts'
+; 32:   ('st_bind', 1)
+; 32-NEXT: ('st_type', 0)
+
 ; 32:   # '.rel.text'
 
 ; 32:   ('_relocations', [
@@ -41,24 +59,6 @@
 ; 32:     ),
 ; 32:   ])
 
-; 32: ('st_bind', 0)
-; 32: ('st_type', 3)
-
-; 32: ('st_bind', 0)
-; 32: ('st_type', 3)
-
-; 32: ('st_bind', 0)
-; 32: ('st_type', 3)
-
-; 32:   # 'main'
-; 32:   ('st_bind', 1)
-; 32-NEXT: ('st_type', 2)
-
-; 32:   # 'puts'
-; 32:   ('st_bind', 1)
-; 32-NEXT: ('st_type', 0)
-
-
 ; 64: ('e_indent[EI_CLASS]', 2)
 ; 64: ('e_indent[EI_DATA]', 1)
 ; 64: ('e_indent[EI_VERSION]', 1)
@@ -67,6 +67,24 @@
 ; 64:   (('sh_name', 0) # ''
 
 ; 64:   # '.text'
+
+; 64: ('st_bind', 0)
+; 64: ('st_type', 3)
+
+; 64: ('st_bind', 0)
+; 64: ('st_type', 3)
+
+; 64: ('st_bind', 0)
+; 64: ('st_type', 3)
+
+; 64:   # 'main'
+; 64-NEXT: ('st_bind', 1)
+; 64-NEXT: ('st_type', 2)
+
+; 64:   # 'puts'
+; 64-NEXT: ('st_bind', 1)
+; 64-NEXT: ('st_type', 0)
+
 ; 64:   # '.rela.text'
 
 ; 64:   ('_relocations', [
@@ -91,20 +109,3 @@
 ; 64:      ('r_addend', -4)
 ; 64:     ),
 ; 64:   ])
-
-; 64: ('st_bind', 0)
-; 64: ('st_type', 3)
-
-; 64: ('st_bind', 0)
-; 64: ('st_type', 3)
-
-; 64: ('st_bind', 0)
-; 64: ('st_type', 3)
-
-; 64:   # 'main'
-; 64-NEXT: ('st_bind', 1)
-; 64-NEXT: ('st_type', 2)
-
-; 64:   # 'puts'
-; 64-NEXT: ('st_bind', 1)
-; 64-NEXT: ('st_type', 0)

Modified: llvm/trunk/test/MC/ELF/local-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/local-reloc.s?rev=114898&r1=114897&r2=114898&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/local-reloc.s (original)
+++ llvm/trunk/test/MC/ELF/local-reloc.s Mon Sep 27 17:04:54 2010
@@ -10,6 +10,15 @@
 // CHECK:        # Section 1
 // CHECK-next:  (('sh_name', 1) # '.text'
 
+// Symbol number 2 is section number 1
+// CHECK:    # Symbol 2
+// CHECK-NEXT:    (('st_name', 0) # ''
+// CHECK-NEXT:     ('st_bind', 0)
+// CHECK-NEXT:     ('st_type', 3)
+// CHECK-NEXT:     ('st_other', 0)
+// CHECK-NEXT:     ('st_shndx', 1)
+// CHECK-NEXT:     ('st_value', 0)
+// CHECK-NEXT:     ('st_size', 0)
 
 // Relocation refers to symbol number 2
 // CHECK:      ('_relocations', [
@@ -20,13 +29,3 @@
 // CHECK-NEXT:    ('r_addend',
 // CHECK-NEXT:   ),
 // CHECK-NEXT:  ])
-
-// Symbol number 2 is section number 1
-// CHECK:    # Symbol 2
-// CHECK-NEXT:    (('st_name', 0) # ''
-// CHECK-NEXT:     ('st_bind', 0)
-// CHECK-NEXT:     ('st_type', 3)
-// CHECK-NEXT:     ('st_other', 0)
-// CHECK-NEXT:     ('st_shndx', 1)
-// CHECK-NEXT:     ('st_value', 0)
-// CHECK-NEXT:     ('st_size', 0)

Modified: llvm/trunk/test/MC/ELF/merge.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/merge.s?rev=114898&r1=114897&r2=114898&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/merge.s (original)
+++ llvm/trunk/test/MC/ELF/merge.s Mon Sep 27 17:04:54 2010
@@ -9,6 +9,11 @@
         .text
         movsd   .Lfoo(%rip), %xmm1
 
+// Symbol number 1 is .Lfoo
+
+// CHECK:      # Symbol 1
+// CHECK-NEXT: (('st_name', 1) # '.Lfoo'
+
 // Relocation refers to symbol 1
 
 // CHECK:       ('_relocations', [
@@ -19,8 +24,3 @@
 // CHECK-NEXT:    ('r_addend',
 // CHECK-NEXT:   ),
 // CHECK-NEXT:  ])
-
-// Symbol number 1 is .Lfoo
-
-// CHECK:      # Symbol 1
-// CHECK-NEXT: (('st_name', 1) # '.Lfoo'





More information about the llvm-commits mailing list