Skip to content

[lld] [hexagon] Assertion `auxIdx == 0' #132766

Open
@androm3da

Description

@androm3da

While building libclang_rt.asan-hexagon.so, lld asserts in lld::elf::hexagonTLSSymbolUpdate().

Reduced to the case below:

cat <<EOF > one.yaml
--- !ELF
FileHeader:
  Class:           ELFCLASS32
  Data:            ELFDATA2LSB
  Type:            ET_REL
  Machine:         EM_HEXAGON
  SectionHeaderStringTable: .strtab
Sections:
  - Name:            .text
    Type:            SHT_PROGBITS
  - Name:            .text._ZN11__sanitizer24InternalMmapVectorNoCtorIjLb0EE7ReallocEj
    Type:            SHT_PROGBITS
  - Name:            .text._ZTW21__sancov_lowest_stack
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
  - Name:            .rela.text
    Type:            SHT_RELA
    Info:            .text
  - Name:            .rela.text._ZN11__sanitizer24InternalMmapVectorNoCtorIjLb0EE7ReallocEj
    Type:            SHT_RELA
    Info:            .text._ZN11__sanitizer24InternalMmapVectorNoCtorIjLb0EE7ReallocEj
  - Name:            .rela.text._ZTW21__sancov_lowest_stack
    Info:            .text._ZTW21__sancov_lowest_stack
    Relocations:
      - Offset:          0xC
        Symbol:          __sancov_lowest_stack
        Type:            R_HEX_GD_PLT_B22_PCREL
    Type:            SHT_RELA
  - Type:            SectionHeaderTable
    Sections:
      - Name:            .strtab
      - Name:            .text
      - Name:            .rela.text
      - Name:            .text._ZN11__sanitizer24InternalMmapVectorNoCtorIjLb0EE7ReallocEj
      - Name:            .rela.text._ZN11__sanitizer24InternalMmapVectorNoCtorIjLb0EE7ReallocEj
      - Name:            .text._ZTW21__sancov_lowest_stack
      - Name:            .rela.text._ZTW21__sancov_lowest_stack
      - Name:            .symtab
Symbols:
  - Name:            __sancov_lowest_stack
    Type:            STT_TLS
    Binding:         STB_WEAK
EOF

cat <<EOF > two.yaml
--- !ELF
FileHeader:
  Class:           ELFCLASS32
  Data:            ELFDATA2LSB
  Type:            ET_REL
  Machine:         EM_HEXAGON
Sections:
  - Name:            .text
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
  - Name:            .rela.text
    Type:            SHT_RELA
    Info:            .text
    Relocations:
      - Symbol:          _GLOBAL_OFFSET_TABLE_
        Type:            R_HEX_B32_PCREL_X
        Symbol:          __tls_get_addr
Symbols:
  - Name:            __tls_get_addr
    Binding:         STB_GLOBAL
EOF

yaml2obj one.yaml > one.o
yaml2obj two.yaml > two.o

./bin/ld.lld -shared -o ./out.so one.o two.o

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions