Skip to content

Regression for RISC-V caused by b754e40 "MC: Remove redundant relocations for label differences" #141723

Closed
@asb

Description

@asb

After b754e40 commit, the XRay-riscv64-linux :: TestCases/Posix/coverage-sample.cpp test case starts to fail:

/home/buildbot-worker/bbroot/clang-riscv-rva23-2stage/stage2/./bin/clang  --driver-mode=g++ -fxray-instrument   -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta    -std=c++11 /home/buildbot-worker/bbroot/clang-riscv-rva23-2stage/llvm/compiler-rt/test/xray/TestCases/Posix/coverage-sample.cpp -o /home/buildbot-worker/bbroot/clang-riscv-rva23-2stage/stage2/runtimes/runtimes-bins/compiler-rt/test/xray/RISCV64LinuxConfig/TestCases/Posix/Output/coverage-sample.cpp.tmp # RUN: at line 3
+ /home/buildbot-worker/bbroot/clang-riscv-rva23-2stage/stage2/./bin/clang --driver-mode=g++ -fxray-instrument -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -std=c++11 /home/buildbot-worker/bbroot/clang-riscv-rva23-2stage/llvm/compiler-rt/test/xray/TestCases/Posix/coverage-sample.cpp -o /home/buildbot-worker/bbroot/clang-riscv-rva23-2stage/stage2/runtimes/runtimes-bins/compiler-rt/test/xray/RISCV64LinuxConfig/TestCases/Posix/Output/coverage-sample.cpp.tmp
/usr/bin/ld: .eh_frame_hdr refers to overlapping FDEs
/usr/bin/ld: final link failed: bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The following recipe is sufficient to reproduce (and a variant of it was used to do the bisect and confirm the problematic commit):

(Note that the failure message pasted above is from a "native" two-stage build. The commands below produce the same issue via cross compilation on an x86 host)

cmake -G Ninja \
  -DLLVM_TARGETS_TO_BUILD="X86;RISCV" \
  -DLLVM_ENABLE_PROJECTS='clang;lld' \
  -DLLVM_ENABLE_RUNTIMES=compiler-rt \
  -DLLVM_CCACHE_BUILD=ON \
  -DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
  -DCMAKE_C_COMPILER=clang \
  -DCMAKE_CXX_COMPILER=clang++ \
  -DLLVM_ENABLE_LLD=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DLLVM_RUNTIME_TARGETS=riscv64-linux-gnu \
  -DRUNTIMES_riscv64-linux-gnu_CMAKE_SYSTEM_NAME=Linux \
  -DRUNTIMES_riscv64-linux-gnu_CMAKE_SYSROOT=$HOME/rvsysroot \
  -S llvm \
  -B build/rvregression
cmake --build build/rvregression --target runtimes
./build/rvregression/bin/clang --target=riscv64-linux-gnu --sysroot=$HOME/rvsysroot --driver-mode=g++ -fxray-instrument -std=c++11 compiler-rt/test/xray/TestCases/Posix/coverage-sample.cpp

The riscv64-linux-gnu-ld on my system is 2.43.1.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions