This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Report filename for unknown relocation error.
ClosedPublic

Authored by grimar on Jan 30 2017, 7:10 AM.

Details

Summary

Our reporting for that case was something like:

setup.elf:

  ld.lld -m elf_i386 -T arch/x86/boot/setup.ld arch/x86/boot/a20.o arch/x86/boot/bioscall.o arch/x86/boot/cmdline.o arch/x86/boot/copy.o arch/x86/boot/cpu.o arch/x86/boot/cpuflags.o arch/x86/boot/cpucheck.o arch/x86/boot/early_serial_console.o arch/x86/boot/edd.o arch/x86/boot/header.o arch/x86/boot/main.o arch/x86/boot/mca.o arch/x86/boot/memory.o arch/x86/boot/pm.o arch/x86/boot/pmjump.o arch/x86/boot/printf.o arch/x86/boot/regs.o arch/x86/boot/string.o arch/x86/boot/tty.o arch/x86/boot/video.o arch/x86/boot/video-mode.o arch/x86/boot/version.o arch/x86/boot/video-vga.o arch/x86/boot/video-vesa.o arch/x86/boot/video-bios.o -o arch/x86/boot/setup.elf
ld.lld: error: do not know how to handle relocation 'R_386_PC8' (23)

It not very informative, I think it is worth to add filename.
At first I wanted to implement exact location using getLocation() method of input section.
But I found that it not only requires additional arguments for getRelExpr() (what probably not a problem),
but also since getRelExpr is non-templated it would also need one more EKind switch:

 switch (Config->EKind) {
...

what probably adds too much code for this error.
I do not expect it will often appear and reporting relocation ID + filename for me seems enough.

Diff Detail

Event Timeline

grimar created this revision.Jan 30 2017, 7:10 AM
grimar updated this revision to Diff 86429.Jan 31 2017, 7:22 AM
  • Addressed review comment.
This revision was automatically updated to reflect the committed changes.