[Mips] Do not show an error if R_MIPS_GPREL32 relocation has a non-local target

This matches GNU linker behaviour.

llvm-svn: 247795
This commit is contained in:
Simon Atanasyan 2015-09-16 13:36:24 +00:00
parent 9763490e4d
commit 49c67236f1
2 changed files with 0 additions and 54 deletions

View File

@ -914,16 +914,6 @@ make_reject_for_shared_lib_reloc_error(const ELFLinkingContext &ctx,
atom.file().path() + " with -fPIC");
}
static std::error_code
make_external_gprel32_reloc_error(const ELFLinkingContext &ctx,
const DefinedAtom &atom,
const Reference &ref) {
return make_dynamic_error_code(
"R_MIPS_GPREL32 (12) relocation cannot be used "
"against external symbol " +
ref.target()->name() + " in file " + atom.file().path());
}
static std::error_code
make_local_call16_reloc_error(const ELFLinkingContext &ctx,
const DefinedAtom &atom, const Reference &ref) {
@ -940,9 +930,6 @@ RelocationPass<ELFT>::validateRelocation(const DefinedAtom &atom,
if (!ref.target())
return std::error_code();
if (ref.kindValue() == R_MIPS_GPREL32 && !isLocal(ref.target()))
return make_external_gprel32_reloc_error(this->_ctx, atom, ref);
if (isCallReloc(ref.kindValue()) && isLocal(ref.target()))
return make_local_call16_reloc_error(this->_ctx, atom, ref);

View File

@ -1,41 +0,0 @@
# Check that the linker does not accept R_MIPS_GPREL32 relocation
# against external symbol.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t.o
# RUN: not lld -flavor gnu -target mipsel -e T0 -o %t.exe %t.o 2>&1 \
# RUN: | FileCheck %s
# CHECK: R_MIPS_GPREL32 (12) relocation cannot be used against external symbol T0 in file {{.*}}validate-rel-02.test.tmp.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 16
Size: 4
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .text
Relocations:
- Offset: 0
Symbol: T0
Type: R_MIPS_GPREL32
Symbols:
Global:
- Name: T0
Type: STT_FUNC
Section: .text
Size: 4
...