Bug 31398 - pr21964-4 fails on RISC-V with a default-pie compiler
Summary: pr21964-4 fails on RISC-V with a default-pie compiler
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.42
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-18 11:34 UTC by Xi Ruoyao
Modified: 2024-12-25 07:12 UTC (History)
1 user (show)

See Also:
Host:
Target: riscv*-*-*
Build:
Last reconfirmed: 2024-12-25 00:00:00
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xi Ruoyao 2024-02-18 11:34:09 UTC
On RISC-V (lp64d), With GCC 13.2 configured with --enable-default-pie, one ld test fails:

FAIL: Run pr21964-4

Forcing -fno-pie -no-pie makes it pass, but this test passes on various other architectures even with default PIE.
Comment 1 Andreas Schwab 2024-02-19 11:39:29 UTC
$ objdump -T tmpdir/pr21964-4 | grep __start___verbose
0000000000002020 g    D  __verbose      0000000000000000  Base        .protected __start___verbose
Comment 2 Andreas Schwab 2024-02-19 11:45:08 UTC
For some reason both main and __start___verbose are put in the dynamic symtab, unlike other architectures, where only the undefined references turn up there.
Comment 3 Andreas Schwab 2024-02-19 14:08:20 UTC
The difference appears to be that when pr21964-4.c is compiled with -fpie the symbol __start___verbose is referenced by a R_RISCV_GOT_HI20 relocation, without -fpie it is a R_RISCV_HI20 relocation.  Whether the program is linked with -pie or not does not make a difference.