[PATCH] D29392: [ELF] - Change value checks to checkUInt for R_386_8/R_386_PC8/R_386_16/R_386_PC16 relocations.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 1 05:58:11 PST 2017
grimar created this revision.
Recent changes which introduced checks broked linkage of linux kernel in part of
applying these relocations:
arch/x86/realmode/rm/wakeup_asm.S:135: relocation R_386_PC16 out of range
I checked that at the point of call:
checkInt<16>(Loc, Val, Type);
Val was 0x000000000000fda3
so looks checkUInt should be used here.
Patch updates testcases and checks. BFD likes and accepts updated inputs FWIW.
https://reviews.llvm.org/D29392
Files:
ELF/Target.cpp
test/ELF/i386-pc16.test
test/ELF/i386-pc8.s
Index: test/ELF/i386-pc8.s
===================================================================
--- test/ELF/i386-pc8.s
+++ test/ELF/i386-pc8.s
@@ -5,9 +5,9 @@
# RUN: llvm-objdump -s -section=.text %t.out | FileCheck %s
# CHECK: Contents of section .text:
-# CHECK-NEXT: 0000 15253748
+# CHECK-NEXT: 0000 f5f5f7f8
-.byte und-.+0x11
-.byte und-.+0x22
-.byte und+0x33
-.byte und+0x44
+.byte und-.+0xF1
+.byte und-.+0xF2
+.byte und+0xF3
+.byte und+0xF4
Index: test/ELF/i386-pc16.test
===================================================================
--- test/ELF/i386-pc16.test
+++ test/ELF/i386-pc16.test
@@ -5,7 +5,7 @@
# RUN: llvm-objdump -s -section=.text %t.exe 2>&1 | FileCheck %s
# CHECK: Contents of section .text:
-# CHECK-NEXT: 0000 45231111 41231111
+# CHECK-NEXT: 0000 11ff1111 0dff1111
!ELF
FileHeader:
@@ -36,5 +36,5 @@
- Name: _start
Type: STT_FUNC
Section: .text
- Value: 0x1234
+ Value: 0xEE00
Size: 4
Index: ELF/Target.cpp
===================================================================
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -518,12 +518,12 @@
switch (Type) {
case R_386_8:
case R_386_PC8:
- checkInt<8>(Loc, Val, Type);
+ checkUInt<8>(Loc, Val, Type);
*Loc = Val;
break;
case R_386_16:
case R_386_PC16:
- checkInt<16>(Loc, Val, Type);
+ checkUInt<16>(Loc, Val, Type);
write16le(Loc, Val);
break;
default:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29392.86620.patch
Type: text/x-patch
Size: 1462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170201/47090490/attachment.bin>
More information about the llvm-commits
mailing list