summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-02-17 20:48:28 +0200
committerLasse Collin <lasse.collin@tukaani.org>2023-03-11 21:45:26 +0200
commit3cc8ece2dcd7bd60835b4a7b0619254d9f75e164 (patch)
tree11b06ccd9eae8f27ef5c5f5353f3f781b3112a61
parent050c6dbf96b15dc3b546589e554e0abc83e19816 (diff)
downloadxz-3cc8ece2dcd7bd60835b4a7b0619254d9f75e164.tar.gz
Build: Use only the generic symbol versioning on MicroBlaze.
On MicroBlaze, GCC 12 is broken in sense that __has_attribute(__symver__) returns true but it still doesn't support the __symver__ attribute even though the platform is ELF and symbol versioning is supported if using the traditional __asm__(".symver ...") method. Avoiding the traditional method is good because it breaks LTO (-flto) builds with GCC. See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766 For now the only extra symbols in liblzma_linux.map are the compatibility symbols with the patch that spread from RHEL/CentOS 7. These require the use of __symver__ attribute or __asm__(".symver ...") in the C code. Compatibility with the patch from CentOS 7 doesn't seem valuable on MicroBlaze so use liblzma_generic.map on MicroBlaze instead. It doesn't require anything special in the C code and thus no LTO issues either. An alternative would be to detect support for __symver__ attribute in configure.ac and CMakeLists.txt and fall back to __asm__(".symver ...") but then LTO would be silently broken on MicroBlaze. It sounds likely that MicroBlaze is a special case so let's treat it as a such because that is simpler. If a similar issue exists on some other platform too then hopefully someone will report it and this can be reconsidered. (This doesn't do the same fix in CMakeLists.txt. Perhaps it should but perhaps CMake build of liblzma doesn't matter much on MicroBlaze. The problem breaks the build so it's easy to notice and can be fixed later.) Thanks to Vincent Fazio for reporting the problem and proposing a patch (in the end that solution wasn't used): https://github.com/tukaani-project/xz/pull/32
-rw-r--r--configure.ac12
1 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index dfec76c..b90a58e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -664,8 +664,16 @@ elif test "x$enable_shared" = xno ; then
enable_symbol_versions=no
AC_MSG_RESULT([no (not building a shared library)])
else
- case $host_os in
- linux*)
+ case "$host_cpu-$host_os" in
+ microblaze*)
+ # GCC 12 on MicroBlaze doesn't support __symver__
+ # attribute. It's simplest and safest to use the
+ # generic version on that platform since then only
+ # the linker script is needed. The RHEL/CentOS 7
+ # compatibility symbols don't matter on MicroBlaze.
+ enable_symbol_versions=generic
+ ;;
+ *-linux*)
case "$pic_mode-$enable_static" in
default-*)
# Use symvers if PIC is defined.