[PATCH 3/3] LoongArch: Reword message for unresolvable PC-relative relocs

Xi Ruoyao xry111@xry111.site
Wed Dec 25 03:29:26 GMT 2024


On Wed, 2024-12-25 at 10:04 +0800, Lulu Cai wrote:
> On 12/18/24 5:00 PM, Xi Ruoyao wrote:
> > On Wed, 2024-12-18 at 16:12 +0800, Lulu Cai wrote:
> > 
> > /* snip */
> > 
> > >   Perhaps the prompt here is not always appropriate. such as: $ cat test.c
> > >   
> > > 
> > > 
> > > 
> > >   int a =1;
> > >   int main (void)
> > >   {
> > >   printf("%d\n",a);
> > >   }
> > >   
> > > 
> > > 
> > > 
> > >   $ gcc -fno-pic -c test.o
> > >   $ gcc -shared -o test test.o
> > >   
> > > 
> > > 
> > > 
> > >    Will get error message:
> > >   ld: test.o:(.text+0x10): relocation R_LARCH_PCALA_HI20 against `a` can not be used when making a shared object; recompile
> > >   with -mno-direct-extern-access and check the symbol visibility
> > Ah I think I've got the point.  So if we are linking a DSO, we should
> > still suggest -fPIC (and the compiler will reject the combination -fPIC
> > -mdirect-extern-access anyway so we don't need to redundantly mention -
> > mno-direct-extern-access); if we are linking a PIE or PDE, we should
> > suggest -mno-direct-extern-access.
> 
> Just asking. I would like to inquire whether you are available or have
> any ideas about
> sending out a new patch.

I'll send v2 soon.


-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Binutils mailing list