[PATCH] D45508: Implement --ctors-in-init-array.

Harmen Stoppels via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 06:08:37 PDT 2022


haampie added a comment.
Herald added a subscriber: StephenFan.
Herald added a project: All.

Would be nice to have this (enabled by default, like in `binutils ld`), since due to an oversight, GCC 12 is the first GCC to actually enable `.init_array` for cross-compilers targeting Linux. [1]

That leads to annoying issues where building clang with such a GCC < 11 produces a `libclang_rt.profile.a` with `.ctors`, so that `clang -fprofile-generate -fuse-ld=lld` simply does not work: it ends up mixing `.ctors` and `.init_array`, glibc doesn't execute the `.ctors` bits, and this contains the constructor of a global that initializes profiling. [2]

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100896
[2] https://github.com/JuliaLang/julia/pull/45641


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D45508/new/

https://reviews.llvm.org/D45508



More information about the llvm-commits mailing list