aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-02-20 23:26:21 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-02-20 23:26:21 +0000
commite5f623342307908840ee877ce406b0f266d8be50 (patch)
tree29e232c52ffb812fa09cd44e2a6ea1a6c4805832 /main/musl
parentd72fa832c799f40cddf2e76c6fe99957e759ef5f (diff)
downloadaports-e5f623342307908840ee877ce406b0f266d8be50.tar.bz2
aports-e5f623342307908840ee877ce406b0f266d8be50.tar.xz
main/musl: handle AT_BASE correctly with static PIE
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/APKBUILD5
-rw-r--r--main/musl/handle-aux-at_base.patch43
2 files changed, 47 insertions, 1 deletions
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index c3cb17f338..1c6afb7d2e 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.18
-pkgrel=7
+pkgrel=8
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -25,6 +25,8 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
2003-__lookup_serv-return-correct-error-code.patch
3002-stdio-implement-fopencookie-3.patch
+ handle-aux-at_base.patch
+
ldconfig
__stack_chk_fail_local.c
getconf.c
@@ -155,6 +157,7 @@ c28abac671f531d200bd1ebc934fc57b1c04404e49237dd6cfde4fe72e4fd8b855df0e75f76d62ec
2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
0155098b94b61e8d9f01ba1a8a80b9c030bf289f02d9e4db92b2638d0d3f589150fada1a6bdb97be14ca7bcca2221937826923343736303ebdb301b908db4d32 2003-__lookup_serv-return-correct-error-code.patch
bdc6fe197779088507d6f8bb72560239f908a635b39eb677bfcf91da28b92ee52b67696e627dad08ccb8a7dcaf7a72b574276098fb3fddd4a6b646a0f0799785 3002-stdio-implement-fopencookie-3.patch
+6a7ff16d95b5d1be77e0a0fbb245491817db192176496a57b22ab037637d97a185ea0b0d19da687da66c2a2f5578e4343d230f399d49fe377d8f008410974238 handle-aux-at_base.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
diff --git a/main/musl/handle-aux-at_base.patch b/main/musl/handle-aux-at_base.patch
new file mode 100644
index 0000000000..c16463824a
--- /dev/null
+++ b/main/musl/handle-aux-at_base.patch
@@ -0,0 +1,43 @@
+diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
+index b125eb1..616c6a6 100644
+--- a/src/env/__init_tls.c
++++ b/src/env/__init_tls.c
+@@ -66,8 +66,10 @@ void *__copy_tls(unsigned char *mem)
+ }
+
+ #if ULONG_MAX == 0xffffffff
++typedef Elf32_Ehdr Ehdr;
+ typedef Elf32_Phdr Phdr;
+ #else
++typedef Elf64_Ehdr Ehdr;
+ typedef Elf64_Phdr Phdr;
+ #endif
+
+@@ -77,15 +79,23 @@ extern const size_t _DYNAMIC[];
+ static void static_init_tls(size_t *aux)
+ {
+ unsigned char *p;
+- size_t n;
++ size_t n, e;
+ Phdr *phdr, *tls_phdr=0;
+ size_t base = 0;
+ void *mem;
+
+- for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) {
++ if (aux[AT_BASE]) {
++ Ehdr *ehdr = (void *)aux[AT_BASE];
++ p = (unsigned char *)aux[AT_BASE] + ehdr->e_phoff;
++ n = ehdr->e_phnum;
++ e = ehdr->e_phentsize;
++ } else {
++ p = (void *)aux[AT_PHDR];
++ n = aux[AT_PHNUM];
++ e = aux[AT_PHENT];
++ }
++ for (; n; n--, p+=e) {
+ phdr = (void *)p;
+- if (phdr->p_type == PT_PHDR)
+- base = aux[AT_PHDR] - phdr->p_vaddr;
+ if (phdr->p_type == PT_DYNAMIC && _DYNAMIC)
+ base = (size_t)_DYNAMIC - phdr->p_vaddr;
+ if (phdr->p_type == PT_TLS)