From 7fa220f5f164312332dc671a55a9c3acc4936b46 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Wed, 11 Jan 2017 14:20:13 +0000 Subject: [PATCH] [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 llvm-svn: 291672 --- lld/ELF/Target.cpp | 2 ++ lld/test/ELF/relocation-none-i686.test | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 lld/test/ELF/relocation-none-i686.test diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 284040f9aa30..749795f19b53 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -383,6 +383,8 @@ RelExpr X86TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const { 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) + ")"); diff --git a/lld/test/ELF/relocation-none-i686.test b/lld/test/ELF/relocation-none-i686.test new file mode 100644 index 000000000000..d8eed8f7a129 --- /dev/null +++ b/lld/test/ELF/relocation-none-i686.test @@ -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