diff options
author | Michel Zou | 2021-02-09 19:52:30 +0100 |
---|---|---|
committer | Michel Zou | 2021-02-09 19:52:30 +0100 |
commit | 99911209c19bacff975bcb45621c1fb763e4d9e1 (patch) | |
tree | 404a7981115cd22b342457d90cf8b143f15d3f3b | |
download | aur-99911209c19bacff975bcb45621c1fb763e4d9e1.tar.gz |
2.33
-rw-r--r-- | .SRCINFO | 57 | ||||
-rw-r--r-- | PKGBUILD | 242 | ||||
-rw-r--r-- | bz27343.patch | 48 | ||||
-rw-r--r-- | glibc-linux4-syscalls.patch | 358 | ||||
-rw-r--r-- | glibc.install | 5 | ||||
-rw-r--r-- | lib32-glibc.conf | 1 | ||||
-rwxr-xr-x | locale-gen | 42 | ||||
-rw-r--r-- | locale.gen.txt | 23 | ||||
-rw-r--r-- | sdt-config.h | 6 | ||||
-rw-r--r-- | sdt.h | 430 |
10 files changed, 1212 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..c2bb152bdb07 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,57 @@ +pkgbase = glibc-linux4 + pkgver = 2.33 + pkgrel = 3 + url = https://www.gnu.org/software/libc + arch = x86_64 + license = GPL + license = LGPL + makedepends = git + makedepends = gd + makedepends = lib32-gcc-libs + makedepends = python + optdepends = perl: for mtrace + options = !strip + options = staticlibs + source = https://ftp.gnu.org/gnu/glibc/glibc-2.33.tar.xz + source = https://ftp.gnu.org/gnu/glibc/glibc-2.33.tar.xz.sig + source = glibc-linux4-syscalls.patch + source = locale.gen.txt + source = locale-gen + source = lib32-glibc.conf + source = sdt.h + source = sdt-config.h + source = bz27343.patch + validpgpkeys = 7273542B39962DF7B299931416792B4EA25340F8 + validpgpkeys = BC7C7372637EC10C57D7AA6579C43DFBF1CF2187 + md5sums = 390bbd889c7e8e8a7041564cb6b27cca + md5sums = SKIP + md5sums = SKIP + md5sums = 07ac979b6ab5eeb778d55f041529d623 + md5sums = 476e9113489f93b348b21e144b6a8fcf + md5sums = 6e052f1cb693d5d3203f50f9d4e8c33b + md5sums = 91fec3b7e75510ae2ac42533aa2e695e + md5sums = 680df504c683640b02ed4a805797c0b2 + md5sums = cfe57018d06bf748b8ca1779980fef33 + +pkgname = glibc-linux4 + pkgdesc = GNU C Library (linux 4.x compat) + install = glibc.install + depends = linux-api-headers>=4.10 + depends = tzdata + depends = filesystem + optdepends = gd: for memusagestat + provides = glibc + conflicts = glibc + backup = etc/gai.conf + backup = etc/locale.gen + backup = etc/nscd.conf + +pkgname = lib32-glibc-linux4 + pkgdesc = GNU C Library (32-bit, linux 4.x compat) + depends = glibc=2.33 + provides = lib32-glibc + conflicts = lib32-glibc + options = !strip + options = staticlibs + options = !emptydirs + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..d0a13f522d32 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,242 @@ +# Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org> +# Contributor: Allan McRae <allan@archlinux.org> + +# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc +# NOTE: valgrind requires rebuilt with each major glibc version + +pkgbase=glibc-linux4 +pkgname=(glibc-linux4 lib32-glibc-linux4) +pkgver=2.33 +pkgrel=3 +arch=(x86_64) +url='https://www.gnu.org/software/libc' +license=(GPL LGPL) +makedepends=(git gd lib32-gcc-libs python) +optdepends=('perl: for mtrace') +options=(!strip staticlibs) +#_commit=3de512be7ea6053255afed6154db9ee31d4e557a +#source=(git+https://sourceware.org/git/glibc.git#commit=$_commit +source=(https://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.xz{,.sig} + glibc-linux4-syscalls.patch + locale.gen.txt + locale-gen + lib32-glibc.conf + sdt.h sdt-config.h + bz27343.patch) +validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8 # Carlos O'Donell + BC7C7372637EC10C57D7AA6579C43DFBF1CF2187) # Siddhesh Poyarekar +md5sums=('390bbd889c7e8e8a7041564cb6b27cca' + 'SKIP' + 'SKIP' + '07ac979b6ab5eeb778d55f041529d623' + '476e9113489f93b348b21e144b6a8fcf' + '6e052f1cb693d5d3203f50f9d4e8c33b' + '91fec3b7e75510ae2ac42533aa2e695e' + '680df504c683640b02ed4a805797c0b2' + 'cfe57018d06bf748b8ca1779980fef33') + +prepare() { + mkdir -p glibc-build lib32-glibc-build + + [[ -d glibc-$pkgver ]] && ln -s glibc-$pkgver glibc + cd glibc + + # commit c3479fb7939898ec22c655c383454d6e8b982a67 + patch -p1 -i "$srcdir"/bz27343.patch + + # compatibility with linux 4.x hosts + patch -p1 -i "$srcdir"/glibc-linux4-syscalls.patch +} + +build() { + local _configure_flags=( + --prefix=/usr + --with-headers=/usr/include + --with-bugurl=https://bugs.archlinux.org/ + --enable-add-ons + --enable-bind-now + --enable-cet + --enable-lock-elision + --enable-multi-arch + --enable-stack-protector=strong + --enable-stackguard-randomization + --enable-static-pie + --enable-systemtap + --disable-profile + --disable-werror + ) + + cd "$srcdir/glibc-build" + + echo "slibdir=/usr/lib" >> configparms + echo "rtlddir=/usr/lib" >> configparms + echo "sbindir=/usr/bin" >> configparms + echo "rootsbindir=/usr/bin" >> configparms + + # remove fortify for building libraries + CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} + + # + CFLAGS=${CFLAGS/-fno-plt/} + CXXFLAGS=${CXXFLAGS/-fno-plt/} + LDFLAGS=${LDFLAGS/,-z,now/} + + "$srcdir/glibc/configure" \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + ${_configure_flags[@]} + + # build libraries with fortify disabled + echo "build-programs=no" >> configparms + make + + # re-enable fortify for programs + sed -i "/build-programs=/s#no#yes#" configparms + + echo "CC += -D_FORTIFY_SOURCE=2" >> configparms + echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms + make + + # build info pages manually for reprducibility + make info + + cd "$srcdir/lib32-glibc-build" + export CC="gcc -m32 -mstackrealign" + export CXX="g++ -m32 -mstackrealign" + + echo "slibdir=/usr/lib32" >> configparms + echo "rtlddir=/usr/lib32" >> configparms + echo "sbindir=/usr/bin" >> configparms + echo "rootsbindir=/usr/bin" >> configparms + + # remove fortify for building libraries + CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} + CFLAGS=${CFLAGS/-fno-plt/} + CXXFLAGS=${CXXFLAGS/-fno-plt/} + + "$srcdir/glibc/configure" \ + --host=i686-pc-linux-gnu \ + --libdir=/usr/lib32 \ + --libexecdir=/usr/lib32 \ + ${_configure_flags[@]} + + # build libraries with fortify disabled + echo "build-programs=no" >> configparms + make + + # re-enable fortify for programs + sed -i "/build-programs=/s#no#yes#" configparms + + echo "CC += -D_FORTIFY_SOURCE=2" >> configparms + echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms + make + +} + +check() { + cd glibc-build + + # remove fortify in preparation to run test-suite + sed -i '/FORTIFY/d' configparms + + # some failures are "expected" + make check || true +} + +package_glibc-linux4() { + pkgdesc='GNU C Library (linux 4.x compat)' + depends=('linux-api-headers>=4.10' tzdata filesystem) + provides=('glibc') + conflicts=('glibc') + optdepends=('gd: for memusagestat') + install=glibc.install + backup=(etc/gai.conf + etc/locale.gen + etc/nscd.conf) + + install -dm755 "$pkgdir/etc" + touch "$pkgdir/etc/ld.so.conf" + + make -C glibc-build install_root="$pkgdir" install + rm -f "$pkgdir"/etc/ld.so.{cache,conf} + + # Shipped in tzdata + rm -f "$pkgdir"/usr/bin/{tzselect,zdump,zic} + + cd glibc + + install -dm755 "$pkgdir"/usr/lib/{locale,systemd/system,tmpfiles.d} + install -m644 nscd/nscd.conf "$pkgdir/etc/nscd.conf" + install -m644 nscd/nscd.service "$pkgdir/usr/lib/systemd/system" + install -m644 nscd/nscd.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/nscd.conf" + install -dm755 "$pkgdir/var/db/nscd" + + install -m644 posix/gai.conf "$pkgdir"/etc/gai.conf + + install -m755 "$srcdir/locale-gen" "$pkgdir/usr/bin" + + # Create /etc/locale.gen + install -m644 "$srcdir/locale.gen.txt" "$pkgdir/etc/locale.gen" + sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \ + "$srcdir/glibc/localedata/SUPPORTED" >> "$pkgdir/etc/locale.gen" + + if check_option 'debug' n; then + find "$pkgdir"/usr/bin -type f -executable -exec strip $STRIP_BINARIES {} + 2> /dev/null || true + find "$pkgdir"/usr/lib -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true + + # Do not strip these for gdb and valgrind functionality, but strip the rest + find "$pkgdir"/usr/lib \ + -not -name 'ld-*.so' \ + -not -name 'libc-*.so' \ + -not -name 'libpthread-*.so' \ + -not -name 'libthread_db-*.so' \ + -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true + fi + + # Provide tracing probes to libstdc++ for exceptions, possibly for other + # libraries too. Useful for gdb's catch command. + install -Dm644 "$srcdir/sdt.h" "$pkgdir/usr/include/sys/sdt.h" + install -Dm644 "$srcdir/sdt-config.h" "$pkgdir/usr/include/sys/sdt-config.h" + + # Provided by libxcrypt; keep the old shared library for backwards compatibility + rm -f "$pkgdir"/usr/include/crypt.h "$pkgdir"/usr/lib/libcrypt.{a,so} +} + +package_lib32-glibc-linux4() { + pkgdesc='GNU C Library (32-bit, linux 4.x compat)' + depends=("glibc=$pkgver") + provides=('lib32-glibc') + conflicts=('lib32-glibc') + options+=('!emptydirs') + + cd lib32-glibc-build + + make install_root="$pkgdir" install + rm -rf "$pkgdir"/{etc,sbin,usr/{bin,sbin,share},var} + + # We need to keep 32 bit specific header files + find "$pkgdir/usr/include" -type f -not -name '*-32.h' -delete + + # Dynamic linker + install -d "$pkgdir/usr/lib" + ln -s ../lib32/ld-linux.so.2 "$pkgdir/usr/lib/" + + # Add lib32 paths to the default library search path + install -Dm644 "$srcdir/lib32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/lib32-glibc.conf" + + # Symlink /usr/lib32/locale to /usr/lib/locale + ln -s ../lib/locale "$pkgdir/usr/lib32/locale" + + if check_option 'debug' n; then + find "$pkgdir"/usr/lib32 -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true + find "$pkgdir"/usr/lib32 \ + -not -name 'ld-*.so' \ + -not -name 'libc-*.so' \ + -not -name 'libpthread-*.so' \ + -not -name 'libthread_db-*.so' \ + -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true + fi + + # Provided by lib32-libxcrypt; keep the old shared library for backwards compatibility + rm -f "$pkgdir"/usr/lib32/libcrypt.{a,so} +} diff --git a/bz27343.patch b/bz27343.patch new file mode 100644 index 000000000000..3db6a9440eb2 --- /dev/null +++ b/bz27343.patch @@ -0,0 +1,48 @@ +From c3479fb7939898ec22c655c383454d6e8b982a67 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <slyfox@gentoo.org> +Date: Fri, 5 Feb 2021 07:32:18 +0000 +Subject: [PATCH] nsswitch: return result when nss database is locked [BZ + #27343] + +Before the change nss_database_check_reload_and_get() did not populate +the '*result' value when it returned success in a case of chroot +detection. This caused initgroups() to use garage pointer in the +following test (extracted from unbound): + +``` + +int main() { + // load some NSS modules + struct passwd * pw = getpwnam("root"); + + chdir("/tmp"); + chroot("/tmp"); + chdir("/"); + // access nsswitch.conf in a chroot + initgroups("root", 0); +} +``` + +Reviewed-by: DJ Delorie <dj@redhat.com> +--- + nss/nss_database.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/nss/nss_database.c b/nss/nss_database.c +index cf0306adc4..e1bef6bd75 100644 +--- a/nss/nss_database.c ++++ b/nss/nss_database.c +@@ -398,8 +398,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local, + && (str.st_ino != local->root_ino + || str.st_dev != local->root_dev))) + { +- /* Change detected; disable reloading. */ ++ /* Change detected; disable reloading and return current state. */ + atomic_store_release (&local->data.reload_disabled, 1); ++ *result = local->data.services[database_index]; + __libc_lock_unlock (local->lock); + __nss_module_disable_loading (); + return true; +-- +2.27.0 + diff --git a/glibc-linux4-syscalls.patch b/glibc-linux4-syscalls.patch new file mode 100644 index 000000000000..c2d5e44ec934 --- /dev/null +++ b/glibc-linux4-syscalls.patch @@ -0,0 +1,358 @@ +diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c +index 89b4ba76e9..5033193472 100644 +--- a/sysdeps/nptl/futex-internal.c ++++ b/sysdeps/nptl/futex-internal.c +@@ -71,13 +71,9 @@ __futex_abstimed_wait_common64 (unsigned int* futex_word, + int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private); + + if (cancel) +- err = INTERNAL_SYSCALL_CANCEL (futex_time64, futex_word, op, expected, +- abstime, NULL /* Unused. */, +- FUTEX_BITSET_MATCH_ANY); ++ err = -ENOSYS; //INTERNAL_SYSCALL_CANCEL (futex_time64, futex_word, op, expected, abstime, NULL /* Unused. */, FUTEX_BITSET_MATCH_ANY); + else +- err = INTERNAL_SYSCALL_CALL (futex_time64, futex_word, op, expected, +- abstime, NULL /* Ununsed. */, +- FUTEX_BITSET_MATCH_ANY); ++ err = -ENOSYS; //INTERNAL_SYSCALL_CALL (futex_time64, futex_word, op, expected, abstime, NULL /* Ununsed. */, FUTEX_BITSET_MATCH_ANY); + #ifndef __ASSUME_TIME64_SYSCALLS + if (err == -ENOSYS) + err = __futex_abstimed_wait_common32 (futex_word, expected, op, abstime, +diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h +index 4c192c99e3..4e977b4598 100644 +--- a/sysdeps/nptl/futex-internal.h ++++ b/sysdeps/nptl/futex-internal.h +@@ -254,9 +254,7 @@ static __always_inline int + futex_lock_pi64 (int *futex_word, const struct __timespec64 *abstime, + int private) + { +- int err = INTERNAL_SYSCALL_CALL (futex_time64, futex_word, +- __lll_private_flag +- (FUTEX_LOCK_PI, private), 0, abstime); ++ int err = -ENOSYS; //INTERNAL_SYSCALL_CALL (futex_time64, futex_word, __lll_private_flag (FUTEX_LOCK_PI, private), 0, abstime); + #ifndef __ASSUME_TIME64_SYSCALLS + if (err == -ENOSYS) + { +diff --git a/sysdeps/unix/sysv/linux/clock_adjtime.c b/sysdeps/unix/sysv/linux/clock_adjtime.c +index 7850eb2ec4..606cb46f1b 100644 +--- a/sysdeps/unix/sysv/linux/clock_adjtime.c ++++ b/sysdeps/unix/sysv/linux/clock_adjtime.c +@@ -29,7 +29,8 @@ __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64) + #ifndef __NR_clock_adjtime64 + # define __NR_clock_adjtime64 __NR_clock_adjtime + #endif +- int r = INLINE_SYSCALL_CALL (clock_adjtime64, clock_id, tx64); ++ int r = -1; // INLINE_SYSCALL_CALL (clock_adjtime64, clock_id, tx64); ++ errno = ENOSYS; + #ifndef __ASSUME_TIME64_SYSCALLS + if (r >= 0 || errno != ENOSYS) + return r; +diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c +index 15215d6855..ba1de750df 100644 +--- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c ++++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c +@@ -34,7 +34,7 @@ __clock_getcpuclockid (pid_t pid, clockid_t *clock_id) + #ifndef __NR_clock_getres_time64 + # define __NR_clock_getres_time64 __NR_clock_getres + #endif +- int r = INTERNAL_SYSCALL_CALL (clock_getres_time64, pidclock, NULL); ++ int r = -ENOSYS; //INTERNAL_SYSCALL_CALL (clock_getres_time64, pidclock, NULL); + + #ifndef __ASSUME_TIME64_SYSCALLS + if (r != 0 && r == -ENOSYS) +diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c +index 14e50fbdf2..f2d21bcf52 100644 +--- a/sysdeps/unix/sysv/linux/clock_getres.c ++++ b/sysdeps/unix/sysv/linux/clock_getres.c +@@ -37,9 +37,9 @@ __clock_getres64 (clockid_t clock_id, struct __timespec64 *res) + if (supports_time64 ()) + { + #ifdef HAVE_CLOCK_GETRES64_VSYSCALL +- r = INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res); ++ r = ENOSYS; //INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res); + #else +- r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); ++ r = ENOSYS; //INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); + #endif + + if (r == 0 || errno != ENOSYS) +diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c +index 781d05c2fd..f4d8d07e0e 100644 +--- a/sysdeps/unix/sysv/linux/clock_gettime.c ++++ b/sysdeps/unix/sysv/linux/clock_gettime.c +@@ -38,9 +38,9 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp) + if (supports_time64 ()) + { + #ifdef HAVE_CLOCK_GETTIME64_VSYSCALL +- r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); ++ r = ENOSYS; //INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); + #else +- r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); ++ r = ENOSYS; //INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); + #endif + + if (r == 0 || errno != ENOSYS) +diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c +index 007f1736cb..a8e7bf94c8 100644 +--- a/sysdeps/unix/sysv/linux/clock_nanosleep.c ++++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c +@@ -40,8 +40,7 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec + #ifndef __NR_clock_nanosleep_time64 + # define __NR_clock_nanosleep_time64 __NR_clock_nanosleep + #endif +- int r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, clock_id, +- flags, req, rem); ++ int r = -ENOSYS; //INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, clock_id, flags, req, rem); + + #ifndef __ASSUME_TIME64_SYSCALLS + if (r == 0 || r != -ENOSYS) +diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c +index 598d72b8b1..54a1d3c208 100644 +--- a/sysdeps/unix/sysv/linux/clock_settime.c ++++ b/sysdeps/unix/sysv/linux/clock_settime.c +@@ -35,7 +35,8 @@ __clock_settime64 (clockid_t clock_id, const struct __timespec64 *tp) + #ifndef __NR_clock_settime64 + # define __NR_clock_settime64 __NR_clock_settime + #endif +- int ret = INLINE_SYSCALL_CALL (clock_settime64, clock_id, tp); ++ int ret = -1; //INLINE_SYSCALL_CALL (clock_settime64, clock_id, tp); ++ errno = ENOSYS; + + #ifndef __ASSUME_TIME64_SYSCALLS + if (ret == 0 || errno != ENOSYS) +diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c +index 13160d3249..9f35998f9e 100644 +--- a/sysdeps/unix/sysv/linux/faccessat.c ++++ b/sysdeps/unix/sysv/linux/faccessat.c +@@ -26,7 +26,8 @@ + int + __faccessat (int fd, const char *file, int mode, int flag) + { +- int ret = INLINE_SYSCALL_CALL (faccessat2, fd, file, mode, flag); ++ int ret = -1; //INLINE_SYSCALL_CALL (faccessat2, fd, file, mode, flag); ++ errno = ENOSYS; + #if __ASSUME_FACCESSAT2 + return ret; + #else +diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h +index 1680b10ca1..bb903c44cc 100644 +--- a/sysdeps/unix/sysv/linux/kernel-features.h ++++ b/sysdeps/unix/sysv/linux/kernel-features.h +@@ -201,7 +201,7 @@ + #if __LINUX_KERNEL_VERSION >= 0x050100 \ + || __WORDSIZE == 64 \ + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) +-# define __ASSUME_TIME64_SYSCALLS 1 ++# define NO_ASSUME_TIME64_SYSCALLS 1 + #endif + + /* Linux waitid prior kernel 5.4 does not support waiting for the current +@@ -213,7 +213,7 @@ + /* The faccessat2 system call was introduced across all architectures + in Linux 5.8. */ + #if __LINUX_KERNEL_VERSION >= 0x050800 +-# define __ASSUME_FACCESSAT2 1 ++# define __ASSUME_FACCESSAT2 0 + #else + # define __ASSUME_FACCESSAT2 0 + #endif +diff --git a/sysdeps/unix/sysv/linux/mq_timedreceive.c b/sysdeps/unix/sysv/linux/mq_timedreceive.c +index eb948ccc18..d63d314592 100644 +--- a/sysdeps/unix/sysv/linux/mq_timedreceive.c ++++ b/sysdeps/unix/sysv/linux/mq_timedreceive.c +@@ -29,8 +29,8 @@ __mq_timedreceive_time64 (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len, + #ifndef __NR_mq_timedreceive_time64 + # define __NR_mq_timedreceive_time64 __NR_mq_timedreceive + #endif +- int ret = SYSCALL_CANCEL (mq_timedreceive_time64, mqdes, msg_ptr, msg_len, +- msg_prio, abs_timeout); ++ int ret = -1; //SYSCALL_CANCEL (mq_timedreceive_time64, mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); ++ errno = ENOSYS; + + #ifndef __ASSUME_TIME64_SYSCALLS + if (ret == 0 || errno != ENOSYS) +diff --git a/sysdeps/unix/sysv/linux/mq_timedsend.c b/sysdeps/unix/sysv/linux/mq_timedsend.c +index 5f14ecb0bf..e77979d248 100644 +--- a/sysdeps/unix/sysv/linux/mq_timedsend.c ++++ b/sysdeps/unix/sysv/linux/mq_timedsend.c +@@ -29,8 +29,8 @@ __mq_timedsend_time64 (mqd_t mqdes, const char *msg_ptr, size_t msg_len, + # ifndef __NR_mq_timedsend_time64 + # define __NR_mq_timedsend_time64 __NR_mq_timedsend + # endif +- int ret = SYSCALL_CANCEL (mq_timedsend_time64, mqdes, msg_ptr, msg_len, +- msg_prio, abs_timeout); ++ int ret = -1; //SYSCALL_CANCEL (mq_timedsend_time64, mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); ++ errno = ENOSYS; + + #ifndef __ASSUME_TIME64_SYSCALLS + if (ret == 0 || errno != ENOSYS) +diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c +index 624f14f517..1c042f8238 100644 +--- a/sysdeps/unix/sysv/linux/ppoll.c ++++ b/sysdeps/unix/sysv/linux/ppoll.c +@@ -45,8 +45,8 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout, + #ifndef __NR_ppoll_time64 + # define __NR_ppoll_time64 __NR_ppoll + #endif +- ret = SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask, +- __NSIG_BYTES); ++ ret = -1; //SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask, __NSIG_BYTES); ++ errno = ENOSYS; + + if (ret == 0 || errno != ENOSYS) + return ret; +diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c +index 5e8a0cc2dc..053785a5ad 100644 +--- a/sysdeps/unix/sysv/linux/pselect.c ++++ b/sysdeps/unix/sysv/linux/pselect.c +@@ -49,8 +49,8 @@ __pselect64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + { + (uintptr_t) sigmask, __NSIG_BYTES + }; +- r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, +- timeout, data); ++ r = -1; //SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, timeout, data); ++ errno = ENOSYS; + if (r == 0 || errno != ENOSYS) + return r; + +diff --git a/sysdeps/unix/sysv/linux/recvmmsg.c b/sysdeps/unix/sysv/linux/recvmmsg.c +index 672ba20332..d99dafcfc5 100644 +--- a/sysdeps/unix/sysv/linux/recvmmsg.c ++++ b/sysdeps/unix/sysv/linux/recvmmsg.c +@@ -27,8 +27,8 @@ __recvmmsg64 (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags, + #ifndef __NR_recvmmsg_time64 + # define __NR_recvmmsg_time64 __NR_recvmmsg + #endif +- int r = SYSCALL_CANCEL (recvmmsg_time64, fd, vmessages, vlen, flags, +- timeout); ++ int r = -1; //SYSCALL_CANCEL (recvmmsg_time64, fd, vmessages, vlen, flags, timeout); ++ errno = ENOSYS; + #ifndef __ASSUME_TIME64_SYSCALLS + if (r >= 0 || errno != ENOSYS) + return r; +diff --git a/sysdeps/unix/sysv/linux/sched_rr_gi.c b/sysdeps/unix/sysv/linux/sched_rr_gi.c +index 5e55cf4977..fa172ee8bc 100644 +--- a/sysdeps/unix/sysv/linux/sched_rr_gi.c ++++ b/sysdeps/unix/sysv/linux/sched_rr_gi.c +@@ -28,7 +28,8 @@ __sched_rr_get_interval64 (pid_t pid, struct __timespec64 *tp) + #ifndef __NR_sched_rr_get_interval_time64 + # define __NR_sched_rr_get_interval_time64 __NR_sched_rr_get_interval + #endif +- int ret = INLINE_SYSCALL_CALL (sched_rr_get_interval_time64, pid, tp); ++ int ret = -1; //INLINE_SYSCALL_CALL (sched_rr_get_interval_time64, pid, tp); ++ errno = ENOSYS; + #ifndef __ASSUME_TIME64_SYSCALLS + if (ret == 0 || errno != ENOSYS) + return ret; +diff --git a/sysdeps/unix/sysv/linux/select.c b/sysdeps/unix/sysv/linux/select.c +index 415aa87d3c..ecbe0456ac 100644 +--- a/sysdeps/unix/sysv/linux/select.c ++++ b/sysdeps/unix/sysv/linux/select.c +@@ -46,8 +46,8 @@ __select64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + int r; + if (supports_time64 ()) + { +- r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, +- pts64, NULL); ++ r = -1; //SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds, pts64, NULL); ++ errno = ENOSYS; + /* Linux by default will update the timeout after a pselect6 syscall + (though the pselect() glibc call suppresses this behavior). + Since select() on Linux has the same behavior as the pselect6 +diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c +index b732b6db48..a7050420ab 100644 +--- a/sysdeps/unix/sysv/linux/semtimedop.c ++++ b/sysdeps/unix/sysv/linux/semtimedop.c +@@ -28,7 +28,8 @@ __semtimedop64 (int semid, struct sembuf *sops, size_t nsops, + { + int r; + #if defined __NR_semtimedop_time64 +- r = INLINE_SYSCALL_CALL (semtimedop_time64, semid, sops, nsops, timeout); ++ r = -1; //INLINE_SYSCALL_CALL (semtimedop_time64, semid, sops, nsops, timeout); ++ errno = ENOSYS; + #elif defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS && defined __NR_semtimedop + r = INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout); + #else +diff --git a/sysdeps/unix/sysv/linux/time64-support.h b/sysdeps/unix/sysv/linux/time64-support.h +index 8466d37f8f..35bf73f5ee 100644 +--- a/sysdeps/unix/sysv/linux/time64-support.h ++++ b/sysdeps/unix/sysv/linux/time64-support.h +@@ -54,6 +54,7 @@ extern int __time64_support attribute_hidden; + static inline bool + supports_time64 (void) + { ++ return false; + #ifdef __ASSUME_TIME64_SYSCALLS + return true; + #else +diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c +index 193fe3b140..782387bba9 100644 +--- a/sysdeps/unix/sysv/linux/timer_gettime.c ++++ b/sysdeps/unix/sysv/linux/timer_gettime.c +@@ -31,7 +31,8 @@ __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value) + #ifndef __NR_timer_gettime64 + # define __NR_timer_gettime64 __NR_timer_gettime + #endif +- int ret = INLINE_SYSCALL_CALL (timer_gettime64, ktimerid, value); ++ int ret = -1; //INLINE_SYSCALL_CALL (timer_gettime64, ktimerid, value); ++ errno = ENOSYS; + #ifndef __ASSUME_TIME64_SYSCALLS + if (ret == 0 || errno != ENOSYS) + return ret; +diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c +index f8bb16a4c2..24aa17f1bf 100644 +--- a/sysdeps/unix/sysv/linux/timer_settime.c ++++ b/sysdeps/unix/sysv/linux/timer_settime.c +@@ -38,8 +38,7 @@ __timer_settime64 (timer_t timerid, int flags, + ovalue); + #else + # ifdef __NR_timer_settime64 +- int ret = INLINE_SYSCALL_CALL (timer_settime64, ktimerid, flags, value, +- ovalue); ++ int ret = ENOSYS; //INLINE_SYSCALL_CALL (timer_settime64, ktimerid, flags, value, ovalue); + if (ret == 0 || errno != ENOSYS) + return ret; + # endif +diff --git a/sysdeps/unix/sysv/linux/timerfd_gettime.c b/sysdeps/unix/sysv/linux/timerfd_gettime.c +index 89f8066b91..e11cf663ba 100644 +--- a/sysdeps/unix/sysv/linux/timerfd_gettime.c ++++ b/sysdeps/unix/sysv/linux/timerfd_gettime.c +@@ -32,7 +32,8 @@ __timerfd_gettime64 (int fd, struct __itimerspec64 *value) + return INLINE_SYSCALL_CALL (timerfd_gettime64, fd, value); + #else + # ifdef __NR_timerfd_gettime64 +- int ret = INLINE_SYSCALL_CALL (timerfd_gettime64, fd, value); ++ int ret = -1; //INLINE_SYSCALL_CALL (timerfd_gettime64, fd, value); ++ errno = ENOSYS; + if (ret == 0 || errno != ENOSYS) + return ret; + # endif +diff --git a/sysdeps/unix/sysv/linux/timerfd_settime.c b/sysdeps/unix/sysv/linux/timerfd_settime.c +index 0dd6fa026e..3f57b84cb4 100644 +--- a/sysdeps/unix/sysv/linux/timerfd_settime.c ++++ b/sysdeps/unix/sysv/linux/timerfd_settime.c +@@ -29,7 +29,8 @@ __timerfd_settime64 (int fd, int flags, const struct __itimerspec64 *value, + #ifndef __NR_timerfd_settime64 + # define __NR_timerfd_settime64 __NR_timerfd_settime + #endif +- int ret = INLINE_SYSCALL_CALL (timerfd_settime64, fd, flags, value, ovalue); ++ int ret = -1; //INLINE_SYSCALL_CALL (timerfd_settime64, fd, flags, value, ovalue); ++ errno = ENOSYS; + #ifndef __ASSUME_TIME64_SYSCALLS + if (ret == 0 || errno != ENOSYS) + return ret; +diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c +index 909a29762b..8115e62868 100644 +--- a/sysdeps/unix/sysv/linux/utimensat.c ++++ b/sysdeps/unix/sysv/linux/utimensat.c +@@ -31,7 +31,8 @@ __utimensat64_helper (int fd, const char *file, + #ifndef __NR_utimensat_time64 + # define __NR_utimensat_time64 __NR_utimensat + #endif +- int ret = INLINE_SYSCALL_CALL (utimensat_time64, fd, file, &tsp64[0], flags); ++ int ret = -1; //INLINE_SYSCALL_CALL (utimensat_time64, fd, file, &tsp64[0], flags); ++ errno = ENOSYS; + #ifndef __ASSUME_TIME64_SYSCALLS + if (ret == 0 || errno != ENOSYS) + return ret; diff --git a/glibc.install b/glibc.install new file mode 100644 index 000000000000..351f05b263cb --- /dev/null +++ b/glibc.install @@ -0,0 +1,5 @@ +post_upgrade() { + locale-gen + + ldconfig -r . +} diff --git a/lib32-glibc.conf b/lib32-glibc.conf new file mode 100644 index 000000000000..9b08c3f43a78 --- /dev/null +++ b/lib32-glibc.conf @@ -0,0 +1 @@ +/usr/lib32 diff --git a/locale-gen b/locale-gen new file mode 100755 index 000000000000..5aff344c4e91 --- /dev/null +++ b/locale-gen @@ -0,0 +1,42 @@ +#!/bin/sh + +set -e + +LOCALEGEN=/etc/locale.gen +LOCALES=/usr/share/i18n/locales +if [ -n "$POSIXLY_CORRECT" ]; then + unset POSIXLY_CORRECT +fi + + +[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0; + +# Remove all old locale dir and locale-archive before generating new +# locale data. +rm -rf /usr/lib/locale/* || true + +umask 022 + +is_entry_ok() { + if [ -n "$locale" -a -n "$charset" ] ; then + true + else + echo "error: Bad entry '$locale $charset'" + false + fi +} + +echo "Generating locales..." +while read locale charset; do \ + case $locale in \#*) continue;; "") continue;; esac; \ + is_entry_ok || continue + echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \ + echo -n ".$charset"; \ + echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \ + echo -n '...'; \ + if [ -f $LOCALES/$locale ]; then input=$locale; else \ + input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \ + localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \ + echo ' done'; \ +done < $LOCALEGEN +echo "Generation complete." diff --git a/locale.gen.txt b/locale.gen.txt new file mode 100644 index 000000000000..ccdd817342c7 --- /dev/null +++ b/locale.gen.txt @@ -0,0 +1,23 @@ +# Configuration file for locale-gen +# +# lists of locales that are to be generated by the locale-gen command. +# +# Each line is of the form: +# +# <locale> <charset> +# +# where <locale> is one of the locales given in /usr/share/i18n/locales +# and <charset> is one of the character sets listed in /usr/share/i18n/charmaps +# +# Examples: +# en_US ISO-8859-1 +# en_US.UTF-8 UTF-8 +# de_DE ISO-8859-1 +# de_DE@euro ISO-8859-15 +# +# The locale-gen command will generate all the locales, +# placing them in /usr/lib/locale. +# +# A list of supported locales is included in this file. +# Uncomment the ones you need. +# diff --git a/sdt-config.h b/sdt-config.h new file mode 100644 index 000000000000..733045a52771 --- /dev/null +++ b/sdt-config.h @@ -0,0 +1,6 @@ +/* includes/sys/sdt-config.h. Generated from sdt-config.h.in by configure. + + This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to + indicate whether the assembler supports "?" in .pushsection directives. */ + +#define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1 diff --git a/sdt.h b/sdt.h new file mode 100644 index 000000000000..c0c5a492cb9c --- /dev/null +++ b/sdt.h @@ -0,0 +1,430 @@ +/* <sys/sdt.h> - Systemtap static probe definition macros. + + This file is dedicated to the public domain, pursuant to CC0 + (https://creativecommons.org/publicdomain/zero/1.0/) +*/ + +#ifndef _SYS_SDT_H +#define _SYS_SDT_H 1 + +/* + This file defines a family of macros + + STAP_PROBEn(op1, ..., opn) + + that emit a nop into the instruction stream, and some data into an auxiliary + note section. The data in the note section describes the operands, in terms + of size and location. Each location is encoded as assembler operand string. + Consumer tools such as gdb or systemtap insert breakpoints on top of + the nop, and decode the location operand-strings, like an assembler, + to find the values being passed. + + The operand strings are selected by the compiler for each operand. + They are constrained by gcc inline-assembler codes. The default is: + + #define STAP_SDT_ARG_CONSTRAINT nor + + This is a good default if the operands tend to be integral and + moderate in number (smaller than number of registers). In other + cases, the compiler may report "'asm' requires impossible reload" or + similar. In this case, consider simplifying the macro call (fewer + and simpler operands), reduce optimization, or override the default + constraints string via: + + #define STAP_SDT_ARG_CONSTRAINT g + #include <sys/sdt.h> + + See also: + https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation + https://gcc.gnu.org/onlinedocs/gcc/Constraints.html + */ + + + +#ifdef __ASSEMBLER__ +# define _SDT_PROBE(provider, name, n, arglist) \ + _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING_1, (_SDT_DEPAREN_##n arglist)) \ + _SDT_ASM_BASE +# define _SDT_ASM_1(x) x; +# define _SDT_ASM_2(a, b) a,b; +# define _SDT_ASM_3(a, b, c) a,b,c; +# define _SDT_ASM_5(a, b, c, d, e) a,b,c,d,e; +# define _SDT_ASM_STRING_1(x) .asciz #x; +# define _SDT_DEPAREN_0() /* empty */ +# define _SDT_DEPAREN_1(a) a +# define _SDT_DEPAREN_2(a,b) a b +# define _SDT_DEPAREN_3(a,b,c) a b c +# define _SDT_DEPAREN_4(a,b,c,d) a b c d +# define _SDT_DEPAREN_5(a,b,c,d,e) a b c d e +# define _SDT_DEPAREN_6(a,b,c,d,e,f) a b c d e f +# define _SDT_DEPAREN_7(a,b,c,d,e,f,g) a b c d e f g +# define _SDT_DEPAREN_8(a,b,c,d,e,f,g,h) a b c d e f g h +# define _SDT_DEPAREN_9(a,b,c,d,e,f,g,h,i) a b c d e f g h i +# define _SDT_DEPAREN_10(a,b,c,d,e,f,g,h,i,j) a b c d e f g h i j +# define _SDT_DEPAREN_11(a,b,c,d,e,f,g,h,i,j,k) a b c d e f g h i j k +# define _SDT_DEPAREN_12(a,b,c,d,e,f,g,h,i,j,k,l) a b c d e f g h i j k l +#else +# define _SDT_PROBE(provider, name, n, arglist) \ + do { \ + __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \ + :: _SDT_ASM_OPERANDS_##n arglist); \ + __asm__ __volatile__ (_SDT_ASM_BASE); \ + } while (0) +# define _SDT_S(x) #x +# define _SDT_ASM_1(x) _SDT_S(x) "\n" +# define _SDT_ASM_2(a, b) _SDT_S(a) "," _SDT_S(b) "\n" +# define _SDT_ASM_3(a, b, c) _SDT_S(a) "," _SDT_S(b) "," \ + _SDT_S(c) "\n" +# define _SDT_ASM_5(a, b, c, d, e) _SDT_S(a) "," _SDT_S(b) "," \ + _SDT_S(c) "," _SDT_S(d) "," \ + _SDT_S(e) "\n" +# define _SDT_ASM_ARGS(n) _SDT_ASM_STRING(_SDT_ASM_TEMPLATE_##n) +# define _SDT_ASM_STRING_1(x) _SDT_ASM_1(.asciz #x) + +# define _SDT_ARGFMT(no) %n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no) + +# ifndef STAP_SDT_ARG_CONSTRAINT +# if defined __powerpc__ +# define STAP_SDT_ARG_CONSTRAINT nZr +# else +# define STAP_SDT_ARG_CONSTRAINT nor +# endif +# endif + +# define _SDT_STRINGIFY(x) #x +# define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x) +# define _SDT_ARG(n, x) \ + [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \ + [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x)) +#endif +#define _SDT_ASM_STRING(x) _SDT_ASM_STRING_1(x) + +#define _SDT_ARGARRAY(x) (__builtin_classify_type (x) == 14 \ + || __builtin_classify_type (x) == 5) + +#ifdef __cplusplus +# define _SDT_ARGSIGNED(x) (!_SDT_ARGARRAY (x) \ + && __sdt_type<__typeof (x)>::__sdt_signed) +# define _SDT_ARGSIZE(x) (_SDT_ARGARRAY (x) \ + ? sizeof (void *) : sizeof (x)) +# define _SDT_ARGVAL(x) (x) + +# include <cstddef> + +template<typename __sdt_T> +struct __sdt_type +{ + static const bool __sdt_signed = false; +}; + +#define __SDT_ALWAYS_SIGNED(T) \ +template<> struct __sdt_type<T> { static const bool __sdt_signed = true; }; +#define __SDT_COND_SIGNED(T,CT) \ +template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); }; +__SDT_ALWAYS_SIGNED(signed char) +__SDT_ALWAYS_SIGNED(short) +__SDT_ALWAYS_SIGNED(int) +__SDT_ALWAYS_SIGNED(long) +__SDT_ALWAYS_SIGNED(long long) +__SDT_ALWAYS_SIGNED(volatile signed char) +__SDT_ALWAYS_SIGNED(volatile short) +__SDT_ALWAYS_SIGNED(volatile int) +__SDT_ALWAYS_SIGNED(volatile long) +__SDT_ALWAYS_SIGNED(volatile long long) +__SDT_ALWAYS_SIGNED(const signed char) +__SDT_ALWAYS_SIGNED(const short) +__SDT_ALWAYS_SIGNED(const int) +__SDT_ALWAYS_SIGNED(const long) +__SDT_ALWAYS_SIGNED(const long long) +__SDT_ALWAYS_SIGNED(const volatile signed char) +__SDT_ALWAYS_SIGNED(const volatile short) +__SDT_ALWAYS_SIGNED(const volatile int) +__SDT_ALWAYS_SIGNED(const volatile long) +__SDT_ALWAYS_SIGNED(const volatile long long) +__SDT_COND_SIGNED(char, char) +__SDT_COND_SIGNED(wchar_t, wchar_t) +__SDT_COND_SIGNED(volatile char, char) +__SDT_COND_SIGNED(volatile wchar_t, wchar_t) +__SDT_COND_SIGNED(const char, char) +__SDT_COND_SIGNED(const wchar_t, wchar_t) +__SDT_COND_SIGNED(const volatile char, char) +__SDT_COND_SIGNED(const volatile wchar_t, wchar_t) +#if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +/* __SDT_COND_SIGNED(char16_t) */ +/* __SDT_COND_SIGNED(char32_t) */ +#endif + +template<typename __sdt_E> +struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {}; + +template<typename __sdt_E, size_t __sdt_N> +struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {}; + +#elif !defined(__ASSEMBLER__) +__extension__ extern unsigned long long __sdt_unsp; +# define _SDT_ARGINTTYPE(x) \ + __typeof (__builtin_choose_expr (((__builtin_classify_type (x) \ + + 3) & -4) == 4, (x), 0U)) +# define _SDT_ARGSIGNED(x) \ + (!__extension__ \ + (__builtin_constant_p ((((unsigned long long) \ + (_SDT_ARGINTTYPE (x)) __sdt_unsp) \ + & ((unsigned long long)1 << (sizeof (unsigned long long) \ + * __CHAR_BIT__ - 1))) == 0) \ + || (_SDT_ARGINTTYPE (x)) -1 > (_SDT_ARGINTTYPE (x)) 0)) +# define _SDT_ARGSIZE(x) \ + (_SDT_ARGARRAY (x) ? sizeof (void *) : sizeof (x)) +# define _SDT_ARGVAL(x) (x) +#endif + +#if defined __powerpc__ || defined __powerpc64__ +# define _SDT_ARGTMPL(id) %I[id]%[id] +#elif defined __i386__ +# define _SDT_ARGTMPL(id) %w[id] /* gcc.gnu.org/PR80115 */ +#else +# define _SDT_ARGTMPL(id) %[id] +#endif + +#ifdef __LP64__ +# define _SDT_ASM_ADDR .8byte +#else +# define _SDT_ASM_ADDR .4byte +#endif + +/* The ia64 and s390 nop instructions take an argument. */ +#if defined(__ia64__) || defined(__s390__) || defined(__s390x__) +#define _SDT_NOP nop 0 +#else +#define _SDT_NOP nop +#endif + +#define _SDT_NOTE_NAME "stapsdt" +#define _SDT_NOTE_TYPE 3 + +/* If the assembler supports the necessary feature, then we can play + nice with code in COMDAT sections, which comes up in C++ code. + Without that assembler support, some combinations of probe placements + in certain kinds of C++ code may produce link-time errors. */ +#include "sdt-config.h" +#if _SDT_ASM_SECTION_AUTOGROUP_SUPPORT +# define _SDT_ASM_AUTOGROUP "?" +#else +# define _SDT_ASM_AUTOGROUP "" +#endif + +#define _SDT_ASM_BODY(provider, name, pack_args, args) \ + _SDT_ASM_1(990: _SDT_NOP) \ + _SDT_ASM_3( .pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \ + _SDT_ASM_1( .balign 4) \ + _SDT_ASM_3( .4byte 992f-991f, 994f-993f, _SDT_NOTE_TYPE) \ + _SDT_ASM_1(991: .asciz _SDT_NOTE_NAME) \ + _SDT_ASM_1(992: .balign 4) \ + _SDT_ASM_1(993: _SDT_ASM_ADDR 990b) \ + _SDT_ASM_1( _SDT_ASM_ADDR _.stapsdt.base) \ + _SDT_SEMAPHORE(provider,name) \ + _SDT_ASM_STRING(provider) \ + _SDT_ASM_STRING(name) \ + pack_args args \ + _SDT_ASM_1(994: .balign 4) \ + _SDT_ASM_1( .popsection) + +#define _SDT_ASM_BASE \ + _SDT_ASM_1(.ifndef _.stapsdt.base) \ + _SDT_ASM_5( .pushsection .stapsdt.base,"aG","progbits", \ + .stapsdt.base,comdat) \ + _SDT_ASM_1( .weak _.stapsdt.base) \ + _SDT_ASM_1( .hidden _.stapsdt.base) \ + _SDT_ASM_1( _.stapsdt.base: .space 1) \ + _SDT_ASM_2( .size _.stapsdt.base, 1) \ + _SDT_ASM_1( .popsection) \ + _SDT_ASM_1(.endif) + +#if defined _SDT_HAS_SEMAPHORES +#define _SDT_SEMAPHORE(p,n) _SDT_ASM_1( _SDT_ASM_ADDR p##_##n##_semaphore) +#else +#define _SDT_SEMAPHORE(p,n) _SDT_ASM_1( _SDT_ASM_ADDR 0) +#endif + +#define _SDT_ASM_TEMPLATE_0 /* no arguments */ +#define _SDT_ASM_TEMPLATE_1 _SDT_ARGFMT(1) +#define _SDT_ASM_TEMPLATE_2 _SDT_ASM_TEMPLATE_1 _SDT_ARGFMT(2) +#define _SDT_ASM_TEMPLATE_3 _SDT_ASM_TEMPLATE_2 _SDT_ARGFMT(3) +#define _SDT_ASM_TEMPLATE_4 _SDT_ASM_TEMPLATE_3 _SDT_ARGFMT(4) +#define _SDT_ASM_TEMPLATE_5 _SDT_ASM_TEMPLATE_4 _SDT_ARGFMT(5) +#define _SDT_ASM_TEMPLATE_6 _SDT_ASM_TEMPLATE_5 _SDT_ARGFMT(6) +#define _SDT_ASM_TEMPLATE_7 _SDT_ASM_TEMPLATE_6 _SDT_ARGFMT(7) +#define _SDT_ASM_TEMPLATE_8 _SDT_ASM_TEMPLATE_7 _SDT_ARGFMT(8) +#define _SDT_ASM_TEMPLATE_9 _SDT_ASM_TEMPLATE_8 _SDT_ARGFMT(9) +#define _SDT_ASM_TEMPLATE_10 _SDT_ASM_TEMPLATE_9 _SDT_ARGFMT(10) +#define _SDT_ASM_TEMPLATE_11 _SDT_ASM_TEMPLATE_10 _SDT_ARGFMT(11) +#define _SDT_ASM_TEMPLATE_12 _SDT_ASM_TEMPLATE_11 _SDT_ARGFMT(12) +#define _SDT_ASM_OPERANDS_0() [__sdt_dummy] "g" (0) +#define _SDT_ASM_OPERANDS_1(arg1) _SDT_ARG(1, arg1) +#define _SDT_ASM_OPERANDS_2(arg1, arg2) \ + _SDT_ASM_OPERANDS_1(arg1), _SDT_ARG(2, arg2) +#define _SDT_ASM_OPERANDS_3(arg1, arg2, arg3) \ + _SDT_ASM_OPERANDS_2(arg1, arg2), _SDT_ARG(3, arg3) +#define _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4) \ + _SDT_ASM_OPERANDS_3(arg1, arg2, arg3), _SDT_ARG(4, arg4) +#define _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5) \ + _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4), _SDT_ARG(5, arg5) +#define _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ + _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5), _SDT_ARG(6, arg6) +#define _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6), _SDT_ARG(7, arg7) +#define _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ + _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7), \ + _SDT_ARG(8, arg8) +#define _SDT_ASM_OPERANDS_9(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \ + _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), \ + _SDT_ARG(9, arg9) +#define _SDT_ASM_OPERANDS_10(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ + _SDT_ASM_OPERANDS_9(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), \ + _SDT_ARG(10, arg10) +#define _SDT_ASM_OPERANDS_11(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \ + _SDT_ASM_OPERANDS_10(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), \ + _SDT_ARG(11, arg11) +#define _SDT_ASM_OPERANDS_12(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \ + _SDT_ASM_OPERANDS_11(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), \ + _SDT_ARG(12, arg12) + +/* These macros can be used in C, C++, or assembly code. + In assembly code the arguments should use normal assembly operand syntax. */ + +#define STAP_PROBE(provider, name) \ + _SDT_PROBE(provider, name, 0, ()) +#define STAP_PROBE1(provider, name, arg1) \ + _SDT_PROBE(provider, name, 1, (arg1)) +#define STAP_PROBE2(provider, name, arg1, arg2) \ + _SDT_PROBE(provider, name, 2, (arg1, arg2)) +#define STAP_PROBE3(provider, name, arg1, arg2, arg3) \ + _SDT_PROBE(provider, name, 3, (arg1, arg2, arg3)) +#define STAP_PROBE4(provider, name, arg1, arg2, arg3, arg4) \ + _SDT_PROBE(provider, name, 4, (arg1, arg2, arg3, arg4)) +#define STAP_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) \ + _SDT_PROBE(provider, name, 5, (arg1, arg2, arg3, arg4, arg5)) +#define STAP_PROBE6(provider, name, arg1, arg2, arg3, arg4, arg5, arg6) \ + _SDT_PROBE(provider, name, 6, (arg1, arg2, arg3, arg4, arg5, arg6)) +#define STAP_PROBE7(provider, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + _SDT_PROBE(provider, name, 7, (arg1, arg2, arg3, arg4, arg5, arg6, arg7)) +#define STAP_PROBE8(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \ + _SDT_PROBE(provider, name, 8, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) +#define STAP_PROBE9(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\ + _SDT_PROBE(provider, name, 9, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)) +#define STAP_PROBE10(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ + _SDT_PROBE(provider, name, 10, \ + (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)) +#define STAP_PROBE11(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \ + _SDT_PROBE(provider, name, 11, \ + (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)) +#define STAP_PROBE12(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \ + _SDT_PROBE(provider, name, 12, \ + (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12)) + +/* This STAP_PROBEV macro can be used in variadic scenarios, where the + number of probe arguments is not known until compile time. Since + variadic macro support may vary with compiler options, you must + pre-#define SDT_USE_VARIADIC to enable this type of probe. + + The trick to count __VA_ARGS__ was inspired by this post by + Laurent Deniau <laurent.deniau@cern.ch>: + http://groups.google.com/group/comp.std.c/msg/346fc464319b1ee5 + + Note that our _SDT_NARG is called with an extra 0 arg that's not + counted, so we don't have to worry about the behavior of macros + called without any arguments. */ + +#ifdef SDT_USE_VARIADIC +#define _SDT_NARG(...) __SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0) +#define __SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N +#define _SDT_PROBE_N(provider, name, N, ...) \ + _SDT_PROBE(provider, name, N, (__VA_ARGS__)) +#define STAP_PROBEV(provider, name, ...) \ + _SDT_PROBE_N(provider, name, _SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__) +#endif + +/* These macros are for use in asm statements. You must compile + with -std=gnu99 or -std=c99 to use the STAP_PROBE_ASM macro. + + The STAP_PROBE_ASM macro generates a quoted string to be used in the + template portion of the asm statement, concatenated with strings that + contain the actual assembly code around the probe site. + + For example: + + asm ("before\n" + STAP_PROBE_ASM(provider, fooprobe, %eax 4(%esi)) + "after"); + + emits the assembly code for "before\nafter", with a probe in between. + The probe arguments are the %eax register, and the value of the memory + word located 4 bytes past the address in the %esi register. Note that + because this is a simple asm, not a GNU C extended asm statement, these + % characters do not need to be doubled to generate literal %reg names. + + In a GNU C extended asm statement, the probe arguments can be specified + using the macro STAP_PROBE_ASM_TEMPLATE(n) for n arguments. The paired + macro STAP_PROBE_ASM_OPERANDS gives the C values of these probe arguments, + and appears in the input operand list of the asm statement. For example: + + asm ("someinsn %0,%1\n" // %0 is output operand, %1 is input operand + STAP_PROBE_ASM(provider, fooprobe, STAP_PROBE_ASM_TEMPLATE(3)) + "otherinsn %[namedarg]" + : "r" (outvar) + : "g" (some_value), [namedarg] "i" (1234), + STAP_PROBE_ASM_OPERANDS(3, some_value, some_ptr->field, 1234)); + + This is just like writing: + + STAP_PROBE3(provider, fooprobe, some_value, some_ptr->field, 1234)); + + but the probe site is right between "someinsn" and "otherinsn". + + The probe arguments in STAP_PROBE_ASM can be given as assembly + operands instead, even inside a GNU C extended asm statement. + Note that these can use operand templates like %0 or %[name], + and likewise they must write %%reg for a literal operand of %reg. */ + +#if __STDC_VERSION__ >= 199901L +# define STAP_PROBE_ASM(provider, name, ...) \ + _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (__VA_ARGS__)) \ + _SDT_ASM_BASE +# define STAP_PROBE_ASM_OPERANDS(n, ...) _SDT_ASM_OPERANDS_##n(__VA_ARGS__) +#else +# define STAP_PROBE_ASM(provider, name, args) \ + _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (args)) \ + _SDT_ASM_BASE +#endif +#define STAP_PROBE_ASM_TEMPLATE(n) _SDT_ASM_TEMPLATE_##n + + +/* DTrace compatible macro names. */ +#define DTRACE_PROBE(provider,probe) \ + STAP_PROBE(provider,probe) +#define DTRACE_PROBE1(provider,probe,parm1) \ + STAP_PROBE1(provider,probe,parm1) +#define DTRACE_PROBE2(provider,probe,parm1,parm2) \ + STAP_PROBE2(provider,probe,parm1,parm2) +#define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3) \ + STAP_PROBE3(provider,probe,parm1,parm2,parm3) +#define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ + STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) +#define DTRACE_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ + STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) +#define DTRACE_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ + STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) +#define DTRACE_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ + STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) +#define DTRACE_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ + STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) +#define DTRACE_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ + STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) +#define DTRACE_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ + STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) +#define DTRACE_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) \ + STAP_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) +#define DTRACE_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) \ + STAP_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) + + +#endif /* sys/sdt.h */ |