[lld] r291672 - [ELF] - Ignore R_386_NONE.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 06:20:14 PST 2017


Author: grimar
Date: Wed Jan 11 08:20:13 2017
New Revision: 291672

URL: http://llvm.org/viewvc/llvm-project?rev=291672&view=rev
Log:
[ELF] - Ignore R_386_NONE.

We had an error when met this relocation
after latest changes aboult listing
x86 relocations explicitly.

Since we support R_X86_64_NONE,
and GNU ld supports R_386_NONE,
it seems reasonable to have.

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

Added:
    lld/trunk/test/ELF/relocation-none-i686.test
Modified:
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=291672&r1=291671&r2=291672&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Jan 11 08:20:13 2017
@@ -383,6 +383,8 @@ RelExpr X86TargetInfo::getRelExpr(uint32
     return R_TLS;
   case R_386_TLS_LE_32:
     return R_NEG_TLS;
+  case R_386_NONE:
+    return R_HINT;
   default:
     error("do not know how to handle relocation " + toString(Type) + " (" +
           Twine(Type) + ")");

Added: lld/trunk/test/ELF/relocation-none-i686.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-none-i686.test?rev=291672&view=auto
==============================================================================
--- lld/trunk/test/ELF/relocation-none-i686.test (added)
+++ lld/trunk/test/ELF/relocation-none-i686.test Wed Jan 11 08:20:13 2017
@@ -0,0 +1,23 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: ld.lld %t.o -o %t.out
+
+# Test that we can handle R_386_NONE.
+
+!ELF
+FileHeader:
+  Class:           ELFCLASS32
+  Data:            ELFDATA2LSB
+  Type:            ET_REL
+  Machine:         EM_386
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC ]
+  - Name:            .rel.text
+    Type:            SHT_RELA
+    Link:            .symtab
+    Info:            .text
+    Relocations:
+      - Offset:          0x0000000000000000
+        Symbol:          ''
+        Type:            R_386_NONE




More information about the llvm-commits mailing list