Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-93958

[QE Task] [GTS14] link fails when using -Wl,--as-needed [rhel-8.10.z]

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Undefined Undefined
    • rhel-8.10.z
    • None
    • gcc-toolset-14-gcc
    • None
    • 1
    • rhel-pt-gcc
    • ssg_platform_tools
    • PT GCC 2025 S07
    • 1
    • False
    • Hide

      None

      Show
      None
    • None

      What were you trying to do that didn't work?

      Run numpy tests building with GTS14 under python 3.13t

      Tests are failing when testing cpp extensions

      What is the impact of this issue to you?

      import numpy
      import extending_cpp
      ImportError: /tmp/pytest-of-root/pytest-0/popen-gw4/test_cython0/random/_examples/cython/build/extending_cpp.cpython-313t-aarch64-linux-gnu.so: undefined symbol: __gxx_personality_v0
      

      The issue comes from the usage of Wl,as-needed and is not seen at build time in this specific test because it also uses -Wl,-allow-shlib-undefined (needed for python extensions).

      Please provide the package NVR for which the bug is seen:

      gcc-toolset-14-libstdc++-devel-14.2.1-7.1.el8_10.aarch64

      How reproducible is this bug?:

      #!/bin/bash
      source /opt/rh/gcc-toolset-14/enable
      set -eux
      # g++ -v -o repro -x c++ -D_GLIBCXX_ASSERTIONS -fPIC -Wl,--as-needed -Wl,--trace-symbol,__gxx_personality_v0
      g++ -o repro -x c++ -D_GLIBCXX_ASSERTIONS -fPIC -Wl,--as-needed - << EOF
      #include <array>
      #include <cstdio>
      int main(int argc, char* argv[])
      {
        std::array<int, 3> a = {1, 2, 3};
        printf("repro %d\n", a[0]);
        return 0;
      }
      EOF
      ./repro
      

      Expected results

      Build passes & prints "repro 1"

      Actual results

      Build fails with undefined reference to `__gxx_personality_v0'

      Not sure wether this would be the right patch or not but worth at least mentioning:
      editing the file `/opt/rh/gcc-toolset-14/root/usr/lib/gcc/aarch64-redhat-linux/14/libstdc+.so` to add `/usr/lib64/libstdc+.so.6` once more works.

      /* GNU ld script
         Use the shared library, but some functions are only in
         the static library, so try that secondarily.  */
      OUTPUT_FORMAT(elf64-littleaarch64)
      INPUT ( /usr/lib64/libstdc++.so.6 -lstdc++_nonshared /usr/lib64/libstdc++.so.6 )
      

              rhn-support-vkadlcik Vaclav Kadlcik
              rhn-support-vkadlcik Vaclav Kadlcik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: