llvm-project/llvm/test/Object
Pengxuan Zheng ecb5ea6a26 [Object][COFF] Allow section symbol to be common symbol
I ran into an lld-link error due to a symbol named ".idata$4" coming from some
static library:
  .idata$4 should not refer to special section 0.

Here is the symbol table entry for .idata$4:

  Symbol {
      Name: .idata$4
      Value: 3221225536
      Section: IMAGE_SYM_UNDEFINED (0)
      BaseType: Null (0x0)
      ComplexType: Null (0x0)
      StorageClass: Section (0x68)
      AuxSymbolCount: 0
  }

The symbol .idata$4 is a section symbol (IMAGE_SYM_CLASS_SECTION) and LLD
currently handles it as a regular defined symbol since isCommon() returns false
for this symbol. This results in the error ".idata$4 should not refer to special
section 0" because lld-link asserts that regular defined symbols should not
refer to section 0.

Should this symbol be handled as a common symbol instead? LLVM currently only
allows external symbols (IMAGE_SYM_CLASS_EXTERNAL) to be common
symbols. However, the PE/COFF spec (see section "Section Number Values") does
not seem to mention this restriction. Any thoughts?

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D133627
2022-09-13 18:07:02 -07:00
..
AArch64 Add MachO MH_FILESET support to objdump 2022-08-24 13:34:43 -07:00
AMDGPU
ARM
BPF
Inputs
Lanai
Mips
RISCV
X86
ar-create.test
ar-error.test
archive-big-extract.test
archive-big-print.test
archive-big-read.test
archive-darwin-duplicates.test
archive-delete.test
archive-error-tmp.txt
archive-extract-dir.test
archive-extract.test
archive-format.test
archive-long-filenames-no-null-terminator.test
archive-long-index.test
archive-malformed-object.test [Object] Improve ArchiveWriter diagnostics 2022-09-10 21:06:52 +08:00
archive-move.test
archive-pad.test
archive-replace-pos.test
archive-symtab.test
archive-thin-create.test
archive-thin-paths.test
archive-thin-read.test
archive-toc.test
archive-unknown-filetype.test
archive-update.test
check_binary_output.ll
coff-archive-short.test
coff-archive.test
coff-data-dir-out-of-bounds.test
coff-dwarf-debug-only.test
coff-empty-drectve.test
coff-invalid.test
coff-sec-sym.test [Object][COFF] Allow section symbol to be common symbol 2022-09-13 18:07:02 -07:00
coff-weak-externals.test
directory.ll
dllimport-globalref.ll
dllimport.ll
dyn-rel-relocation.test
invalid-alignment.test
invalid.test
kext.test
macho-invalid.test
mangle-ir.ll
multi-module.ll
multiple-sections.yaml
nm-archive.test
nm-bitcode.test
nm-darwin-m.test
nm-error.test
nm-irix6.test
nm-pe-image.test
nm-shared-object.test
nm-tapi-invalids.test
nm-tapi.test
nm-trivial-object.test
nm-universal-binary.test
nm-weak-global-macho.test
obj2yaml.test
objc-imageinfo-coff.ll
objc-imageinfo-elf.ll
objc-imageinfo-macho.ll
objc-swift-mixed-imageinfo-macho.ll
objdump-export-list.test
objdump-no-sectionheaders.test [llvm-objdump] Create name for fake sections 2022-09-09 12:27:07 +01:00
objdump-private-headers.test
objdump-relocations.test
objdump-section-content.test
objdump-sectionheaders.test
objdump-symbol-table.test
pr25877.test
relocation-executable.test
simple-archive.test
size-trivial-macho.test
stackmap-dump.test
wasm-bad-data-symbol.yaml
wasm-bad-metadata-version.yaml
wasm-bad-reloc-type.test
wasm-bad-symbol-type.test
wasm-duplicate-name.test
wasm-invalid-file.yaml
wasm-invalid-section-order.test
wasm-invalid-start.test
wasm-missing-version.test
wasm-relocs-and-producers.yaml
wasm-string-outside-section.test
yaml2obj-elf-rel-noref.yaml
yaml2obj-elf-rel.yaml
yaml2obj-readobj.test