Skip to content

Instantly share code, notes, and snippets.

@makotom
Created May 17, 2021 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makotom/f80c83cddd054c774be25b21a4a85dbe to your computer and use it in GitHub Desktop.
Save makotom/f80c83cddd054c774be25b21a4a85dbe to your computer and use it in GitHub Desktop.
Patches to 1) avert bugs in vDSO of WSL1, and 2) build it with the default makepkg.conf
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
index 144dc5ce5a..4328a9c4cc 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
@@ -44,7 +44,7 @@ int
attribute_hidden
_dl_discover_osversion (void)
{
-#if defined NEED_DL_SYSINFO_DSO && defined SHARED
+#if defined NEED_DL_SYSINFO_DSO && defined SHARED && 0
if (GLRO(dl_sysinfo_map) != NULL)
{
/* If the kernel-supplied DSO contains a note indicating the kernel's
diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 76516184b49..a3b73c8f210 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -24,7 +24,8 @@ source=(https://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.xz{,.sig}
bz27343.patch
0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch
0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch
- 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch)
+ 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch
+ force-uname.patch)
validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8 # Carlos O'Donell
BC7C7372637EC10C57D7AA6579C43DFBF1CF2187) # Siddhesh Poyarekar
md5sums=('390bbd889c7e8e8a7041564cb6b27cca'
@@ -37,7 +38,8 @@ md5sums=('390bbd889c7e8e8a7041564cb6b27cca'
'cfe57018d06bf748b8ca1779980fef33'
'78f041fc66fee4ee372f13b00a99ff72'
'9e418efa189c20053e887398df2253cf'
- '7a09f1693613897add1791e7aead19c9')
+ '7a09f1693613897add1791e7aead19c9'
+ '0f99f2c9989dc1ae3fdf89e57c870f28')
prepare() {
mkdir -p glibc-build lib32-glibc-build
@@ -56,6 +58,9 @@ prepare() {
# nptl: Do not build nptl/tst-pthread-gdb-attach as PIE
patch -p1 -i "$srcdir"/0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch
+
+ # Use uname, instead of DSO, to check kernel version
+ patch -p1 -i "$srcdir"/force-uname.patch
}
build() {
@@ -86,6 +91,8 @@ build() {
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
+ export CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2,/}
+ export CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2,/}
#
CFLAGS=${CFLAGS/-fno-plt/}
@@ -122,6 +129,8 @@ build() {
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
+ export CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2,/}
+ export CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2,/}
CFLAGS=${CFLAGS/-fno-plt/}
CXXFLAGS=${CXXFLAGS/-fno-plt/}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment