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

Lulu Cai cailulu@loongson.cn
Wed Dec 25 02:04:06 GMT 2024


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.

> And in both cases we should also suggest checking symbol visibility, in
> addition to check compiler flags.
>
> Is my understanding correct?
>
>



More information about the Binutils mailing list