[llvm-bugs] [Bug 40337] New: [yaml2obj]Relocations should reference symbols from their linked symbol table

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 16 07:57:43 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40337

            Bug ID: 40337
           Summary: [yaml2obj]Relocations should reference symbols from
                    their linked symbol table
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jh7370.2008 at my.bristol.ac.uk
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

If you attempt to write a dynamic relocation section, i.e. one that references
.dynsym, or indeed any relocation section where the sh_link does not point at
.symtab, the symbols referenced by the yaml are treated as symbols in the
static symbol table, not necessarily the linked symbol table.

Example:

!ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_DYN
  Machine:         EM_X86_64
Sections:
  - Name:         .text
    Type:         SHT_PROGBITS
  - Name:         .rela.dyn
    Type:         SHT_RELA
    Flags:        [ SHF_ALLOC ]
    Link:         .dynsym
    Info:         .text
    Address:      0x200
    AddressAlign: 0x100
    EntSize:      0x18
    Relocations:
      - Offset: 0x10
        Symbol: _Z3fooi # Ends up with symbol index 0 (i.e. not referencing
anything)
        Type:   R_X86_64_PC32
        Addend: 0x4
      - Offset: 0x10
        Symbol: blah    # Ends up with symbol index 1 (i.e. _Z3fooi)
        Type:   R_X86_64_PC32
        Addend: 0x4
Symbols:
  Global:
    - Name: blah
DynamicSymbols:
  Global:
    - Name: _Z3fooi

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190116/a0a0153c/attachment.html>


More information about the llvm-bugs mailing list