strace/tests/strace-V.test
Eugene Syromyatnikov d9f6166f0c Add compat support for s390x
By very popular demand.

While we are here, let's refactor the condition for old_mmap_pgoff into
an arch-specific one, as it is used more than in one place.

* NEWS: Mention this.
* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Likewise.
* configure.ac (case "$host_cpu" in) <s390x>: Set arch_m32 to s390, set
cc_flags_m32 to -m31.
(st_MPERS([m32])): Add s390x.
* defs.h [S390X]: Define NEED_UID16_PARSERS.
* linux/s390/arch_sigreturn.c [!S390_FRAME_PTR] (S390_FRAME_PTR): New
macro, define to s390_frame_ptr.
[!SIGNAL_FRAMESIZE] (SIGNAL_FRAMESIZE): New macro, define to
__SIGNAL_FRAMESIZE.
[!PTR_TYPE] (PTR_TYPE): New macro, define to unsigned long.
(arch_sigreturn): Use S390_FRAME_PTR, SIGNAL_FRAMESIZE, and PTR_TYPE
instead of s390_frame_ptr, __SIGNAL_FRAMESIZE, and pointer-sized type,
respectively.
* linux/s390/get_error.c [!ARCH_REGSET] (ARCH_REGSET): New macro, define
* to s390_regset.
(get_error): Use it instead of s390_regset.
* linux/s390/get_scno.c (arch_get_scno): Likewise.
* linux/s390/get_syscall_args.c (get_syscall_args): Likewise.
* linux/s390/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/s390x/arch_regs.c (psw_compat_t, s390_compat_regs,
s390x_regs_union, s390_frame_ptr, s390x_frame_ptr, s390x_io): New
variables.
(s390_regset, s390x_regset, ARCH_REGS_FOR_GETREGSET,
ARCH_IOVEC_FOR_GETREGSET, ARCH_PC_REG, ARCH_PERSONALITY_0_IOV_SIZE,
ARCH_PERSONALITY_1_IOV_SIZE): New macros.
* linux/s390x/arch_regs.h (s390_frame_ptr, s390x_frame_ptr): New
prototypes.
* linux/s390x/arch_rt_sigframe.c: Conditionalize on tcp->currpers.
* linux/s390x/arch_sigreturn.c: Likewise.
* linux/s390x/get_error.c: Likewise.
* linux/s390x/get_scno.c: Likewise.
* linux/s390x/get_syscall_args.c: Likewise.
* linux/s390x/set_error.c: Likewise.
* linux/s390x/set_scno.c: Likewise.
* linux/s390x/errnoent1.h: New file.
* linux/s390x/ioctls_arch1.h: Likewise.
* linux/s390x/ioctls_inc1.h: Likewise.
* linux/s390x/signalent1.h: Likewise.
* linux/s390x/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add new files added to linux/s390x.
* supported_personalities.h [S390X] (SUPPORTED_PERSONALITIES): Define
to 2.
* tests/strace-V.test: Add s390 to the list of architectures that have
m32 personality.
* linux/s390/arch_defs.h (HAVE_ARCH_OLD_MMAP_PGOFF): New macro.
* linux/s390x/arch_defs.h: Likewise.
* mem.c: Replace #ifdef S390 with #ifdef HAVE_ARCH_OLD_MMAP_PGOFF.
* pathtrace.c: Likewise.
2018-01-19 02:04:37 +01:00

69 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# Check -V option.
. "${srcdir=.}/init.sh"
run_prog_skip_if_failed date +%Y > /dev/null
year="$(date +%Y)"
run_strace -V > "$LOG"
getstr()
{
sed -r -n 's/#define[[:space:]]*'"$1"'[[:space:]]*"([^"]*)".*/\1/p' \
../../config.h
}
# getoption OPTION YES_STRING [NO_STRING]
#
# Returns YES_STRING in case OPTION is enabled (present in config.h and has
# a non-zero numeric value). Otherwise, NO_STRING (or empty string, if not
# specified) is returned.
getoption()
{
local opt
opt=$(sed -r -n 's/#define[[:space:]]*'"$1"'[[:space:]]*([0-9]+)$/\1/p' \
../../config.h)
if [ -n "$opt" -a "$opt" -ne 0 ]; then
printf "%s" "$2"
else
printf "%s" "${3-}"
fi
}
config_year=$(getstr COPYRIGHT_YEAR)
[ "$year" -ge "$config_year" ] && [ "$config_year" -ge 2017 ] || {
echo >&2 "The year derived from config.h (${config_year}) does not pass sanity checks."
exit 1
}
option_unwind=$(getoption USE_LIBUNWIND " stack-unwind")
option_demangle=$(getoption USE_DEMANGLE " stack-demangle")
option_m32=
option_mx32=
case "$STRACE_NATIVE_ARCH" in
x86_64)
option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers')
option_mx32=$(getoption HAVE_MX32_MPERS ' mx32-mpers' ' no-mx32-mpers')
;;
aarch64|powerpc64|riscv|s390x|sparc64|tile|x32)
option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers')
;;
esac
features="${option_unwind}${option_demangle}${option_m32}${option_mx32}"
[ -n "$features" ] || features=" (none)"
cat > "$EXP" << __EOF__
$(getstr PACKAGE_NAME) -- version $(getstr PACKAGE_VERSION)
Copyright (c) 1991-${config_year} The strace developers <$(getstr PACKAGE_URL)>.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Optional features enabled:${features}
__EOF__
match_diff "$LOG" "$EXP"