Project

General

Profile

Actions

Bug #19126

open

clang: Cannot compile with Control Flow Integrity (CFI)

Added by steakknife (Barry Allard) 3 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
[ruby-core:110716]

Description

Maybe related #19124

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=lld # also tried bfd and mold
FLAGS='-fsanitize=cfi'
LINKFLAGS="-fuse-ld=$LINKER -fsanitize=cfi -flto=thin -fvisibility=default" # also tried =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

Output

compiling enc/trans/newline.c
./revision.h unchanged
compiling version.c
linking miniruby
generating encdb.h
make: *** [uncommon.mk:1178: builtin_binary.inc] Illegal instruction (core dumped)
make: *** Waiting for unfinished jobs....
make: *** [uncommon.mk:841: .rbconfig.time] Illegal instruction (core dumped)
make: *** [uncommon.mk:1129: encdb.h] Illegal instruction (core dumped)
!!! Compiling ruby 3.1.2 failed!

No data to display

Actions

Also available in: Atom PDF

Like0