[llvm-bugs] [Bug 47563] New: Binaries generated with objcopy don't work correctly
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 17 09:23:41 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47563
Bug ID: 47563
Summary: Binaries generated with objcopy don't work correctly
Product: tools
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: llvm-objcopy/strip
Assignee: unassignedbugs at nondot.org
Reporter: alistair at alistair23.me
CC: alexander.v.shaposhnikov at gmail.com,
jake.h.ehrlich at gmail.com,
jh7370.2008 at my.bristol.ac.uk,
llvm-bugs at lists.llvm.org, rupprecht at google.com
When generating a Tock binary for RV32 with objcopy the LLVM version of objcopy
doesn't work.
Unfortunately I don't have a lot more information then that. The produced
binary fails to run when generated with LLVM objcopy. When generating the
binary with LLVM objcopy the OpenTitan boot ROM fails to load the binary with
this error:
```
E01067 bootstrap.c:146] Bootstrap error: 0xc
E01068 boot_rom.c:39] Bootstrap failed with status code: 12
I01069 test_status.c:31] FAIL!
```
To reproduce the binaries, follow these steps. Two objcopy calls are required.
The first objcopy always uses the GCC version, as LLVM doesn't have
`--update-section` support.
```
riscv64-elf-objcopy --update-section .apps=rv32imc.tbf
target/riscv32imc-unknown-none-elf/release/opentitan.target/riscv32imc-unknown-none-elf/release/opentitan-app.elf
```
```
riscv64-elf-objcopy --version
GNU objcopy (GNU Binutils) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
```
The next step is done with both GCC and LLVM versions. The GCC one runs on the
target correctly, while the LLVM version doesn't.
```
riscv64-elf-objcopy --output-target=binary
target/riscv32imc-unknown-none-elf/release/opentitan-app.elf
target/riscv32imc-unknown-none-elf/release/opentitan-app.bin
```
```
llvm-objcopy --output-target=binary
target/riscv32imc-unknown-none-elf/release/opentitan-app.elf
target/riscv32imc-unknown-none-elf/release/opentitan-app.bin
```
```
llvm-objcopy --version
llvm-objcopy, compatible with GNU objcopy
LLVM (http://llvm.org/):
LLVM version 10.0.1-rust-1.45.0-nightly
Optimized build.
Default target: x86_64-unknown-linux-gnu
Host CPU: skylake-avx512
```
--
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/20200917/a312d8e3/attachment-0001.html>
More information about the llvm-bugs
mailing list