mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 10:55:58 +08:00
[ELF][MIPS] Do not create dynamic relocations against _gp_disp symbol
MIPS _gp_disp designates offset between start of function and gp pointer into GOT therefore any relocations against it do not require dynamic relocation. llvm-svn: 257492
This commit is contained in:
@@ -287,14 +287,21 @@ void Writer<ELFT>::scanRelocs(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Config->EMachine == EM_MIPS && NeedsGot) {
|
||||
// MIPS ABI has special rules to process GOT entries
|
||||
// and doesn't require relocation entries for them.
|
||||
// See "Global Offset Table" in Chapter 5 in the following document
|
||||
// for detailed description:
|
||||
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
|
||||
Body->setUsedInDynamicReloc();
|
||||
continue;
|
||||
if (Config->EMachine == EM_MIPS) {
|
||||
if (NeedsGot) {
|
||||
// MIPS ABI has special rules to process GOT entries
|
||||
// and doesn't require relocation entries for them.
|
||||
// See "Global Offset Table" in Chapter 5 in the following document
|
||||
// for detailed description:
|
||||
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
|
||||
Body->setUsedInDynamicReloc();
|
||||
continue;
|
||||
}
|
||||
if (Body == Config->MipsGpDisp)
|
||||
// MIPS _gp_disp designates offset between start of function and gp
|
||||
// pointer into GOT therefore any relocations against it do not require
|
||||
// dynamic relocation.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Here we are creating a relocation for the dynamic linker based on
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
# RUN: llvm-readobj -symbols %S/Inputs/mips-gp-disp.so \
|
||||
# RUN: | FileCheck -check-prefix=EXT-SO %s
|
||||
# RUN: llvm-objdump -d -t %t.so | FileCheck -check-prefix=DIS %s
|
||||
# RUN: llvm-readobj -relocations %t.so | FileCheck -check-prefix=REL %s
|
||||
|
||||
# REQUIRES: mips
|
||||
|
||||
@@ -22,6 +23,9 @@
|
||||
# ^-- 0x37ff0 & 0xffff
|
||||
# DIS: 00027ff0 *ABS* 00000000 _gp
|
||||
|
||||
# REL: Relocations [
|
||||
# REL-NEXT: ]
|
||||
|
||||
.text
|
||||
.globl __start
|
||||
__start:
|
||||
|
||||
Reference in New Issue
Block a user