Re: [uclibc-ng-devel] [PATCH] ARC: support shared crt1

Vineet Gupta <[email protected]> Thu, 16 Jun 2016 06:38:25 +0000
Newsgroups gmane.comp.lib.uclibc.general,gmane.comp.lib.uclibc-ng
Message-ID <C2D7FE5348E1B147BCA15975FBA2307501069438C7@us01wembx1.internal.synopsys.com>
On Wednesday 15 June 2016 08:34 PM, Waldemar Brodkorb wrote:
> Hi Vineet,
> Vineet Gupta wrote,
>
>> Signed-off-by: Vineet Gupta <[email protected]>
>> ---
>>  libc/sysdeps/linux/arc/crt1.S | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/libc/sysdeps/linux/arc/crt1.S b/libc/sysdeps/linux/arc/crt1.S
>> index 95c41f888850..e38c8e81b2c0 100644
>> --- a/libc/sysdeps/linux/arc/crt1.S
>> +++ b/libc/sysdeps/linux/arc/crt1.S
>> @@ -41,11 +41,15 @@ __start:
>>  
>>  	mov_s	r5, r0		; rltd_fini
>>  	add_s	r2, sp, 4	; argv
>> -
>> +#ifdef L_Scrt1
>> +	add	r0, pcl, @main@pcl
>> +	add	r3, pcl, @_init@pcl
>> +	add	r4, pcl, @_fini@pcl
>> +#else
>>  	mov_s	r0, main
>>  	mov_s	r3, _init
>>  	mov	r4, _fini
>> -
>> +#endif
>>  	and	sp, sp, -8
>>  	mov	r6, sp
> Can you please be a little more descriptive why this patch is
> useful? Will ARC support static PIE or is Scrt1.o used in other
> code?

This is for a dynamically linked PIE - can we have static linked PIE ? Current
approach of taking addresses of functions, in not position independent but still
works for the normal dynamically linked executables (non PIE) since the zero based
addresses are rightly resolved in final link. This is not true for PIE hence we
need a really position independent way (PC relative addr) to pass those function
addresses.

Do u want me to respin with beefed up changelog.

> Sorry, had to resend with correct sender address.

My address was wrong ?