shn-xindex.test 942 B

123456789101112131415161718192021222324252627282930313233
  1. # Tests two special cases for the ELF format:
  2. # - If the section count in the ELF headers is 0, then, the true value
  3. # is read out of section 0.
  4. # - If the section string index in the ELF headers is SHN_XINDEX, the
  5. # true value is read out of section 0.
  6. #
  7. # These special cases are documented here:
  8. # https://docs.oracle.com/cd/E19683-01/817-3677/chapter6-94076/index.html
  9. # RUN: %yaml2obj %s -o %t.obj
  10. # RUN: %bloaty --raw-map %t.obj | %FileCheck %s
  11. --- !ELF
  12. FileHeader:
  13. Class: ELFCLASS64
  14. Data: ELFDATA2LSB
  15. Type: ET_REL
  16. Machine: EM_X86_64
  17. EShNum: 0
  18. EShStrNdx: 0xffff ## SHN_XINDEX
  19. Sections:
  20. - Type: SHT_NULL
  21. Link: .shstrtab
  22. Size: 0x3
  23. ...
  24. # CHECK: FILE MAP:
  25. # CHECK: 000-040 64 [ELF Header]
  26. # CHECK: 040-041 1 .strtab
  27. # CHECK: 041-058 23 .shstrtab
  28. # CHECK: 058-118 192 [ELF Section Headers]
  29. # CHECK: VM MAP: