public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/31317] New: [RISCV] static PIE crashes during self relocation
@ 2024-01-30 13:25 schwab@linux-m68k.org
  2024-02-22 18:44 ` [Bug dynamic-link/31317] " palmer at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: schwab@linux-m68k.org @ 2024-01-30 13:25 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31317

            Bug ID: 31317
           Summary: [RISCV] static PIE crashes during self relocation
           Product: glibc
           Version: 2.39
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: schwab@linux-m68k.org
  Target Milestone: ---

When running a static PIE created by the mold linker, it crashes during self
relocation while it tries to look up the __global_pointer$ symbols.  That
happens because the mold linker puts the relocation addend of a RELATIVE also
in the relocated field (unlike the BFD linker, which sets it to zero).

From sysdeps/riscv/dl-machine.h:

  if (l->l_type == lt_executable && l->l_scope != NULL)

In elf_machine_runtime_setup the condition l->l_scope != NULL references an
unrelocated pointer (where l points to the statically initialized _dl_main_map)
which is never NULL in a static PIE produced by ld.mold.

The failure can be seen in the mold testsuite (riscv64-ifunc-static-pie and
riscv64-static-pie).

https://build.opensuse.org/package/live_build_log/devel:gcc:next/mold/openSUSE_Factory_RISCV/riscv64

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-03-26 13:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 13:25 [Bug dynamic-link/31317] New: [RISCV] static PIE crashes during self relocation schwab@linux-m68k.org
2024-02-22 18:44 ` [Bug dynamic-link/31317] " palmer at gcc dot gnu.org
2024-02-22 21:47 ` schwab@linux-m68k.org
2024-02-22 22:53 ` palmer at gcc dot gnu.org
2024-02-22 23:01 ` vineet.gupta at linux dot dev
2024-02-22 23:16 ` schwab@linux-m68k.org
2024-02-22 23:26 ` palmer at gcc dot gnu.org
2024-02-23  3:06 ` yanzhang.wang at intel dot com
2024-03-06 14:44 ` rjones at redhat dot com
2024-03-25 14:20 ` cvs-commit at gcc dot gnu.org
2024-03-26 13:47 ` schwab@linux-m68k.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).