git: 1e261cb8c6df - stable/13 - vdso linker scripts: explicitly specify output arch and target

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 18 Feb 2022 02:01:32 UTC
The branch stable/13 has been updated by kib:

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

commit 1e261cb8c6dfd8a7c0e5193fd0f43ca732f639d4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-03 14:38:15 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-18 02:01:24 +0000

    vdso linker scripts: explicitly specify output arch and target
    
    (cherry picked from commit fd8d4e53bc2ac424d6f08ac700800093b03a2d97)
---
 sys/conf/vdso_amd64.ldscript      | 8 ++++++++
 sys/conf/vdso_amd64_ia32.ldscript | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/sys/conf/vdso_amd64.ldscript b/sys/conf/vdso_amd64.ldscript
index d412abd4cd02..40b147e3a715 100644
--- a/sys/conf/vdso_amd64.ldscript
+++ b/sys/conf/vdso_amd64.ldscript
@@ -32,6 +32,14 @@
  * Linker script for amd64 vdso.
  */
 
+/*
+ * The OUTPUT_ARCH and TARGET lines are for ld.bfd.
+ * lld doesn't do much with them, the only thing it does is producing ELF
+ * or binary based on TARGET.
+ */
+OUTPUT_ARCH(i386:x86-64)
+TARGET(elf64-x86-64-freebsd)
+
 PHDRS
 {
 	text		PT_LOAD		FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
diff --git a/sys/conf/vdso_amd64_ia32.ldscript b/sys/conf/vdso_amd64_ia32.ldscript
index 2033ebb9a396..543cfad4ef73 100644
--- a/sys/conf/vdso_amd64_ia32.ldscript
+++ b/sys/conf/vdso_amd64_ia32.ldscript
@@ -32,7 +32,14 @@
  * Linker script for ia32 (32bit) vdso on amd64.
  */
 
+/*
+ * The OUTPUT_ARCH and TARGET lines are for ld.bfd, which cannot determine
+ * the output format based on the first input file.
+ * lld doesn't do much with them, the only thing it does is produce ELF
+ * or binary based on TARGET.
+ */
 OUTPUT_ARCH(i386)
+TARGET(elf32-i386-freebsd)
 
 PHDRS
 {