How to fixup source paths during objdump disassembly?

Hi folks,

As part of our build, the Tock project uses remap-path-prefix [1] to create a reproducible build. This means that the paths inside of built artifacts are not full source paths. When we later attempt to produce a listings file, the source mapping fails. The result is many copies of this recently merged warning [2]:

llvm-objdump: warning: ‘/Volumes/code/helena-project/tock/target/thumbv7em-none-eabi/release/hail.elf’: failed to find source chips/sam4l/src/eic.rs

It looks like GNU objdump provides a --prefix option to address this exact problem [3]:

**--prefix=***prefix*
Specify *prefix* to add to the absolute paths when used with **-S**.

But I can’t find an equivalent mechanism in llvm-objdump.

What’s the correct way to point objdump to source files during disassembly?

To reproduce the problem, make lst in any of the boards for the Tock Operating System (e.g. https://github.com/tock/tock/tree/master/boards/hail ) will produce many missing file warnings.

Thanks for your help!

-Pat

[1] https://doc.rust-lang.org/1.24.0/unstable-book/compiler-flags/remap-path-prefix.html
[2] https://reviews.llvm.org/D62462
[3] https://linux.die.net/man/1/objdump

As far as I’m aware, there is no equivalent option in llvm-objdump currently unfortunately. We should add it. Could you file a bug against llvm-objdump to that effect?

James

llvm-symbolizer has --relativenames, which is close. It would only take a bit of plumbing to add that to llvm-objdump.

Filed https://bugs.llvm.org/show_bug.cgi?id=46368

Thanks!

-Pat