-
Notifications
You must be signed in to change notification settings - Fork 273
Conversation
jim-wilson
commented
Jan 23, 2018
* config/riscv/riscv.c (riscv_legitimize_tls_address): Ifdef out code to force TLS_MODEL_LOCAL_EXEC when !flag_pic.
Do not merge. This is just for informational purposes. The glibc testsuite tst-tls12 testcase fails because TLS copy relocs aren't working. We can make it work by disabling a compiler optimization. |
The real problem has finally been identified. The linker is not allocating memory space for the tdata.dyn section. This is a binutils bug, and an initial patch has been added, rendering this moot. |
Please disable this feature. It doubles memory usage per thread of each TLS object affected by it and has no benefit. |
this is binutils issue 23825, but it's caused by gcc using local-exec model rather than initial-exec model with the intent of making binutils generate copy relocations. this is harmful, unnecessary, and not presently supported by musl (and probably should never be). patch taken from riscvarchive/riscv-gcc#118.
And as I just noted in https://sourceware.org/bugzilla/show_bug.cgi?id=23825, it breaks the ability to have extensible structs/arrays in shared library TLS (because copy relocations always break this). |
This is being discussed in |
Just a reminder. @jim-wilson Will you send a patch to upstream GCC? |
I'm testing a patch now. |
I committed the patch upstream. |
Squashed commit of the following: commit 5086175 Author: Peter Jin <peterhaijin@gmail.com> Date: Fri Mar 6 23:12:57 2020 -0500 allow sha1 hash checking command to be configured commit a54eb56 Author: Filippo Valsorda <1225294+FiloSottile@users.noreply.github.com> Date: Sat Mar 7 16:32:46 2020 -0500 Use CURDIR instead of PWD PWD is set by the shell, not make, and might not match. For example, this broke the build through Homebrew, because PWD stays at the directory where brew is ran. commit aacd84e Author: Rich Felker <dalias@aerifal.cx> Date: Mon Feb 24 21:57:15 2020 -0500 update cowpatch from upstream to fix regression on bash upstream commit 1db812b0ca94d07ede9891883484f2a76dae8e23 commit 75e6c61 Author: Rich Felker <dalias@aerifal.cx> Date: Fri Feb 21 23:52:34 2020 -0500 add musl 1.2.0 and make it default commit a69bac0 Author: Rich Felker <dalias@aerifal.cx> Date: Mon Feb 17 15:10:44 2020 -0500 use new cowpatch -I command rather than open-coding same thing in Makefile commit 6b7083f Author: Rich Felker <dalias@aerifal.cx> Date: Mon Feb 17 15:08:10 2020 -0500 update cowpatch.sh from upstream upstream commit b3a885f71ce31dff0c60dab6f5b6cb5ded4c9fb4 commit b49456e Author: Rich Felker <dalias@aerifal.cx> Date: Mon Feb 10 12:18:24 2020 -0500 fix gcc 8+ static pie patches to make -static-pie pass -static to ld previously this was missed because there's target-specific spec magic for a few targets to do it, but many including arm don't have it. without this, use of -static-pie produces broken binaries which lack an interpreter but link to shared libraries on the targets affected. use of -static -pie (preferred form) is not affected. gcc versions prior to 8.x did not have -static-pie (because there was no upstream static pie support) so this patch is only needed for 8+, and only to prevent breakage if someone uses the -static-pie option instead of -static with -pie. commit d7f31bd Author: Rich Felker <dalias@aerifal.cx> Date: Mon Feb 3 14:27:19 2020 -0500 pass --disable-assembly to gcc configure, for gmp gmp does not build correctly with compilers that default to emitting PIE/PIC, due to custom-preprocessed asm source files which have wrong logic for determining if PIC-compatibility is needed. ideally this would be patched in gmp, but I don't know how to do that, so for the time being, just disable the asm. commit 97b7d13 Author: Rich Felker <dalias@aerifal.cx> Date: Mon Feb 3 01:09:08 2020 -0500 force cross compiler/cross compiling now that config.guess knows how to detect musl, it's possible when building on a musl-based system that $build will spuriously match $target, preventing the desired behavior of building as a cross compiler or as a cross-compiled native compiler. run config.guess and config.sub from the litecross makefile to check if $build is going to match $target, and if so, append junk to the libc/abi part of the $build tuple so that it no longer matches. commit 463cd3e Author: Rich Felker <dalias@aerifal.cx> Date: Mon Feb 3 01:07:22 2020 -0500 pass --disable-bootstrap to gcc this should be a nop since we're either building a cross compiler or cross compiling, but due to recent gcc's config.guess detecting musl, it's possible to spuriously get $build=$host=$target, and then the dreaded bootstrap procedure runs and breaks the output. commit 03b296f Author: Rich Felker <dalias@aerifal.cx> Date: Sun Feb 2 23:35:52 2020 -0500 fix missing exec permissions on replaced config.sub commit b397087 Author: Rich Felker <dalias@aerifal.cx> Date: Sun Feb 2 21:24:08 2020 -0500 add some more things you can turn off to config.mak.dist examples commit a00f88f Author: Rich Felker <dalias@aerifal.cx> Date: Sun Feb 2 21:21:18 2020 -0500 clarify that --enable-languages=c,c++ is default in config.mak.dist commit 2954bf4 Author: Rich Felker <dalias@aerifal.cx> Date: Sun Feb 2 21:19:25 2020 -0500 remove --disable-multilib from config.mak.dist example this is now mandatory and always passed to configure commit 59d9dff Author: Rich Felker <dalias@aerifal.cx> Date: Fri Jan 31 16:53:24 2020 -0500 improve patch dependency rules approach in commit 8a92c52 only worked for the "current version" of the packages configured with GCC_VER, etc. now, all versions have proper dependencies so that it's possible to test applicability of new patches just by running make with the directory name. commit 9515af5 Author: Rich Felker <dalias@aerifal.cx> Date: Fri Jan 31 16:33:42 2020 -0500 add binutils patches for pr22269 needed to fix static pie linking bugs on arm. commit 3cfbdab Author: Rich Felker <dalias@aerifal.cx> Date: Thu Jan 30 22:11:51 2020 -0500 add asound uapi patches for linux 4.19.90, headers-4.19.88 these are needed for time64 compatibility, and are backported from the y2038-endgame kernel branch and squashed with non-uapi changes removed. with just these patches applied the kernel will not build since changes at the source level are also needed. but it is not practical to backport source changes to an old kernel, and even if it were, it would not make sense to include irrelevant changes that need rebasing in a patchset intended only for the purpose of uapi header installation. commit 6a73704 Author: Rich Felker <dalias@aerifal.cx> Date: Thu Jan 30 22:09:15 2020 -0500 re-add archscripts removal patch for linux 4.19.90 forward-ported from the now-removed 4.4.10 patch, needed to fix #8, spurious dependency on host elf.h header. I checked x86 and mips which seem to be the only archs with archscripts rules, and these rules have nothing to do with building headers, so omitting them should still be safe. commit 1645ae3 Author: Rich Felker <dalias@aerifal.cx> Date: Thu Jan 30 22:08:34 2020 -0500 remove support for old linux headers these can no longer be supported since they are incompatible with time64. commit 1956817 Author: Rich Felker <dalias@aerifal.cx> Date: Wed Jan 29 23:06:02 2020 -0500 fix wrong ac_cv_prog_lex_root value the value should only be the root, not including the .c suffix. as noted in commit 2d0015f which added this, the result is not actually used, so it doesn't matter that it's wrong, but the wrong value produces spurious error output in configure logs. commit 03d6d75 Author: Rich Felker <dalias@aerifal.cx> Date: Thu Jan 23 19:38:10 2020 -0500 add patch fixing gcc pr93402 (wrong codegen) affects all gcc versions 6.x and later. same patch works for all. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93402 commit de5dc21 Author: Rich Felker <dalias@aerifal.cx> Date: Thu Jan 23 13:21:24 2020 -0500 add safety in make rules involving rm -rf error out if there are any slashes in the name that will later be passed to rm -rf since these are implicit rules and could theoretically get instantiated in unintended ways. commit eb979cc Author: Rich Felker <dalias@aerifal.cx> Date: Thu Jan 23 13:18:17 2020 -0500 remove old patched source dir before trying to rename new one over it commit 1be04b5 Author: Rich Felker <dalias@aerifal.cx> Date: Wed Jan 22 17:26:56 2020 -0500 move config.sub dependency to patched source trees instead of orig ones this was overlooked when cowpatch was introduced. commit 8a92c52 Author: Rich Felker <dalias@aerifal.cx> Date: Wed Jan 22 17:25:53 2020 -0500 add dependencies on patches for patched/patchable source trees commit a226f5f Author: Travis Cross <tc@traviscross.com> Date: Wed Jan 22 20:01:49 2020 +0000 Fix initialization of CoW source trees As part of creating a CoW source tree, we symlink all top-level paths from the original directory. In commit ebf9303, we removed a shell glob used for this and replaced it with an invocation of `find`. However, our invocation of `find ... -exec sh -c '... $@ ...' {} \+` is causing the first path in every directory to be skipped, breaking the build. This is because arguments to `sh -c ...` begin with the zeroth argument, while `$@` only returns the first argument onward. Let's fix this by providing an explicit zeroth argument to `sh -c`. commit 1e4e952 Author: Rich Felker <dalias@aerifal.cx> Date: Wed Jan 22 01:13:14 2020 -0500 bump default gcc version to 9.2.0 commit 8adcc4b Author: Rich Felker <dalias@aerifal.cx> Date: Wed Jan 22 00:03:07 2020 -0500 bump default binutils version to 2.33.1 commit 3d26f0c Author: Rich Felker <dalias@aerifal.cx> Date: Wed Jan 22 00:02:12 2020 -0500 add binutils 2.33.1 included are new or1k support patches that are not easily backported to earlier versions. commit ebf9303 Author: Rich Felker <dalias@aerifal.cx> Date: Tue Jan 21 23:49:56 2020 -0500 make initialization of cow source trees robust shell glob of ../$</* fails to catch filenames beginning with dot, and the easy mitigations for that all produce bad results on non-match. use find to do it robustly. commit 49f489e Author: Rich Felker <dalias@aerifal.cx> Date: Tue Jan 21 19:39:04 2020 -0500 remove support for non-latest versions in gcc 6 and 7 series commit c755705 Author: Rich Felker <dalias@aerifal.cx> Date: Tue Jan 21 02:49:07 2020 -0500 integrate cowpatch for preservation of original source trees this makes it far easier to iterate testing of patches, and sets the stage for enforcing re-patching with makefile-level dependencies. the pristine sources are kept in directories suffixed with ".orig", and the unsuffixed directory now contains the result of running cowpatch -- that is, a mix of symlinks to the original files, and modified copies of the files/directories affected by patches. commit 431a47a Author: Rich Felker <dalias@aerifal.cx> Date: Tue Jan 21 00:07:40 2020 -0500 add gcc patch fixing libstdc++ futex use for time64 compatibility this is not the cleanest fix but should at least make it non-broken. commit 33fb24c Author: Travis Cross <tc@traviscross.com> Date: Mon Jan 6 01:08:55 2020 +0000 Add license file and copyright notes After discussion with Rich Felker and other contributors, it's clear that we want to license this project under the MIT/Expat license. However, we need to be clear that we're not claiming to license the binary artifacts, as those retain the licenses of the upstream projects. Similarly, the patches, to the extent that there is any copyright interest in them at all, retain the licenses from the upstream projects. We've added language in the README and in a new `COPYRIGHT` file to make all of this clear. Ref: #25 #30 #80 commit c9d96ae Author: Rich Felker <dalias@aerifal.cx> Date: Sun Jan 19 12:40:04 2020 -0500 work around gcc libstdc++ time64 incompatibility with the default --enable-libstdcxx-time, libstdc++'s configure probes for the existence of a clock_gettime syscall and sets up the time API implementation to make direct syscalls, presumably as a workaround for old glibc tucking away the clock_gettime function in librt, which in turn depends on libpthread. this breaks since struct timespec does not match the syscall's interface on 32-bit archs. passing --enable-libstdcxx-time=rt forces different configure paths that correctly use the public clock_gettime function and librt if needed. this issue should be patched in gcc rather than worked around via configure options, but I'd rather wait to patch until I understand how to fix it correctly and produce a patch that's acceptable to upstream and distros. commit 38e52db Author: Rich Felker <dalias@aerifal.cx> Date: Wed Dec 18 14:29:07 2019 -0500 switch linux kernel headers to 4.19.88 by default using slim headers-only version. this change is needed to support all future versions of musl on 32-bit archs, since prior to 4.16 the kernel headers had incompatibility with userspace time_t not matching the kernel's old (32-bit) time_t. support for older headers will be dropped entirely soon. commit 5c7b663 Author: Rich Felker <dalias@aerifal.cx> Date: Wed Dec 18 14:23:28 2019 -0500 add support for linux 4.19 kernel headers both 4.19.90 from official kernel tarball and 4.19.88 from the sabotage-linux headers-only package are added. the latter should be preferred unless you have a reason not to, as it's much smaller and has some patches that improve interaction with musl. support for all earlier kernel header versions will be dropped soon, since everything prior to 4.16 has incompatibilities with 32-bit archs moving to time64. commit a6d3e61 Author: Rich Felker <dalias@aerifal.cx> Date: Tue Nov 19 13:31:33 2019 -0500 mention riscv64 target support in README.md commit 52527c4 Author: Rich Felker <dalias@aerifal.cx> Date: Tue Nov 19 08:50:58 2019 -0500 add patch fixing copy relocs issue on riscv this is binutils issue 23825, but it's caused by gcc using local-exec model rather than initial-exec model with the intent of making binutils generate copy relocations. this is harmful, unnecessary, and not presently supported by musl (and probably should never be). patch taken from riscvarchive/riscv-gcc#118. commit a9a3b3a Author: Andrew Chambers <ac@acha.ninja> Date: Sat Jul 20 00:55:59 2019 +1200 Remove absolute references to pwd in linux headers. Some distributions don't have pwd at this path. commit 90ecfe0 Author: Rich Felker <dalias@aerifal.cx> Date: Sun Nov 10 20:19:00 2019 -0500 renumber latest gcc 8.3.0 patch so as not to duplicate numbering commit 9e06392 Author: Rich Felker <dalias@aerifal.cx> Date: Sun Nov 10 20:13:42 2019 -0500 add gcc 9.2.0 hash and patches patches from Szabolcs Nagy's patchset, carried forward from 8.x with minimal changes, with #0014 added from recent additions not reflected. commit 6725d1e Author: Rich Felker <dalias@aerifal.cx> Date: Sun Nov 10 12:34:26 2019 -0500 update default musl version to 1.1.24 commit cd7430c Author: Rich Felker <dalias@aerifal.cx> Date: Sun Nov 10 12:33:53 2019 -0500 add support for musl 1.1.23 and 1.1.24 omission at the time of releases was purely an oversight. commit 02be46d Author: Rich Felker <dalias@aerifal.cx> Date: Sun Oct 6 23:36:25 2019 -0400 add patches fixing ld bug linking arm tlsdesc relocs on 64-bit host this is binutils issue #25062. without it, cross-ld crashes linking arm programs using tlsdesc if the host is 64-bit. commit 684cb17 Author: Rich Felker <dalias@aerifal.cx> Date: Sun Oct 6 20:47:22 2019 -0400 update arm static pie TLS relocs patch to upstream version, backport commit c9ac087 omitted a few changes, resulting in spurious NONE-type relocs and possibly other problems. update patches to match upstream fix. commit c9ac087 Author: Rich Felker <dalias@aerifal.cx> Date: Wed Oct 2 10:39:26 2019 -0400 add binutils patch to fix broken arm LD/GD TLS relocs in static PIE this is the same issue fixed for mips in 0004-mips-pie-tls.diff for 2.27, upstream in 2.32. commit 5fd2126 Author: Rich Felker <dalias@aerifal.cx> Date: Tue Sep 24 19:19:23 2019 -0400 add patches fixing broken libgcc multi-thread detection via weak refs tested to apply successfully to all supported gcc versions except possibly 4.2.1, for which it is not added yet. commit bda7102 Author: rofl0r <rofl0r@users.noreply.github.com> Date: Sat Aug 17 03:20:47 2019 +0100 add support for sabotage-linux' kernel-headers tarballs as maintained in https://github.com/sabotage-linux/kernel-headers . downloading (and extracting) a 100+ MB kernel source tarball just for the headers is extremely inefficient. sabotage linux' kernel-headers tarball provides the same (including musl compatibility fixes) in ~800 KB. in order to use it, specify LINUX_VER = headers-4.4.2-4 in your config.mak. if LINUX_VER lacks the "headers-" prefix, the official source tarball will be downloaded as usual. commit d969dea Author: Rich Felker <dalias@aerifal.cx> Date: Tue Jul 16 15:02:31 2019 -0400 make --disable-separate-code the default for binutils the default is ordered such that user-provided config variables in config.mak or on the make command line can still override it. this is a dubious anti-ROP feature with high cost (file size, load time, VMA count consumed per library), and historically was broken in some binutils versions. the ones we use don't seem to be affected, but it's better to have it off anyway. commit b4a38f8 Author: Rich Felker <dalias@aerifal.cx> Date: Tue Jul 16 13:41:33 2019 -0400 update default versions of gcc-dependency math libraries commit 708132a Author: Kevin Mark <kmark937@gmail.com> Date: Sun Jun 30 23:38:57 2019 -0400 Support MPC 1.1.0 commit 5c552fe Author: Kevin Mark <kmark937@gmail.com> Date: Sun Jun 30 23:49:21 2019 -0400 Support MPFR 4.0.2 commit fc0c061 Author: Kevin Mark <kmark937@gmail.com> Date: Sun Jun 30 23:47:27 2019 -0400 Support ISL 0.21 commit 0d2b46b Author: Kevin Mark <kmark937@gmail.com> Date: Sun Jun 30 23:24:26 2019 -0400 Support GMP 6.1.2 commit 38f8d54 Author: Kevin Mark <kmark937@gmail.com> Date: Sun Jun 30 23:21:08 2019 -0400 Add ISL and build directories to .gitignore commit b5b4d47 Author: Rich Felker <dalias@aerifal.cx> Date: Sun May 26 19:25:39 2019 -0400 update defaults to gcc 8.3.0, binutils 2.32 commit 6291898 Author: Rich Felker <dalias@aerifal.cx> Date: Sun May 26 15:23:16 2019 -0400 add binutils 2.32 hash and patches commit 1878d65 Author: Rich Felker <dalias@aerifal.cx> Date: Sun May 26 15:22:55 2019 -0400 add gcc 8.3.0 hash and patches commit fa132e0 Author: rofl0r <retnyg@gmx.net> Date: Sun Feb 17 14:11:46 2019 +0000 binutils 2.27: add patch so reproducible builds work even on mips commit f37089a Author: Rich Felker <dalias@aerifal.cx> Date: Tue Apr 9 21:11:10 2019 -0400 add musl 1.1.22, make default version commit 7ea4872 Author: rofl0r <retnyg@gmx.net> Date: Wed Oct 31 19:01:50 2018 +0000 add support for GCC 6.5.0 new patch: 0017-c++-abi-break.diff fixes a C++ ABI break regression. 0010-static-pie-support.diff was removed as it doesn't apply anymore, and forward-porting it requires arcane knowledge of GCC details. the patches 0018 and 0019 have been copied from GCC 7.3.0. the static pie patch from GCC 6.4.0, renumbered 0020, depends on the reversions they make. commit a14e91f Author: Michael Forney <mforney@mforney.org> Date: Mon Nov 5 22:36:55 2018 -0800 litecross: Pass --enable-deterministic-archives to binutils, not gcc When the gcc and binutils build trees were separated in defdbb4, --enable-deterministic-archives was accidentally left in FULL_GCC_CONFIG. This had the effect of reverting commit e83fe4b, breaking reproducible builds (unless it was specified explicitly in config.mak). commit 96bd58c Author: Rich Felker <dalias@aerifal.cx> Date: Mon Jan 21 13:20:24 2019 -0500 update default musl version to 1.1.21 commit 9b8fcbc Author: Rich Felker <dalias@aerifal.cx> Date: Mon Jan 21 13:19:50 2019 -0500 add hash for support of musl 1.1.21 commit 040804d Author: midipix <writeonce@midipix.org> Date: Tue Oct 30 22:35:07 2018 -0400 remove explicit target definitions for gmp, mpfr, and mpc. Originally added in commit 40d6414, the purpose of the above target definitions was to allow using the static-only symlink variant of slibtool (i.e. slibtool-static) in those build steps which required it. Given slibtool's newly added ability to auto-detect its desired operation mode (shared-only, static-only, or both), as well as the integration of rlibtool support in mcm, the aforementioned explicit target definitions are no longer needed. commit 0b2487e Author: midipix <writeonce@midipix.org> Date: Mon Oct 29 23:01:00 2018 -0400 slibtool support: remove the LIBTOOL_STATIC_ARG var (no longer needed). Beginning with slibtool version 0.5.26 and the introduction of the rlibtool symlink (the equivalent of slibtool --heuristics), slibtool may now be told to automatically detect its desired operation mode (share-only, static-only, or both) by way of parsing the generated libtool script which it replaces. commit edc9d8e Author: rofl0r <retnyg@gmx.net> Date: Wed Oct 31 19:16:34 2018 +0000 fix file extension of 2 patches closes #54 commit 474a7e0 Author: rofl0r <retnyg@gmx.net> Date: Wed Oct 31 19:11:37 2018 +0000 GCC 5.3.0: fix filenames in 0008-shsibcall.diff as reported in #15, some patch programs choke on the comments after the filename... commit e3e354f Author: Rich Felker <dalias@aerifal.cx> Date: Tue Sep 25 13:52:59 2018 -0400 add patches to fix invalid tls-model usage in gcc target libs the initial-exec tls model is not valid in any code that might be dynamically loaded. it usually happens to work on glibc because glibc reserves some static tls space for late-loaded libraries that need it, but if it's already been exhausted that will fail. musl does not support this hack at all, and it's not valid for gcc target libs to be doing it anywhere, so patch it out entirely rather than just for musl. commit b0d7c70 Author: Rich Felker <dalias@aerifal.cx> Date: Tue Sep 25 13:50:37 2018 -0400 move support for non-latest versions in gcc 5 and 6 series this is to prevent unbounded growth of patch sets to be maintained and backported to. commit 9f50217 Author: luca <681992+lukka@users.noreply.github.com> Date: Wed Sep 5 00:16:27 2018 -0700 add sha1 for musl 1.1.20 commit fdf772b Author: Rich Felker <dalias@aerifal.cx> Date: Tue Sep 4 15:13:33 2018 -0400 update musl version to 1.1.20