diff options
author | George Rimar <grimar@accesssoftek.com> | 2016-03-03 07:49:35 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2016-03-03 07:49:35 +0000 |
commit | 4cfe572932ddb35dc91d4c241e41205543479b17 (patch) | |
tree | d0e5894145383d376c05a9cf97ac95f16f97e97b /lld/ELF/InputSection.cpp | |
parent | a64c8233b87eb26e9677faf5afe43e72a0ca1079 (diff) | |
download | bcm5719-llvm-4cfe572932ddb35dc91d4c241e41205543479b17.tar.gz bcm5719-llvm-4cfe572932ddb35dc91d4c241e41205543479b17.zip |
[ELF] - add support for relocations against local symbols when producing relocatable output.
There was a known limitation for -r option:
relocations against local symbols were not supported.
For example rel[a].eh_frame sections contained relocations against sections
and that was not supported for -r before. Patch fixes that.
Differential review: http://reviews.llvm.org/D17813
llvm-svn: 262590
Diffstat (limited to 'lld/ELF/InputSection.cpp')
-rw-r--r-- | lld/ELF/InputSection.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 4bdb45ee07d..61f3c3c583e 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -132,11 +132,15 @@ void InputSection<ELFT>::copyRelocations(uint8_t *Buf, RelType *P = reinterpret_cast<RelType *>(Buf); Buf += sizeof(RelType); - // Relocation for local symbol here means that it is probably - // rel[a].eh_frame section which has references to - // sections in r_info field. Also needs fix for addend. - if (SymIndex < SymTab->sh_info) - fatal("Relocation against local symbols is not supported yet"); + // Relocation against local symbol here means that it is probably + // rel[a].eh_frame section which has references to sections in r_info field. + if (SymIndex < SymTab->sh_info) { + const Elf_Sym *Sym = this->File->getLocalSymbol(SymIndex); + uint32_t Idx = Out<ELFT>::SymTab->Locals[Sym]; + P->r_offset = RelocatedSection->getOffset(Rel.r_offset); + P->setSymbolAndType(Idx, Type, Config->Mips64EL); + continue; + } SymbolBody *Body = this->File->getSymbolBody(SymIndex)->repl(); P->r_offset = RelocatedSection->getOffset(Rel.r_offset); |