Actions
Bug #19124
closedCompile with clang: Cannot compile with -flto -fvisibility=hidden
Status:
Feedback
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
Description
Environment¶
- CentOS 9 Stream x86_64
- 96 threads
- 96 GiB RAM
- 140 GiB SSD storage
Reproduction¶
sudo dnf install -y yum-utils
sudo yum-config-manager --enable crb
sudo dnf install -y \
make bc binutils-gold mold patch git bison xz autoconf automake m4 libtool pkg-config perl-interpreter \
gmp-devel openssl-devel readline-devel libyaml-devel gdbm-devel zlib-devel libffi-devel \
ncurses-devel readline-devel glibc-static glibc-devel llvm-toolset
LINKER=gold # also tried lld, bfd, and mold
FLAGS=''
LINKFLAGS="-fuse-ld=$LINKER -flto -fvisibility=hidden" # works without -flto -fvisibility=hidden
EXE_LINKFLAGS=''
export \
CC=clang \
CXX=clang++ \
LD=$LINKER \
CPPFLAGS="$FLAGS" \
CFLAGS="$FLAGS" \
CXXFLAGS="$FLAGS" \
DCFLAGS="$FLAGS" \
XCFLAGS="$FLAGS" \
MJIT_CFLAGS="$FLAGS" \
DLDFLAGS="$FLAGS $LINKFLAGS" \
LDFLAGS="$FLAGS $LINKFLAGS" \
XLDFLAGS="$FLAGS $LINKFLAGS $EXE_LINKFLAGS"
./configure --disable-install-doc --enable-shared && \
make -j && \
make test && \
sudo make install
Expected result¶
Installs ruby.
Actual result¶
Hangs at linking conftest with 1 process remaining but it never finishes (waiting hours).
/usr/bin/ld -export-dynamic --build-id --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o conftest /lib/../lib64/crt1.o /lib/../lib64/crti.o /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/crtbegin.o -L. -L../.. -L. -L/opt/rubies/ruby-3.1.2/lib -L/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12 -L/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib -plugin /usr/bin/../lib64/LLVMgold.so -plugin-opt=mcpu=x86-64 -plugin-opt=O3 -plugin-opt=-debugger-tune=gdb /tmp/conftest-b32079.o -export-dynamic --no-as-needed -rpath /opt/rubies/ruby-3.1.2/lib -lruby-static -lz -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm -lm -lc -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/crtend.o /lib/../lib64/crtn.o
Actions
Like0
Like0Like0