amd64 crt1: Explicitly use a PLT entry for main in the PIC case.

This ensures GNU as generates a R_X86_64_PLT32 relocation instead of
R_X86_64_32.

Reviewed by:	kib
Fixes:		c969310c99 csu: Implement _start using as to satisfy unwinders on x86_64
Differential Revision:	https://reviews.freebsd.org/D41101
This commit is contained in:
John Baldwin 2023-07-19 11:53:33 -07:00
parent c84617e87a
commit e5c4737955

View file

@ -60,10 +60,11 @@ _start:
addq %rax, %rdx /* env += argc */
#ifdef PIC
/*
* XXX. %rip relative addressing does not intended to use in the
* large memory model due to offset from %rip is limited to 32 bits.
* XXX. %rip relative addressing is not intended for use in the
* large memory model due to the offset from %rip being limited
* to 32 bits.
*/
leaq main(%rip), %r8
leaq main@plt(%rip), %r8
#else
movabsq $main, %r8
#endif