This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][gold][aarch64][pr23870] Check whether symbols with MOVW_.ABS relocations require PLT entries


ping

Adding Cary Coutant, since he could possibly review this patch as the gold maintainer.

Regards,
Egeyar


On 1/28/19 5:14 PM, Egeyar Bagcioglu wrote:
Hello,

The following patch on upstream glibc

https://sourceware.org/ml/libc-alpha/2017-09/msg00282.html

is causing crt1.o to contain R_AARCH64_MOVW_UABS_G* relocations for the symbol "main". AArch64 backend of gold currently does not check whether such symbols require a PLT entry.

This is causing pr 23870:
When a non-pie referring to a "main" symbol in a shared library is being linked using a recent crt1.o, gold is failing to create a dynamic symbol for "main". Therefore, upon calling "main", such an executable seg-faults.

I added a test case mimicking what _start and __libc_start_main does: The former gives an undefined symbol as an argument to the latter where it is called as a function. Therefore, the symbol does not become a global symbol in either .o and the linker needs to arrange the dynamic relocation.

The attached patch checks if a symbol with R_AARCH64_MOVW_.ABS_G* relocations needs a PLT entry and creates it if necessary. It is tested on aarch64-unknown-linux-gnu and caused no regressions.

gold/ChangeLog entry:

2019-01-28  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

    PR 23870
    * aarch64.cc (Target_aarch64::Scan::global): Check if a symbol with
    R_AARCH64_MOVW_.ABS_* relocations requires a PLT entry.
    * testsuite/Makefile.am: Add aarch64_pr23870 test case.
    * testsuite/Makefile.in: Regenerate.
    * testsuite/aarch64_pr23870_bar.c: New file.
    * testsuite/aarch64_pr23870_foo.c: New file.
    * testsuite/aarch64_pr23870_main.S: New file.


Please take a look and apply if legitimate.

Regards,
Egeyar


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]