From: "steakknife (Barry Allard)" <noreply@ruby-lang.org>
To: ruby-core@neon.ruby-lang.org
Subject: [ruby-core:110718] [Ruby master Bug#19124] Compile with clang: Cannot compile with -flto -fvisibility=hidden
Date: Sat, 12 Nov 2022 02:22:59 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-100056.20221112022258.4803@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19124.20221112013602.4803@ruby-lang.org
Issue #19124 has been updated by steakknife (Barry Allard).
`-flto` itself works. `-fvisibility=` is needed for other `-fsanitize=` options.
----------------------------------------
Bug #19124: Compile with clang: Cannot compile with -flto -fvisibility=hidden
https://bugs.ruby-lang.org/issues/19124#change-100056
* Author: steakknife (Barry Allard)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
## 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
```
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2022-11-12 2:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 1:36 [ruby-core:110714] [Ruby master Bug#19124] Compile with clang: Cannot compile with -flto -fvisibility=hidden steakknife (Barry Allard)
2022-11-12 2:22 ` steakknife (Barry Allard) [this message]
2022-11-24 17:49 ` [ruby-core:110882] " alanwu (Alan Wu)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-100056.20221112022258.4803@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
--cc=ruby-core@neon.ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).