[PATCH] D16084: [ELF][MIPS] Prevent substitution of _gp_disp symbol
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 11 14:13:52 PST 2016
atanasyan added a comment.
In http://reviews.llvm.org/D16084#324046, @ruiu wrote:
> Is this behavior defined in the MIPS ABI, or is this just conventional?
>
> Why addIgnored() didn't work? I think addIgnored() adds an absolute symbol to the symbol table, so it doesn't seem much different from this code.
MIPS ABI says nothing about emitting _gp_disp symbol into the symbol table. But almost all legacy shared library has this symbol in their symbol tables. I guess by historical reasons. If I use addIgnored call the `IgnoreUndef` symbol has `STB_WEAK` binding. So corresponding MipsGpDisp SymbolBody it can be substituted by _gp_disp symbol defined in such shared library.
When I add MipsGpDisp with STB_GLOBAL binding the symbol gets priority over symbols from shared libraries.
================
Comment at: test/ELF/mips-gp-disp.s:5
@@ +4,3 @@
+# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
+# RUN: ld.lld -o %t.exe %t.o %S/Inputs/mips-gp-disp-def.so
+# RUN: llvm-readobj -symbols %t.exe | FileCheck -check-prefix=EXE %s
----------------
ruiu wrote:
> Can you create this so file in this file from an assembly file, instead of checking in a binary file?
I can't. This so file has _gp_disp in the symbol table and emulates a legacy shared library. In fact we do not need to have _gp_disp in a symbol table and LLD cannot produce such shared library itself.
Repository:
rL LLVM
http://reviews.llvm.org/D16084
More information about the llvm-commits
mailing list