The ELFReader was skipping references for sections that contained relocations.
This fixes the bug.
llvm-svn: 230127
sym->st_shndx = 0;
sym->st_value = 0;
sym->st_size = 0;
- auto *newAtom = new (_readerStorage) ELFDefinedAtom<ELFT>(
- *this, "", sectionName, sym, section, content, 0, 0, _references);
+ auto *newAtom = createDefinedAtomAndAssignRelocations(
+ "", sectionName, sym, section, content, content);
newAtom->setOrdinal(++_ordinal);
return newAtom;
}
# RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target x86_64 %t.o --noinhibit-exec -o %t1.out
# RUN: llvm-readobj -sections %t1.out | FileCheck %s
+# RUN: lld -flavor gnu -target x86_64 %t.o --noinhibit-exec -o %t2.out --output-filetype=yaml
+# RUN: FileCheck %s -check-prefix=CHECKRELOCS < %t2.out
FileHeader:
Class: ELFCLASS64
#CHECK: Name: .rodata
#CHECK: Size: 18
+#CHECKRELOCS: references:
+#CHECKRELOCS: - kind: R_X86_64_PC32
+#CHECKRELOCS: offset: 7
+#CHECKRELOCS: target: .rodata
+#CHECKRELOCS: addend: -4