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

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 19 Jul 2023 18:53:58 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e5c4737955d54d868e73a22beae7e8bb15703779

commit e5c4737955d54d868e73a22beae7e8bb15703779
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-07-19 18:53:33 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-07-19 18:53:33 +0000

    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:          c969310c992a csu: Implement _start using as to satisfy unwinders on x86_64
    Differential Revision:  https://reviews.freebsd.org/D41101
---
 lib/csu/amd64/crt1_s.S | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/csu/amd64/crt1_s.S b/lib/csu/amd64/crt1_s.S
index 0c1c3b960bda..f7ea076d94f1 100644
--- a/lib/csu/amd64/crt1_s.S
+++ b/lib/csu/amd64/crt1_s.S
@@ -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