[llvm-bugs] [Bug 30435] New: [Rust][DebugInfo] SHF_MERGE section size must be a multiple of sh_entsize
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Sep 17 15:15:55 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30435
Bug ID: 30435
Summary: [Rust][DebugInfo] SHF_MERGE section size must be a
multiple of sh_entsize
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: japaricious at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Trying to link a hello world program written in Rust with debuginfo enabled
yields the following error message:
```
hello.o: SHF_MERGE section size must be a multiple of sh_entsize
```
Omitting the debuginfo results in bug 30434
(https://llvm.org/bugs/show_bug.cgi?id=30434)
Linking with `ld` instead of `lld` works fine.
### Steps To Reproduce
As a bash script but I've also attached the .cpio file generated by these
commands below:
.cpio file: https://www.dropbox.com/s/nikwo5s8fms22du/debuginfo.cpio?dl=0
``` bash
main() {
# install_rust
# test program
echo 'fn main() { println!("Hello, world!"); }' > hello.rs
# compile only, we'll link manually
rm -f hello.o
# NOTE omit the `-g` to omit debuginfo
rustc -g --emit=obj hello.rs
# store the path to the sysroot in a variable to make the following
commands shorter
local sysroot=$(rustc --print sysroot)
# link
# NOTE The arguments used here are what `rustc` (and `cc`) would ultimately
pass to `ld` when
# directly building an executable via the `rustc hello.rs` command. You can
see what flags
# `rustc` passes to `cc` with the `rustc -Z print-link-args hello.rs`
command.
# NOTE(2) You will have to update the library search paths and paths to
startup objects
ld.lld \
--build-id \
--eh-frame-hdr \
--hash-style=gnu \
-m \
elf_x86_64 \
-dynamic-linker \
/lib64/ld-linux-x86-64.so.2 \
-pie \
-o \
hello \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/Scrt1.o \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/crti.o \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/crtbeginS.o \
-L$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib \
-L$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib \
-L/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1 \
-L/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib \
-L/lib/../lib \
-L/usr/lib/../lib \
-L/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../.. \
--as-needed \
-z \
noexecstack \
hello.o \
--gc-sections \
-Bstatic \
-Bdynamic \
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-411f48d3.rlib \
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-411f48d3.rlib \
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-411f48d3.rlib
\
$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-411f48d3.rlib
\
-ldl \
-lpthread \
-lgcc_s \
-lpthread \
-lc \
-lm \
-lrt \
-lutil \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/crtendS.o \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/crtn.o \
--reproduce debuginfo
uninstall_rust
}
install_rust() {
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain
nightly-2016-09-15 --no-modify-path -y
source ~/.cargo/env
}
uninstall_rust() {
rustup self uninstall
}
main
```
### Meta
```
$ ld.lld --version
LLD 4.0 (git://github.com/llvm-mirror/lld.git
a499b2da2436789a9136f046f193caad0801ed93)
```
```
$ rustc -Vv
rustc 1.13.0-nightly (6ffdda1ba 2016-09-14)
binary: rustc
commit-hash: 6ffdda1ba183c981d57e63b59c88184be449eee4
commit-date: 2016-09-14
host: x86_64-unknown-linux-gnu
release: 1.13.0-nightly
```
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160917/4eb4d81a/attachment.html>
More information about the llvm-bugs
mailing list