[lld] r205077 - Check in binaries to avoid dependency on broken llvm-mc behavior.

Rafael Espindola rafael.espindola at gmail.com
Fri Mar 28 23:26:51 PDT 2014


Author: rafael
Date: Sat Mar 29 01:26:51 2014
New Revision: 205077

URL: http://llvm.org/viewvc/llvm-project?rev=205077&view=rev
Log:
Check in binaries to avoid dependency on broken llvm-mc behavior.

On these tests llvm-mc will convert got relocations with a symbol to section
relocations. This is invalid, since the relocation doesn't reference the symbol
itself, so its offset in a section in irrelevant.

Given the object files, these are still valid lld tests, so just run the
tests directly on the binaries.

Found by running check-lld after fixing the relocation handling in llvm-mc.

Added:
    lld/trunk/test/elf/Mips/Inputs/dynlib-dynsym.o
    lld/trunk/test/elf/Mips/Inputs/got16.o
Modified:
    lld/trunk/test/elf/Mips/dynlib-dynsym.test
    lld/trunk/test/elf/Mips/got16.test

Added: lld/trunk/test/elf/Mips/Inputs/dynlib-dynsym.o
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/Inputs/dynlib-dynsym.o?rev=205077&view=auto
==============================================================================
Binary files lld/trunk/test/elf/Mips/Inputs/dynlib-dynsym.o (added) and lld/trunk/test/elf/Mips/Inputs/dynlib-dynsym.o Sat Mar 29 01:26:51 2014 differ

Added: lld/trunk/test/elf/Mips/Inputs/got16.o
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/Inputs/got16.o?rev=205077&view=auto
==============================================================================
Binary files lld/trunk/test/elf/Mips/Inputs/got16.o (added) and lld/trunk/test/elf/Mips/Inputs/got16.o Sat Mar 29 01:26:51 2014 differ

Modified: lld/trunk/test/elf/Mips/dynlib-dynsym.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/dynlib-dynsym.test?rev=205077&r1=205076&r2=205077&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/dynlib-dynsym.test (original)
+++ lld/trunk/test/elf/Mips/dynlib-dynsym.test Sat Mar 29 01:26:51 2014
@@ -1,14 +1,13 @@
 # Check sorting of .dynsym content accordingly to .got section.
 
 # Build shared library
-# RUN: llvm-mc -triple=mipsel -filetype=obj -relocation-model=pic -o=%t-obj %s
-# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t-so %t-obj
+# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t-so \
+# RUN: %S/Inputs/dynlib-dynsym.o
 # RUN: llvm-readobj -dyn-symbols %t-so | FileCheck -check-prefix=CHECK-DYN %s
 
 # Build shared library (yaml format)
-# RUN: llvm-mc -triple=mipsel -filetype=obj -relocation-model=pic -o=%t-obj %s
 # RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
-# RUN:     --output-filetype=yaml -o %t-yaml %t-obj
+# RUN:     --output-filetype=yaml -o %t-yaml %S/Inputs/dynlib-dynsym.o
 # RUN: FileCheck -check-prefix=CHECK-GOT %s < %t-yaml
 
 # CHECK-DYN: Format: ELF32-mips
@@ -130,29 +129,3 @@
 # CHECK-GOT:       - kind:            LLD_R_MIPS_GLOBAL_GOT
 # CHECK-GOT:         offset:          0
 # CHECK-GOT:         target:          ext2
-
-    .abicalls
-    .global foo
-    .ent    foo
-foo:
-    lw      $gp, %got($.str1)($t0)
-    addiu   $4, $gp, %lo($.str1)
-    lw      $4, %got($.str2)($t0)
-    addiu   $4, $4, %lo($.str2)
-    lw      $25, %call16(foo)($t0)
-    lw      $25, %call16(ext1)($t0)
-    .end    foo
-
-    .global bar
-    .ent    bar
-bar:
-    lw      $25, %call16(ext2)($t0)
-    .end    bar
-
-    .section  .rodata.str1
-$.str1:
-    .asciz  "str1"
-
-    .section  .rodata.str2
-$.str2:
-    .asciz  "str2"

Modified: lld/trunk/test/elf/Mips/got16.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/got16.test?rev=205077&r1=205076&r2=205077&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/got16.test (original)
+++ lld/trunk/test/elf/Mips/got16.test Sat Mar 29 01:26:51 2014
@@ -1,8 +1,7 @@
 # Check handling of global/local GOT16 relocations.
-# RUN: llvm-mc -triple=mipsel -filetype=obj -o=%t1 %s
 # RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
-# RUN:     --output-filetype=yaml %t1 | FileCheck -check-prefix YAML %s
-
+# RUN:     --output-filetype=yaml %S/Inputs/got16.o \
+# RUN:     | FileCheck -check-prefix YAML %s
 # RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t2 %t1
 # RUN: llvm-objdump -t -disassemble %t2 | FileCheck -check-prefix RAW %s
 
@@ -117,34 +116,3 @@
 # RAW: 00012200 l     .data  00000005 str2
 # RAW: 0000012c g   F .text  0000001c glob
 # RAW: 00012205 g     .data  00000004 hidden
-
-    .global glob
-    .ent    glob
-glob:
-    lw      $4,%got(str1)($28)       # G(str1)
-    addiu   $4,$4,%lo(str1)          # str1
-    lw      $4,%got(str2)($28)       # G(str2)
-    addiu   $4,$4,%lo(str2)          # str2
-    lw      $4,%got(hidden)($28)     # G(hidden)
-    lw      $4,%call16(glob)($28)    # G(glob)
-    lw      $4,%call16(extern)($28)  # G(extern)
-    .end    glob
-
-    .data
-    .type   str1, %object
-    .size   str1, 0x10200
-str1:
-    .ascii  "str1\000"
-    .space  0x101fb
-
-    .type str2, @object
-    .size str2, 5
-str2:
-    .ascii  "str2\000"
-
-    .globl  hidden
-    .hidden hidden
-    .type   hidden,%object
-    .size   hidden,4
-hidden:
-    .word   0





More information about the llvm-commits mailing list