Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153355678
D33689.id100710.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D33689.id100710.diff
View Options
Index: sys/tools/amd64_ia32_vdso.sh
===================================================================
--- sys/tools/amd64_ia32_vdso.sh
+++ sys/tools/amd64_ia32_vdso.sh
@@ -28,39 +28,11 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
-set -e
+ARCH=amd64
+SUBDIR=ia32
+COMPAT=32
+TARGET=_ia32
+SIGTRAMP_ASM=ia32_sigtramp
+CFLAGS=-m32
-${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c -m32 \
- -o ia32_sigtramp.pico -I. -I"${S}" -include opt_global.h \
- "${S}"/amd64/ia32/ia32_sigtramp.S
-
-${LD} --shared -Bsymbolic -soname="elf-vdso32.so.1" \
- -T "${S}"/conf/vdso_amd64_ia32.ldscript \
- --eh-frame-hdr --no-undefined -z rodynamic -z norelro -nmagic \
- --hash-style=sysv --fatal-warnings --strip-all \
- -o elf-vdso32.so.1 ia32_sigtramp.pico
-
-if [ "$(wc -c elf-vdso32.so.1 | ${AWK} '{print $1}')" -gt 2048 ]
-then
- echo "elf-vdso32.so.1 too large" 1>&2
- exit 1
-fi
-
-if [ -n "$(${ELFDUMP} -d elf-vdso32.so.1 | \
- ${AWK} '/DT_REL.*SZ/{print "RELOCS"}')" ]
-then
- echo "elf-vdso32.so.1 contains runtime relocations" 1>&2
- exit 1
-fi
-
-${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
-
-${NM} -D elf-vdso32.so.1 | ${AWK} \
- '/__vdso_ia32_sigcode/{printf "#define VDSO_IA32_SIGCODE_OFFSET 0x%s\n",$1}
- /__vdso_freebsd4_ia32_sigcode/{printf "#define VDSO_FREEBSD4_IA32_SIGCODE_OFFSET 0x%s\n",$1}
- /__vdso_ia32_osigcode/{printf "#define VDSO_IA32_OSIGCODE_OFFSET 0x%s\n",$1}
- /__vdso_lcall_tramp/{printf "#define VDSO_LCALL_TRAMP_OFFSET 0x%s\n",$1}' \
- >vdso_ia32_offsets.h
+. $(dirname $0)/vdso.sh
Index: sys/tools/amd64_vdso.sh
===================================================================
--- sys/tools/amd64_vdso.sh
+++ sys/tools/amd64_vdso.sh
@@ -28,45 +28,11 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
-set -e
+ARCH=amd64
+SUBDIR=amd64
+COMPAT=
+TARGET=
+SIGTRAMP_ASM=sigtramp
+CFLAGS=
-${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
- -o sigtramp.pico -I. -I"${S}" -include opt_global.h \
- "${S}"/amd64/amd64/sigtramp.S
-
-# We need to make vdso as compact as possible, for it to leave space
-# for other things in the shared page. For this, we pack everything
-# into single loadable segment.
-#
-# -z rodynamic is undocumented lld-specific option, seemingly required
-# for lld to avoid putting dynamic into dedicated writeable segment,
-# despite ldscript placement. It is ignored by ld.bfd but ldscript
-# alone is enough there.
-#
-${LD} --shared -Bsymbolic -soname="elf-vdso.so.1" \
- -T "${S}"/conf/vdso_amd64.ldscript \
- --eh-frame-hdr --no-undefined -z rodynamic -z norelro -nmagic \
- --hash-style=sysv --fatal-warnings --strip-all \
- -o elf-vdso.so.1 sigtramp.pico
-
-if [ "$(wc -c elf-vdso.so.1 | ${AWK} '{print $1}')" -gt 2048 ]
-then
- echo "elf-vdso.so.1 too large" 1>&2
- exit 1
-fi
-
-if [ -n "$(${ELFDUMP} -d elf-vdso.so.1 | \
- ${AWK} '/DT_REL.*SZ/{print "RELOCS"}')" ]
-then
- echo "elf-vdso.so.1 contains runtime relocations" 1>&2
- exit 1
-fi
-
-${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
-
-${NM} -D elf-vdso.so.1 | \
- ${AWK} '/__vdso_sigcode/{printf "#define VDSO_SIGCODE_OFFSET 0x%s\n",$1}' \
- >vdso_offsets.h
+. $(dirname $0)/vdso.sh
Index: sys/tools/vdso.sh
===================================================================
--- sys/tools/vdso.sh
+++ sys/tools/vdso.sh
@@ -1,4 +1,3 @@
-#!/bin/sh
# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
#
# Copyright (c) 2021 The FreeBSD Foundation
@@ -30,9 +29,9 @@
set -e
-${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
- -o sigtramp.pico -I. -I"${S}" -include opt_global.h \
- "${S}"/amd64/amd64/sigtramp.S
+${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c ${CFLAGS} \
+ -o ${SIGTRAMP_ASM}.pico -I. -I"${S}" -include opt_global.h \
+ "${S}"/${ARCH}/${SUBDIR}/${SIGTRAMP_ASM}.S
# We need to make vdso as compact as possible, for it to leave space
# for other things in the shared page. For this, we pack everything
@@ -43,30 +42,46 @@
# despite ldscript placement. It is ignored by ld.bfd but ldscript
# alone is enough there.
#
-${LD} --shared -Bsymbolic -soname="elf-vdso.so.1" \
- -T "${S}"/conf/vdso_amd64.ldscript \
+${LD} --shared -Bsymbolic -soname="elf-vdso${COMPAT}.so.1" \
+ -T "${S}"/conf/vdso_${ARCH}${TARGET}.ldscript \
--eh-frame-hdr --no-undefined -z rodynamic -z norelro -nmagic \
--hash-style=sysv --fatal-warnings --strip-all \
- -o elf-vdso.so.1 sigtramp.pico
+ -o elf-vdso${COMPAT}.so.1 ${SIGTRAMP_ASM}.pico
-if [ "$(wc -c elf-vdso.so.1 | ${AWK} '{print $1}')" -gt 2048 ]
+if [ "$(wc -c elf-vdso${COMPAT}.so.1 | ${AWK} '{print $1}')" -gt 2048 ]
then
- echo "elf-vdso.so.1 too large" 1>&2
+ echo "elf-vdso${COMPAT}.so.1 too large" 1>&2
exit 1
fi
-if [ -n "$(${ELFDUMP} -d elf-vdso.so.1 | \
+if [ -n "$(${ELFDUMP} -d elf-vdso${COMPAT}.so.1 | \
${AWK} '/DT_REL.*SZ/{print "RELOCS"}')" ]
then
- echo "elf-vdso.so.1 contains runtime relocations" 1>&2
+ echo "elf-vdso${COMPAT}.so.1 contains runtime relocations" 1>&2
exit 1
fi
${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 \
+ -o elf-vdso${COMPAT}.so.o -I. -I"${S}" -include opt_global.h \
+ -DVDSO_NAME=elf_vdso${COMPAT}_so_1 -DVDSO_FILE=elf-vdso${COMPAT}.so.1 \
"${S}"/tools/vdso_wrap.S
-${NM} -D elf-vdso.so.1 | \
- ${AWK} '/__vdso_sigcode/{printf "#define VDSO_SIGCODE_OFFSET 0x%s\n",$1}' \
- >vdso_offsets.h
+case "${ARCH}${TARGET}" in
+amd64)
+ ${NM} -D elf-vdso${COMPAT}.so.1 | \
+ ${AWK} '/__vdso_sigcode/{printf "#define VDSO_SIGCODE_OFFSET 0x%s",$1}' \
+ >vdso_offsets.h
+ ;;
+amd64_ia32)
+ ${NM} -D elf-vdso${COMPAT}.so.1 | ${AWK} \
+ '/__vdso_ia32_sigcode/{printf "#define VDSO_IA32_SIGCODE_OFFSET 0x%s\n",$1}
+ /__vdso_freebsd4_ia32_sigcode/{printf "#define VDSO_FREEBSD4_IA32_SIGCODE_OFFSET 0x%s\n",$1}
+ /__vdso_ia32_osigcode/{printf "#define VDSO_IA32_OSIGCODE_OFFSET 0x%s\n",$1}
+ /__vdso_lcall_tramp/{printf "#define VDSO_LCALL_TRAMP_OFFSET 0x%s\n",$1}' \
+ >vdso_ia32_offsets.h
+ ;;
+*)
+ echo "VDSO: Unknown Arch Target pair: ${ARCH}${TARGET}"
+ exit 1
+ ;;
+esac
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 4:29 PM (12 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31920714
Default Alt Text
D33689.id100710.diff (6 KB)
Attached To
Mode
D33689: Move the common parts of the vdso script to a new file
Attached
Detach File
Event Timeline
Log In to Comment