git: 1c818a7e577c - stable/13 - amd64: Pass DEBUG when building VDSO wrapper

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Tue, 25 Jan 2022 01:40:07 UTC
The branch stable/13 has been updated by jrtc27:

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

commit 1c818a7e577ce30bc7ca852513e7877024424f35
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-12-06 23:09:29 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2022-01-24 23:59:30 +0000

    amd64: Pass DEBUG when building VDSO wrapper
    
    Not doing so results in ctfconvert failing with
    
      ERROR: ctfconvert: elf-vdso.so.o doesn't have type data to convert
    
    On FreeBSD this is non-fatal, since the ctf tools have a hack to make
    such errors not fail the build and instead just silently continue
    without CTF data (which is a bad idea these days and should probably be
    removed; they date back to the original import). However, those are
    under #ifdef __FreeBSD__ so do not apply when cross-building from
    non-FreeBSD, causing the build to fail.
    
    Fix this by forwarding DEBUG on to the compiler invocation for the VDSO
    wrapper. It's assembly so it's not hugely useful, but there is a
    non-zero amount of information preserved, and other assembly files are
    built with -g by default too so this matches them; the alternative would
    be to tag the files.amd64 entries with no-ctfmerge. Note that the VDSO
    itself is still compiled without debug info, this only affects the
    wrapper linked into the kernel.
    
    Fixes:          98c8b6252496 ("vdso for ia32 on amd64"), ab4524b3d7fb ("amd64: wrap 64bit sigtramp into vdso")
    MFC after:      1 month
    
    (cherry picked from commit 169b368a62aac38091a302b2970df81e0281e98f)
---
 sys/conf/files.amd64         | 4 ++--
 sys/tools/amd64_ia32_vdso.sh | 2 +-
 sys/tools/amd64_vdso.sh      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 9eed2470c720..8bb59143df88 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -14,13 +14,13 @@ include 	"conf/files.x86"
 #
 elf-vdso.so.o			standard				\
 	dependency	"$S/amd64/amd64/sigtramp.S assym.inc $S/tools/amd64_vdso.sh" \
-	compile-with	"env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' OBJCOPY='${OBJCOPY}' ELFDUMP='${ELFDUMP}' S='${S}' sh $S/tools/amd64_vdso.sh" \
+	compile-with	"env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' DEBUG='${DEBUG}' OBJCOPY='${OBJCOPY}' ELFDUMP='${ELFDUMP}' S='${S}' sh $S/tools/amd64_vdso.sh" \
 	no-implicit-rule before-depend	\
 	clean		"elf-vdso.so.o elf-vdso.so.1 vdso_offsets.h sigtramp.pico"
 #
 elf-vdso32.so.o			optional	compat_freebsd32		\
 	dependency	"$S/amd64/ia32/ia32_sigtramp.S ia32_assym.h $S/tools/amd64_ia32_vdso.sh" \
-	compile-with	"env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' OBJCOPY='${OBJCOPY}' ELFDUMP='${ELFDUMP}' S='${S}' sh $S/tools/amd64_ia32_vdso.sh" \
+	compile-with	"env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' DEBUG='${DEBUG}' OBJCOPY='${OBJCOPY}' ELFDUMP='${ELFDUMP}' S='${S}' sh $S/tools/amd64_ia32_vdso.sh" \
 	no-implicit-rule before-depend	\
 	clean		"elf-vdso32.so.o elf-vdso32.so.1 vdso_ia32_offsets.h ia32_sigtramp.pico"
 #
diff --git a/sys/tools/amd64_ia32_vdso.sh b/sys/tools/amd64_ia32_vdso.sh
index d03249dd4940..6198ca8c6ffa 100644
--- a/sys/tools/amd64_ia32_vdso.sh
+++ b/sys/tools/amd64_ia32_vdso.sh
@@ -53,7 +53,7 @@ then
     exit 1
 fi
 
-${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
+${CC} ${DEBUG} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
    -o elf-vdso32.so.o -I. -I"${S}" -include opt_global.h \
    -DVDSO_NAME=elf_vdso32_so_1 -DVDSO_FILE=elf-vdso32.so.1 \
    "${S}"/tools/vdso_wrap.S
diff --git a/sys/tools/amd64_vdso.sh b/sys/tools/amd64_vdso.sh
index 8b9871e86802..c6fec72b8bbd 100644
--- a/sys/tools/amd64_vdso.sh
+++ b/sys/tools/amd64_vdso.sh
@@ -62,7 +62,7 @@ then
     exit 1
 fi
 
-${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
+${CC} ${DEBUG} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
    -o elf-vdso.so.o -I. -I"${S}" -include opt_global.h \
    -DVDSO_NAME=elf_vdso_so_1 -DVDSO_FILE=elf-vdso.so.1 \
    "${S}"/tools/vdso_wrap.S