public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Stop referencing __global_pointer$ under PIC
@ 2023-06-08 16:44 Palmer Dabbelt
  2023-06-26 13:44 ` Palmer Dabbelt
  2023-06-26 20:12 ` Fangrui Song
  0 siblings, 2 replies; 11+ messages in thread
From: Palmer Dabbelt @ 2023-06-08 16:44 UTC (permalink / raw)
  To: libc-alpha; +Cc: Jeff Law, Palmer Dabbelt

This has some cascading fallout related to PC-relative references to
SHN_ABS that Jim reported in [1].  I have a workaround for that issue in
binutils [2], but GP isn't useful in PIC so we might as well just stop
referencing it at all.

Link: https://sourceware.org/bugzilla/show_bug.cgi?id=24678
Link: https://inbox.sourceware.org/binutils/20230608155214.32435-1-palmer@rivosinc.com/T/#u
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

---

I haven't tested thiis or the binutils patch.  There's a handful of
coupled issues here that might take a bit to untangle, but this came up
in the RISC-V LLVM sync this morning so I figured it would be best to
send something along.
---
 sysdeps/riscv/start.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/riscv/start.S b/sysdeps/riscv/start.S
index 6dfe65273f..5eaa8ccf2d 100644
--- a/sysdeps/riscv/start.S
+++ b/sysdeps/riscv/start.S
@@ -71,7 +71,9 @@ END (ENTRY_POINT)
 load_gp:
 .option push
 .option norelax
+#if !(defined(__PIC__) || defined(__pic__) || defined(PIC) || defined(pic))
 	lla   gp, __global_pointer$
+#endif
 .option pop
 	ret
 
-- 
2.40.1


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

end of thread, other threads:[~2023-06-26 20:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 16:44 [PATCH] RISC-V: Stop referencing __global_pointer$ under PIC Palmer Dabbelt
2023-06-26 13:44 ` Palmer Dabbelt
2023-06-26 13:55   ` Jeff Law
2023-06-26 14:15     ` David Abdurachmanov
2023-06-26 14:37       ` Jeff Law
2023-06-26 14:39     ` Andreas Schwab
2023-06-26 14:49     ` Florian Weimer
2023-06-26 15:01       ` Palmer Dabbelt
2023-06-26 14:50     ` Palmer Dabbelt
2023-06-26 20:12 ` Fangrui Song
2023-06-26 20:13   ` Palmer Dabbelt

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).