public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7376] RISC-V: Document the degree of position independence that medany affords
@ 2022-02-24 19:32 Palmer Dabbelt
0 siblings, 0 replies; only message in thread
From: Palmer Dabbelt @ 2022-02-24 19:32 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8645370af18979123d9e94e3ed215d23dd740721
commit r12-7376-g8645370af18979123d9e94e3ed215d23dd740721
Author: Palmer Dabbelt <palmer@rivosinc.com>
Date: Thu Jan 13 18:10:19 2022 -0800
RISC-V: Document the degree of position independence that medany affords
The code generated by -mcmodel=medany is defined to be
position-independent, but is not guaranteed to function correctly when
linked into position-independent executables or libraries. See the
recent discussion at the psABI specification [1] for more details.
It would be better to reject these invalid sequences when linking, but
as pointed out in a recent LD bug [2] there may be some compatibility
issues related to the PCREL_HI20 relocations used to initialize GP.
Given the complexity here it's unlikely we'll be able to reject these
sequences any time soon, so instead just document that these may not
work.
[1]: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/245
[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=28789
gcc/ChangeLog:
* doc/invoke.texi (RISC-V -mcmodel=medany): Document the degree
of position independence that -mcmodel=medany affords.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diff:
---
gcc/doc/invoke.texi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index fb3dec4ab0c..ec291c06542 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -27772,6 +27772,10 @@ Generate code for the medium-any code model. The program and its statically
defined symbols must be within any single 2 GiB address range. Programs can be
statically or dynamically linked.
+The code generated by the medium-any code model is position-independent, but is
+not guaranteed to function correctly when linked into position-independent
+executables or libraries.
+
@item -mexplicit-relocs
@itemx -mno-exlicit-relocs
Use or do not use assembler relocation operators when dealing with symbolic
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-24 19:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 19:32 [gcc r12-7376] RISC-V: Document the degree of position independence that medany affords 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).