https://bugs.llvm.org/show_bug.cgi?id=41133
Bug ID: 41133
Summary: Improve error message for relocation against discarded
section
Product: lld
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: ELF
Assignee: unassignedb...@nondot.org
Reporter: smee...@fb.com
CC: gri...@accesssoftek.com, i...@maskray.me,
llvm-bugs@lists.llvm.org, peter.sm...@linaro.org,
pe...@pcc.me.uk, r...@google.com
gold gained some nice enhancements to its error messages for relocations
against discarded sections recently (I believe with version 2.31). For example,
$ cat group1.s
.section .text.foo,"axG",@progbits,foo,comdat
.globl foo
foo:
retq
$ cat group2.s
.section .text.foo,"axG",@progbits,foo,comdat
.globl foo
foo:
retq
.globl bar
bar:
retq
$ cat main.s
.text
.globl main
main:
jmp bar
$ llvm-mc -filetype=obj -o group1.o group1.s
$ llvm-mc -filetype=obj -o group2.o group2.s
$ llvm-mc -filetype=obj -o main.o main.s
$ ld.gold -e main group1.o group2.o main.o
main.o(.text+0x1): error: relocation refers to global symbol "bar", which is
defined in a discarded section
It displays more information if the discarded section is in the same object
file as the relocation to it:
$ cat group3.s
.section .text.foo,"axG",@progbits,foo,comdat
.globl foo
foo:
retq
.globl bar
bar:
retq
.text
.globl main
main:
jmp bar
$ llvm-mc -filetype=obj -o group3.o group3.s
$ ld.gold -e main group1.o group3.o
group3.o(.text+0x1): error: relocation refers to global symbol "bar", which is
defined in a discarded section
section group signature: "foo"
prevailing definition is from group1.o
LLD just displays an undefined symbol error for both cases. That's technically
accurate, but it can be confusing, since you do have a definition in your
object files, just not one that was part of a prevailing COMDAT group. Would it
be possible to keep track of discarded COMDAT groups in LLD to display more
informative error messages?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs