aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-09-07 05:20:23 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-09-07 05:20:23 +0000
commit77a633d389570f55d73c378fc621a0d32698cbcd (patch)
tree084f609d6c68faf06c5aef41ae2b8b683ba6e925 /main/musl
parentb50ff779d15c6267f4eb24d0374c8be8a29595b0 (diff)
downloadaports-77a633d389570f55d73c378fc621a0d32698cbcd.tar.bz2
aports-77a633d389570f55d73c378fc621a0d32698cbcd.tar.xz
main/musl: upgrade to 1.1.20
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/0001-fix-getopt-wrongly-treating-colons-in-optstring-as-v.patch30
-rw-r--r--main/musl/0002-fix-nl_langinfo_l-CODESET-loc-reporting-wrong-locale.patch29
-rw-r--r--main/musl/0003-fix-fmaf-wrong-result.patch35
-rw-r--r--main/musl/0004-implement-wcsftime-padding-specifier-extensions.patch63
-rw-r--r--main/musl/0005-fix-wrong-result-in-casin-and-many-related-complex-f.patch59
-rw-r--r--main/musl/0006-powerpc-update-hwcap.h-for-linux-v4.15.patch39
-rw-r--r--main/musl/APKBUILD22
-rw-r--r--main/musl/fix-TLS-layout-of-TLS-variant-I-when-there-is-gap-above-TP.patch293
8 files changed, 3 insertions, 567 deletions
diff --git a/main/musl/0001-fix-getopt-wrongly-treating-colons-in-optstring-as-v.patch b/main/musl/0001-fix-getopt-wrongly-treating-colons-in-optstring-as-v.patch
deleted file mode 100644
index f2c949ef6b..0000000000
--- a/main/musl/0001-fix-getopt-wrongly-treating-colons-in-optstring-as-v.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From b123f2395266a44176e49cee251fb776e97f26e1 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Sat, 24 Feb 2018 10:26:26 -0500
-Subject: [PATCH] fix getopt wrongly treating colons in optstring as valid
- option chars
-
-the ':' in optstring has special meaning as a flag applying to the
-previous option character, or to getopt's error handling behavior when
-it appears at the beginning. don't also accept a "-:" option based on
-its presence.
----
- src/misc/getopt.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/misc/getopt.c b/src/misc/getopt.c
-index e9bab41c..e921a60e 100644
---- a/src/misc/getopt.c
-+++ b/src/misc/getopt.c
-@@ -77,7 +77,7 @@ int getopt(int argc, char * const argv[], const char *optstring)
- if (l>0) i+=l; else i++;
- } while (l && d != c);
-
-- if (d != c) {
-+ if (d != c || c == ':') {
- optopt = c;
- if (optstring[0] != ':' && opterr)
- __getopt_msg(argv[0], ": unrecognized option: ", optchar, k);
---
-2.16.2
-
diff --git a/main/musl/0002-fix-nl_langinfo_l-CODESET-loc-reporting-wrong-locale.patch b/main/musl/0002-fix-nl_langinfo_l-CODESET-loc-reporting-wrong-locale.patch
deleted file mode 100644
index 2023daf26a..0000000000
--- a/main/musl/0002-fix-nl_langinfo_l-CODESET-loc-reporting-wrong-locale.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 0cf50581ec5f04feeaa77f2eb8b734a4b69ca8ed Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Wed, 7 Mar 2018 11:22:38 -0500
-Subject: [PATCH] fix nl_langinfo_l(CODESET, loc) reporting wrong locale's
- value
-
-use of MB_CUR_MAX encoded a hidden dependency on the currently active
-locale for the calling thread, whereas nl_langinfo_l is supposed to
-report for the locale passed as an argument.
----
- src/locale/langinfo.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/locale/langinfo.c b/src/locale/langinfo.c
-index b16caf44..83be6433 100644
---- a/src/locale/langinfo.c
-+++ b/src/locale/langinfo.c
-@@ -33,7 +33,7 @@ char *__nl_langinfo_l(nl_item item, locale_t loc)
- int idx = item & 65535;
- const char *str;
-
-- if (item == CODESET) return MB_CUR_MAX==1 ? "ASCII" : "UTF-8";
-+ if (item == CODESET) return loc->cat[LC_CTYPE] ? "UTF-8" : "ASCII";
-
- /* _NL_LOCALE_NAME extension */
- if (idx == 65535 && cat < LC_ALL)
---
-2.16.2
-
diff --git a/main/musl/0003-fix-fmaf-wrong-result.patch b/main/musl/0003-fix-fmaf-wrong-result.patch
deleted file mode 100644
index 1fdaf2571a..0000000000
--- a/main/musl/0003-fix-fmaf-wrong-result.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 282b1cd26649d69de038111f5876853df6ddc345 Mon Sep 17 00:00:00 2001
-From: Szabolcs Nagy <nsz@port70.net>
-Date: Sun, 1 Apr 2018 20:02:01 +0000
-Subject: [PATCH] fix fmaf wrong result
-
-if double precision r=x*y+z is not a half way case between two single
-precision floats or it is an exact result then fmaf returns (float)r.
-
-however the exactness check was wrong when |x*y| < |z| and could cause
-incorrectly rounded result in nearest rounding mode when r is a half
-way case.
-
-fmaf(-0x1.26524ep-54, -0x1.cb7868p+11, 0x1.d10f5ep-29)
-was incorrectly rounded up to 0x1.d117ap-29 instead of 0x1.d1179ep-29.
-(exact result is 0x1.d1179efffffffecp-29, r is 0x1.d1179fp-29)
----
- src/math/fmaf.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/math/fmaf.c b/src/math/fmaf.c
-index aa57feb6..80f5cd8a 100644
---- a/src/math/fmaf.c
-+++ b/src/math/fmaf.c
-@@ -50,7 +50,7 @@ float fmaf(float x, float y, float z)
- /* Common case: The double precision result is fine. */
- if ((u.i & 0x1fffffff) != 0x10000000 || /* not a halfway case */
- e == 0x7ff || /* NaN */
-- result - xy == z || /* exact */
-+ (result - xy == z && result - z == xy) || /* exact */
- fegetround() != FE_TONEAREST) /* not round-to-nearest */
- {
- /*
---
-2.17.0
-
diff --git a/main/musl/0004-implement-wcsftime-padding-specifier-extensions.patch b/main/musl/0004-implement-wcsftime-padding-specifier-extensions.patch
deleted file mode 100644
index 93eb7fb6de..0000000000
--- a/main/musl/0004-implement-wcsftime-padding-specifier-extensions.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From ea81529fb92932a50f06bf7a19cae812ae6cdb59 Mon Sep 17 00:00:00 2001
-From: Samuel Holland <samuel@sholland.org>
-Date: Sat, 7 Apr 2018 09:47:16 -0500
-Subject: [PATCH] implement wcsftime padding specifier extensions
-
-Commit 8a6bd7307da3fc4d08dd6a9277b611ccb4971354 added support for
-padding specifier extensions to strftime, but did not modify wcsftime.
-In the process, it added a parameter to __strftime_fmt_1 in strftime.c,
-but failed to update the prototype in wcsftime.c. This was found by
-compiling musl with LTO:
-
- src/time/wcsftime.c:7:13: warning: type of '__strftime_fmt_1' does \
- not match original declaration [-Wlto-type-mismatch]
-
-Fix the prototype of __strftime_fmt_1 in wcsftime.c, and generate the
-'pad' argument the same way as it is done in strftime.
----
- src/time/wcsftime.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/src/time/wcsftime.c b/src/time/wcsftime.c
-index 638e64f6..23500cc8 100644
---- a/src/time/wcsftime.c
-+++ b/src/time/wcsftime.c
-@@ -4,7 +4,7 @@
- #include "locale_impl.h"
- #include "libc.h"
-
--const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc);
-+const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc, int pad);
-
- size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
- {
-@@ -14,7 +14,7 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
- wchar_t *p;
- const char *t_mb;
- const wchar_t *t;
-- int plus;
-+ int pad, plus;
- unsigned long width;
- for (l=0; l<n; f++) {
- if (!*f) {
-@@ -26,6 +26,8 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
- continue;
- }
- f++;
-+ pad = 0;
-+ if (*f == '-' || *f == '_' || *f == '0') pad = *f++;
- if ((plus = (*f == '+'))) f++;
- width = wcstoul(f, &p, 10);
- if (*p == 'C' || *p == 'F' || *p == 'G' || *p == 'Y') {
-@@ -35,7 +37,7 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
- }
- f = p;
- if (*f == 'E' || *f == 'O') f++;
-- t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc);
-+ t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc, pad);
- if (!t_mb) break;
- k = mbstowcs(wbuf, t_mb, sizeof wbuf / sizeof *wbuf);
- if (k == (size_t)-1) return 0;
---
-2.17.0
-
diff --git a/main/musl/0005-fix-wrong-result-in-casin-and-many-related-complex-f.patch b/main/musl/0005-fix-wrong-result-in-casin-and-many-related-complex-f.patch
deleted file mode 100644
index d6326369dc..0000000000
--- a/main/musl/0005-fix-wrong-result-in-casin-and-many-related-complex-f.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From ae2a01da2e388535da243b3d974aef74a3c06ae0 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Mon, 9 Apr 2018 12:33:17 -0400
-Subject: [PATCH] fix wrong result in casin and many related complex functions
-
-the factor of -i noted in the comment at the top of casin.c was
-omitted from the actual code, yielding a result rotated 90 degrees and
-propagating into errors in other functions defined in terms of casin.
-
-implement multiplication by -i as a rotation of the real and imaginary
-parts of the result, rather than by actual multiplication, since the
-latter cannot be optimized without knowledge that the operand is
-finite. here, the rotation is the actual intent, anyway.
----
- src/complex/casin.c | 3 ++-
- src/complex/casinf.c | 3 ++-
- src/complex/casinl.c | 3 ++-
- 3 files changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/src/complex/casin.c b/src/complex/casin.c
-index dfdda988..01ed6184 100644
---- a/src/complex/casin.c
-+++ b/src/complex/casin.c
-@@ -12,5 +12,6 @@ double complex casin(double complex z)
- x = creal(z);
- y = cimag(z);
- w = CMPLX(1.0 - (x - y)*(x + y), -2.0*x*y);
-- return clog(CMPLX(-y, x) + csqrt(w));
-+ double complex r = clog(CMPLX(-y, x) + csqrt(w));
-+ return CMPLX(cimag(r), -creal(r));
- }
-diff --git a/src/complex/casinf.c b/src/complex/casinf.c
-index 93f0e335..4fcb76fc 100644
---- a/src/complex/casinf.c
-+++ b/src/complex/casinf.c
-@@ -10,5 +10,6 @@ float complex casinf(float complex z)
- x = crealf(z);
- y = cimagf(z);
- w = CMPLXF(1.0 - (x - y)*(x + y), -2.0*x*y);
-- return clogf(CMPLXF(-y, x) + csqrtf(w));
-+ float complex r = clogf(CMPLXF(-y, x) + csqrtf(w));
-+ return CMPLXF(cimagf(r), -crealf(r));
- }
-diff --git a/src/complex/casinl.c b/src/complex/casinl.c
-index 0916c60f..3b7ceba7 100644
---- a/src/complex/casinl.c
-+++ b/src/complex/casinl.c
-@@ -15,6 +15,7 @@ long double complex casinl(long double complex z)
- x = creall(z);
- y = cimagl(z);
- w = CMPLXL(1.0 - (x - y)*(x + y), -2.0*x*y);
-- return clogl(CMPLXL(-y, x) + csqrtl(w));
-+ long double complex r = clogl(CMPLXL(-y, x) + csqrtl(w));
-+ return CMPLXL(cimagl(r), -creall(r));
- }
- #endif
---
-2.17.0
-
diff --git a/main/musl/0006-powerpc-update-hwcap.h-for-linux-v4.15.patch b/main/musl/0006-powerpc-update-hwcap.h-for-linux-v4.15.patch
deleted file mode 100644
index 651d7c635c..0000000000
--- a/main/musl/0006-powerpc-update-hwcap.h-for-linux-v4.15.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 0fc2f098a496bc5c7379e2330421fcc86988c2ba Mon Sep 17 00:00:00 2001
-From: Szabolcs Nagy <nsz@port70.net>
-Date: Fri, 2 Feb 2018 20:38:15 +0000
-Subject: [PATCH] powerpc: update hwcap.h for linux v4.15
-
-PPC_FEATURE2_HTM_NO_SUSPEND is new in linux commit
-cba6ac4869e45cc93ac5497024d1d49576e82666
-PPC_FEATURE2_DARN and PPC_FEATURE2_SCV were new in v4.12 in commit
-a4700a26107241cc7b9ac8528b2c6714ff99983d
----
- arch/powerpc/bits/hwcap.h | 3 +++
- arch/powerpc64/bits/hwcap.h | 3 +++
- 2 files changed, 6 insertions(+)
-
-diff --git a/arch/powerpc/bits/hwcap.h b/arch/powerpc/bits/hwcap.h
-index 82c92a93..803de9b5 100644
---- a/arch/powerpc/bits/hwcap.h
-+++ b/arch/powerpc/bits/hwcap.h
-@@ -38,3 +38,6 @@
- #define PPC_FEATURE2_HTM_NOSC 0x01000000
- #define PPC_FEATURE2_ARCH_3_00 0x00800000
- #define PPC_FEATURE2_HAS_IEEE128 0x00400000
-+#define PPC_FEATURE2_DARN 0x00200000
-+#define PPC_FEATURE2_SCV 0x00100000
-+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
-diff --git a/arch/powerpc64/bits/hwcap.h b/arch/powerpc64/bits/hwcap.h
-index 82c92a93..803de9b5 100644
---- a/arch/powerpc64/bits/hwcap.h
-+++ b/arch/powerpc64/bits/hwcap.h
-@@ -38,3 +38,6 @@
- #define PPC_FEATURE2_HTM_NOSC 0x01000000
- #define PPC_FEATURE2_ARCH_3_00 0x00800000
- #define PPC_FEATURE2_HAS_IEEE128 0x00400000
-+#define PPC_FEATURE2_DARN 0x00200000
-+#define PPC_FEATURE2_SCV 0x00100000
-+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
---
-2.15.0
-
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index 796c4ae84d..4179769a00 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -1,8 +1,8 @@
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
-pkgver=1.1.19
-pkgrel=10
+pkgver=1.1.20
+pkgrel=0
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -14,18 +14,9 @@ nolibc) ;;
*) subpackages="$subpackages $pkgname-utils";;
esac
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
- 0001-fix-getopt-wrongly-treating-colons-in-optstring-as-v.patch
- 0002-fix-nl_langinfo_l-CODESET-loc-reporting-wrong-locale.patch
- 0003-fix-fmaf-wrong-result.patch
- 0004-implement-wcsftime-padding-specifier-extensions.patch
- 0005-fix-wrong-result-in-casin-and-many-related-complex-f.patch
- 0006-powerpc-update-hwcap.h-for-linux-v4.15.patch
-
2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
handle-aux-at_base.patch
- fix-TLS-layout-of-TLS-variant-I-when-there-is-gap-above-TP.patch
-
ldconfig
__stack_chk_fail_local.c
getconf.c
@@ -148,16 +139,9 @@ compat() {
done
}
-sha512sums="abee52d53af4b3c14c9088866c911a24d2b6ef67dc494f38a7a09dfe77250026f77528c24c52469c89cffa8ced2f0fa95badbdcf8d4460c90faba47e3927bcc5 musl-1.1.19.tar.gz
-7a6480c454ad25d156727818cf61961880e526abcb00382ed81e40256ac5b06af546837652e47187132d64c261d9f01ce91a952762afd439a8faf5825306a880 0001-fix-getopt-wrongly-treating-colons-in-optstring-as-v.patch
-1c649ebd4814ee22364d8766fdf93732e0c0c54361fcfcc994be254b52e9beb276fca5031a1cef9d4f971c96dc3d3774a1738ba3a38263d8e139ea3947c9b7c3 0002-fix-nl_langinfo_l-CODESET-loc-reporting-wrong-locale.patch
-b0bcfc837f888f2b1c2d65c06dcc0a2fa12da78986ba9c7c86a64123ce44c21a63c13c1cc2e93fdf564a3ca4472c29f0acabaff367914c52bf101d6d8a56ee2e 0003-fix-fmaf-wrong-result.patch
-1fedaf691ac394dec3158cff7839e36383d4107b59f003b75c8fb85a5fceb2143e2bb4aae58c08d68ccdf02d5ebf8c9e5031fa6063aa5c3112b4f8c66adab3dd 0004-implement-wcsftime-padding-specifier-extensions.patch
-6d7bbb493ccb7006270ace71266c0daf2c87842480f01cafb25609c9a3c77ae35934ee2a2bf00d78be8cce391204dcb9aba33e4d96dbf2a258595cf7a3939130 0005-fix-wrong-result-in-casin-and-many-related-complex-f.patch
-023fc05d653f4a3be4d16a2e223bddc26be7bc31c4decf3f5b9bed78cbe7bc8687ff8c164b94541f6fda66d6c3864dd42cb10920d066f97d2891e31a366c3e8d 0006-powerpc-update-hwcap.h-for-linux-v4.15.patch
+sha512sums="d3a7a30aa375ca50d7dcfbd618581d59e1aa5378417f50a0ca5510099336fd74cc9db468e05c93dda3067abd890f6bd47af226c3446bb833adf0a5054bff2e5d musl-1.1.20.tar.gz
2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
6a7ff16d95b5d1be77e0a0fbb245491817db192176496a57b22ab037637d97a185ea0b0d19da687da66c2a2f5578e4343d230f399d49fe377d8f008410974238 handle-aux-at_base.patch
-898507a75af05d960ac25343ac1ff026923a62f5095400fa3dcc650baf25b83cdff740da8a87fa6e40856227a44dcc469b78af6905e2f0e4f027abef5d3fad57 fix-TLS-layout-of-TLS-variant-I-when-there-is-gap-above-TP.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
diff --git a/main/musl/fix-TLS-layout-of-TLS-variant-I-when-there-is-gap-above-TP.patch b/main/musl/fix-TLS-layout-of-TLS-variant-I-when-there-is-gap-above-TP.patch
deleted file mode 100644
index ce82a6fd28..0000000000
--- a/main/musl/fix-TLS-layout-of-TLS-variant-I-when-there-is-gap-above-TP.patch
+++ /dev/null
@@ -1,293 +0,0 @@
-From 610c5a8524c3d6cd3ac5a5f1231422e7648a3791 Mon Sep 17 00:00:00 2001
-From: Szabolcs Nagy <nsz@port70.net>
-Date: Sat, 2 Jun 2018 01:52:01 +0200
-Subject: fix TLS layout of TLS variant I when there is a gap above TP
-
-In TLS variant I the TLS is above TP (or above a fixed offset from TP)
-but on some targets there is a reserved gap above TP before TLS starts.
-
-This matters for the local-exec tls access model when the offsets of
-TLS variables from the TP are hard coded by the linker into the
-executable, so the libc must compute these offsets the same way as the
-linker. The tls offset of the main module has to be
-
- alignup(GAP_ABOVE_TP, main_tls_align).
-
-If there is no TLS in the main module then the gap can be ignored
-since musl does not use it and the tls access models of shared
-libraries are not affected.
-
-The previous setup only worked if (tls_align & -GAP_ABOVE_TP) == 0
-(i.e. TLS did not require large alignment) because the gap was
-treated as a fixed offset from TP. Now the TP points at the end
-of the pthread struct (which is aligned) and there is a gap above
-it (which may also need alignment).
-
-The fix required changing TP_ADJ and __pthread_self on affected
-targets (aarch64, arm and sh) and in the tlsdesc asm the offset to
-access the dtv changed too.
-
-Patch-Source: https://git.musl-libc.org/cgit/musl/commit/?id=610c5a8524c3d6cd3ac5a5f1231422e7648a3791
-See-Also: https://github.com/rust-lang/rust/issues/48967
----
- arch/aarch64/pthread_arch.h | 5 +++--
- arch/aarch64/reloc.h | 2 +-
- arch/arm/pthread_arch.h | 7 ++++---
- arch/arm/reloc.h | 2 +-
- arch/mips/pthread_arch.h | 1 +
- arch/mips64/pthread_arch.h | 1 +
- arch/mipsn32/pthread_arch.h | 1 +
- arch/or1k/pthread_arch.h | 1 +
- arch/powerpc/pthread_arch.h | 1 +
- arch/powerpc64/pthread_arch.h | 1 +
- arch/sh/pthread_arch.h | 5 +++--
- arch/sh/reloc.h | 2 +-
- ldso/dynlink.c | 5 +++--
- src/env/__init_tls.c | 10 ++++++++--
- src/ldso/aarch64/tlsdesc.s | 5 ++---
- 15 files changed, 32 insertions(+), 17 deletions(-)
-
-diff --git a/arch/aarch64/pthread_arch.h b/arch/aarch64/pthread_arch.h
-index b2e2d8f..e8499d8 100644
---- a/arch/aarch64/pthread_arch.h
-+++ b/arch/aarch64/pthread_arch.h
-@@ -2,10 +2,11 @@ static inline struct pthread *__pthread_self()
- {
- char *self;
- __asm__ __volatile__ ("mrs %0,tpidr_el0" : "=r"(self));
-- return (void*)(self + 16 - sizeof(struct pthread));
-+ return (void*)(self - sizeof(struct pthread));
- }
-
- #define TLS_ABOVE_TP
--#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 16)
-+#define GAP_ABOVE_TP 16
-+#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
-
- #define MC_PC pc
-diff --git a/arch/aarch64/reloc.h b/arch/aarch64/reloc.h
-index 51b66e2..40cf0b2 100644
---- a/arch/aarch64/reloc.h
-+++ b/arch/aarch64/reloc.h
-@@ -10,7 +10,7 @@
-
- #define NO_LEGACY_INITFINI
-
--#define TPOFF_K 16
-+#define TPOFF_K 0
-
- #define REL_SYMBOLIC R_AARCH64_ABS64
- #define REL_GOT R_AARCH64_GLOB_DAT
-diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h
-index 6657e19..8f2ae8f 100644
---- a/arch/arm/pthread_arch.h
-+++ b/arch/arm/pthread_arch.h
-@@ -5,7 +5,7 @@ static inline pthread_t __pthread_self()
- {
- char *p;
- __asm__ __volatile__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
-- return (void *)(p+8-sizeof(struct pthread));
-+ return (void *)(p-sizeof(struct pthread));
- }
-
- #else
-@@ -21,12 +21,13 @@ static inline pthread_t __pthread_self()
- extern uintptr_t __attribute__((__visibility__("hidden"))) __a_gettp_ptr;
- register uintptr_t p __asm__("r0");
- __asm__ __volatile__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
-- return (void *)(p+8-sizeof(struct pthread));
-+ return (void *)(p-sizeof(struct pthread));
- }
-
- #endif
-
- #define TLS_ABOVE_TP
--#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
-+#define GAP_ABOVE_TP 8
-+#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
-
- #define MC_PC arm_pc
-diff --git a/arch/arm/reloc.h b/arch/arm/reloc.h
-index b175711..4b00bf6 100644
---- a/arch/arm/reloc.h
-+++ b/arch/arm/reloc.h
-@@ -16,7 +16,7 @@
-
- #define NO_LEGACY_INITFINI
-
--#define TPOFF_K 8
-+#define TPOFF_K 0
-
- #define REL_SYMBOLIC R_ARM_ABS32
- #define REL_GOT R_ARM_GLOB_DAT
-diff --git a/arch/mips/pthread_arch.h b/arch/mips/pthread_arch.h
-index e581265..5fea15a 100644
---- a/arch/mips/pthread_arch.h
-+++ b/arch/mips/pthread_arch.h
-@@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
- }
-
- #define TLS_ABOVE_TP
-+#define GAP_ABOVE_TP 0
- #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
-
- #define DTP_OFFSET 0x8000
-diff --git a/arch/mips64/pthread_arch.h b/arch/mips64/pthread_arch.h
-index e581265..5fea15a 100644
---- a/arch/mips64/pthread_arch.h
-+++ b/arch/mips64/pthread_arch.h
-@@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
- }
-
- #define TLS_ABOVE_TP
-+#define GAP_ABOVE_TP 0
- #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
-
- #define DTP_OFFSET 0x8000
-diff --git a/arch/mipsn32/pthread_arch.h b/arch/mipsn32/pthread_arch.h
-index e581265..5fea15a 100644
---- a/arch/mipsn32/pthread_arch.h
-+++ b/arch/mipsn32/pthread_arch.h
-@@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
- }
-
- #define TLS_ABOVE_TP
-+#define GAP_ABOVE_TP 0
- #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
-
- #define DTP_OFFSET 0x8000
-diff --git a/arch/or1k/pthread_arch.h b/arch/or1k/pthread_arch.h
-index 7decd76..521b9c5 100644
---- a/arch/or1k/pthread_arch.h
-+++ b/arch/or1k/pthread_arch.h
-@@ -12,6 +12,7 @@ static inline struct pthread *__pthread_self()
- }
-
- #define TLS_ABOVE_TP
-+#define GAP_ABOVE_TP 0
- #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
-
- #define MC_PC regs.pc
-diff --git a/arch/powerpc/pthread_arch.h b/arch/powerpc/pthread_arch.h
-index 7c5c4fa..79e5a09 100644
---- a/arch/powerpc/pthread_arch.h
-+++ b/arch/powerpc/pthread_arch.h
-@@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
- }
-
- #define TLS_ABOVE_TP
-+#define GAP_ABOVE_TP 0
- #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
-
- #define DTP_OFFSET 0x8000
-diff --git a/arch/powerpc64/pthread_arch.h b/arch/powerpc64/pthread_arch.h
-index 2f976fe..37b75e2 100644
---- a/arch/powerpc64/pthread_arch.h
-+++ b/arch/powerpc64/pthread_arch.h
-@@ -6,6 +6,7 @@ static inline struct pthread *__pthread_self()
- }
-
- #define TLS_ABOVE_TP
-+#define GAP_ABOVE_TP 0
- #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
-
- #define DTP_OFFSET 0x8000
-diff --git a/arch/sh/pthread_arch.h b/arch/sh/pthread_arch.h
-index 2756e7e..41fefac 100644
---- a/arch/sh/pthread_arch.h
-+++ b/arch/sh/pthread_arch.h
-@@ -2,10 +2,11 @@ static inline struct pthread *__pthread_self()
- {
- char *self;
- __asm__ __volatile__ ("stc gbr,%0" : "=r" (self) );
-- return (struct pthread *) (self + 8 - sizeof(struct pthread));
-+ return (struct pthread *) (self - sizeof(struct pthread));
- }
-
- #define TLS_ABOVE_TP
--#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
-+#define GAP_ABOVE_TP 8
-+#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
-
- #define MC_PC sc_pc
-diff --git a/arch/sh/reloc.h b/arch/sh/reloc.h
-index 0238ce0..a1f16cb 100644
---- a/arch/sh/reloc.h
-+++ b/arch/sh/reloc.h
-@@ -20,7 +20,7 @@
-
- #define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX ABI_SUFFIX
-
--#define TPOFF_K 8
-+#define TPOFF_K 0
-
- #define REL_SYMBOLIC R_SH_DIR32
- #define REL_OFFSET R_SH_REL32
-diff --git a/ldso/dynlink.c b/ldso/dynlink.c
-index cea5f45..c6216b7 100644
---- a/ldso/dynlink.c
-+++ b/ldso/dynlink.c
-@@ -1594,8 +1594,9 @@ _Noreturn void __dls3(size_t *sp)
- libc.tls_head = tls_tail = &app.tls;
- app.tls_id = tls_cnt = 1;
- #ifdef TLS_ABOVE_TP
-- app.tls.offset = 0;
-- tls_offset = app.tls.size
-+ app.tls.offset = GAP_ABOVE_TP;
-+ app.tls.offset += -GAP_ABOVE_TP & (app.tls.align-1);
-+ tls_offset = app.tls.offset + app.tls.size
- + ( -((uintptr_t)app.tls.image + app.tls.size)
- & (app.tls.align-1) );
- #else
-diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
-index 1c5d98a..31d324a 100644
---- a/src/env/__init_tls.c
-+++ b/src/env/__init_tls.c
-@@ -104,13 +104,19 @@ static void static_init_tls(size_t *aux)
-
- main_tls.size += (-main_tls.size - (uintptr_t)main_tls.image)
- & (main_tls.align-1);
-- if (main_tls.align < MIN_TLS_ALIGN) main_tls.align = MIN_TLS_ALIGN;
--#ifndef TLS_ABOVE_TP
-+#ifdef TLS_ABOVE_TP
-+ main_tls.offset = GAP_ABOVE_TP;
-+ main_tls.offset += -GAP_ABOVE_TP & (main_tls.align-1);
-+#else
- main_tls.offset = main_tls.size;
- #endif
-+ if (main_tls.align < MIN_TLS_ALIGN) main_tls.align = MIN_TLS_ALIGN;
-
- libc.tls_align = main_tls.align;
- libc.tls_size = 2*sizeof(void *) + sizeof(struct pthread)
-+#ifdef TLS_ABOVE_TP
-+ + main_tls.offset
-+#endif
- + main_tls.size + main_tls.align
- + MIN_TLS_ALIGN-1 & -MIN_TLS_ALIGN;
-
-diff --git a/src/ldso/aarch64/tlsdesc.s b/src/ldso/aarch64/tlsdesc.s
-index 8ed5c26..8e4004d 100644
---- a/src/ldso/aarch64/tlsdesc.s
-+++ b/src/ldso/aarch64/tlsdesc.s
-@@ -14,7 +14,7 @@ __tlsdesc_static:
- // size_t __tlsdesc_dynamic(size_t *a)
- // {
- // struct {size_t modidx,off;} *p = (void*)a[1];
--// size_t *dtv = *(size_t**)(tp + 16 - 8);
-+// size_t *dtv = *(size_t**)(tp - 8);
- // if (p->modidx <= dtv[0])
- // return dtv[p->modidx] + p->off - tp;
- // return __tls_get_new(p) - tp;
-@@ -28,8 +28,7 @@ __tlsdesc_dynamic:
- mrs x1,tpidr_el0 // tp
- ldr x0,[x0,#8] // p
- ldr x2,[x0] // p->modidx
-- add x3,x1,#8
-- ldr x3,[x3] // dtv
-+ ldr x3,[x1,#-8] // dtv
- ldr x4,[x3] // dtv[0]
- cmp x2,x4
- b.hi 1f
---
-cgit v0.11.2
-