On Fri, Jan 14, 2022 at 4:42 AM Palmer Dabbelt <pal...@rivosinc.com> wrote: > > The code generated by -mcmodel=medany is defined to be > position-independent, but is not guarnteed to function correctly when > linked into position-independent executables or libraries. See the > recent discussion at the psABI specification [1] for more details. > > [1]: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/245 > > gcc/ChangeLog: > > * doc/invoke.texi: Document the degree of position independence > that -mcmodel=medany affords. > > Signed-off-by: Palmer Dabbelt <pal...@rivosinc.com> > --- > gcc/doc/invoke.texi | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 5504971ea81..eaba12bb61f 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -27568,6 +27568,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 guarnteed to function correctly when linked into position-independent > +executables or libraries.
Typo: guarnteed -> guaranteed I think it would be more helpful from a user perspective if a hint to the solution (i.e. use -fPIC) would be there. What about something like this: """ The code generated by the medium-any code model is position-independent. However, to link such code into position-independent executables or libraries, the corresponding flags to enable position-independent code generation still need to be provided (e.g. -fPIC or -fPIE). """ > @item -mexplicit-relocs > @itemx -mno-exlicit-relocs > Use or do not use assembler relocation operators when dealing with symbolic > -- > 2.32.0