[lld] r293479 - [ELF] - Change i386 i386-pc8.s/i386-pc16.test to work with 8/16 bits values accordingly.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 05:56:59 PST 2017


Author: grimar
Date: Mon Jan 30 07:56:57 2017
New Revision: 293479

URL: http://llvm.org/viewvc/llvm-project?rev=293479&view=rev
Log:
[ELF] - Change i386 i386-pc8.s/i386-pc16.test to work with 8/16 bits values accordingly.

ld.bfd showed error on previous inputs, result values were larger than 8/16 bits,
though ld.gold accepted them.

ABI says "The R_386_16, and R_386_8 relocations truncate the computed 
value to 16-bits and 8-bits respectively".

Patch changes inputs to have result calculated values of relocations to fit 8 and 16 bits.
That can be used for implementation of more strict checks, like bfd do.

Differential revision: https://reviews.llvm.org/D29270

Modified:
    lld/trunk/test/ELF/i386-pc16.test
    lld/trunk/test/ELF/i386-pc8.s

Modified: lld/trunk/test/ELF/i386-pc16.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/i386-pc16.test?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- lld/trunk/test/ELF/i386-pc16.test (original)
+++ lld/trunk/test/ELF/i386-pc16.test Mon Jan 30 07:56:57 2017
@@ -1,11 +1,11 @@
 # REQUIRES: x86
 
 # RUN: yaml2obj %s -o %t.o
-# RUN: ld.lld %t.o -o %t.exe
+# RUN: ld.lld -Ttext 0x0 %t.o -o %t.exe
 # RUN: llvm-objdump -s -section=.text %t.exe 2>&1 | FileCheck %s
 
 # CHECK:      Contents of section .text:
-# CHECK-NEXT:  11000 56441111 52341111
+# CHECK-NEXT:  0000 45231111 41231111
 
 !ELF
 FileHeader:
@@ -36,5 +36,5 @@ Symbols:
     - Name:     _start
       Type:     STT_FUNC
       Section:  .text
-      Value:    0x12345
+      Value:    0x1234
       Size:     4

Modified: lld/trunk/test/ELF/i386-pc8.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/i386-pc8.s?rev=293479&r1=293478&r2=293479&view=diff
==============================================================================
--- lld/trunk/test/ELF/i386-pc8.s (original)
+++ lld/trunk/test/ELF/i386-pc8.s Mon Jan 30 07:56:57 2017
@@ -1,11 +1,11 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=i386-pc-linux-gnu %s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=i386-pc-linux-gnu %S/Inputs/i386-pc8.s -o %t2.o
-# RUN: ld.lld %t1.o %t2.o -o %t.out
+# RUN: ld.lld -Ttext 0x0 %t1.o %t2.o -o %t.out
 # RUN: llvm-objdump -s -section=.text %t.out | FileCheck %s
 
 # CHECK:      Contents of section .text:
-# CHECK-NEXT:  11000 15253748
+# CHECK-NEXT:  0000 15253748
 
 .byte und-.+0x11
 .byte und-.+0x22




More information about the llvm-commits mailing list