-
- Downloads
IBM zSystems: Do not use @PLT with larl
Commit 0990d93d ("IBM Z: Use @PLT symbols for local functions in 64-bit mode") made GCC call both static and non-static functions and load both static and non-static function addresses with the @PLT suffix. This made it difficult for linkers to distinguish calling and address taking instructions [1]. It is currently assumed that the R_390_PLT32DBL relocation, corresponding to the @PLT suffix, is used only for calling, and the R_390_PC32DBL relocation, corresponding to the empty suffix, is used only for address taking. Linkers needs to make this distinction in order to decide whether to ask ld.so to use canonical PLT entries. Normally GOT entries in shared objects contain addresses of the respective functions, with one notable exception: when a no-pie executable calls the respective function and also takes its address. Such executables assume that all addresses are known in advance, so they use addresses of the respective PLT entries. For consistency reasons, all respective GOT entries in the process must also use them. When a linker sees that a no-pie executable both calls a function and also takes its address, it creates a PLT entry and asks ld.so to consider it canonical by setting the respective undefined symbol's address, which is normally 0, to the address of this PLT entry. Improve the situation by not using @PLT with larl. Now that @PLT is not used with larl, also drop the 31-bit handling, which was required because 31-bit PLT entries require %r12 to point to the respective object's GOT, and this requirement is not satisfied when calling them by pointer from another object. Also drop the weak symbol handling, which was required because it is not possible to load an undefined weak symbol address (0) using larl. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=29655 gcc/ChangeLog: * config/s390/s390.cc (print_operand): Remove the no longer necessary 31-bit and weak symbol handling. * config/s390/s390.md (*movdi_64): Do not use @PLT with larl. (*movsi_larl): Likewise. (main_base_64): Likewise. (reload_base_64): Likewise. gcc/testsuite/ChangeLog: * gcc.target/s390/call-z10-pic-nodatarel.c: Adjust expectations. * gcc.target/s390/call-z10-pic.c: Likewise. * gcc.target/s390/call-z10.c: Likewise. * gcc.target/s390/call-z9-pic-nodatarel.c: Likewise. * gcc.target/s390/call-z9-pic.c: Likewise. * gcc.target/s390/call-z9.c: Likewise.
Showing
- gcc/config/s390/s390.cc 3 additions, 13 deletionsgcc/config/s390/s390.cc
- gcc/config/s390/s390.md 4 additions, 4 deletionsgcc/config/s390/s390.md
- gcc/testsuite/gcc.target/s390/call-z10-pic-nodatarel.c 2 additions, 4 deletionsgcc/testsuite/gcc.target/s390/call-z10-pic-nodatarel.c
- gcc/testsuite/gcc.target/s390/call-z10-pic.c 2 additions, 4 deletionsgcc/testsuite/gcc.target/s390/call-z10-pic.c
- gcc/testsuite/gcc.target/s390/call-z10.c 5 additions, 9 deletionsgcc/testsuite/gcc.target/s390/call-z10.c
- gcc/testsuite/gcc.target/s390/call-z9-pic-nodatarel.c 2 additions, 4 deletionsgcc/testsuite/gcc.target/s390/call-z9-pic-nodatarel.c
- gcc/testsuite/gcc.target/s390/call-z9-pic.c 2 additions, 4 deletionsgcc/testsuite/gcc.target/s390/call-z9-pic.c
- gcc/testsuite/gcc.target/s390/call-z9.c 5 additions, 9 deletionsgcc/testsuite/gcc.target/s390/call-z9.c
Loading
Please register or sign in to comment