Skip to content
Snippets Groups Projects
  • Cherry Mui's avatar
    ddaf6820
    cmd/internal/objfile: read file/line information for ELF PIE binaries · ddaf6820
    Cherry Mui authored
    For PIE binaries, the .gopclntab section doesn't have the usual
    name, but .data.rel.ro.gopclntab. Try the relro version as well.
    If both failed (e.g. for externally linked PIE binaries), try
    runtime.pclntab symbol.
    
    This should make cmd/objdump able to print the file/line
    information for PIE binaries.
    
    I attempted to do this a few years ago, but that wasn't enough,
    because the pclntab itself contains dynamic relocations which are
    not applied by the tool. As of Go 1.18 the pclntab is mostly
    position independent and does not contain dynamic relocations, so
    this should be possible now.
    
    Fixes #17883.
    Updates #46639.
    
    Change-Id: I85dc3d50ffcc1a4b187a349479a6a162de1ab2b5
    Reviewed-on: https://go-review.googlesource.com/c/go/+/227483
    
    
    Run-TryBot: Cherry Mui <cherryyz@google.com>
    Reviewed-by: default avatarThan McIntosh <thanm@google.com>
    Reviewed-by: default avatarJoel Sing <joel@sing.id.au>
    TryBot-Result: Gopher Robot <gobot@golang.org>
    ddaf6820
    History
    cmd/internal/objfile: read file/line information for ELF PIE binaries
    Cherry Mui authored
    For PIE binaries, the .gopclntab section doesn't have the usual
    name, but .data.rel.ro.gopclntab. Try the relro version as well.
    If both failed (e.g. for externally linked PIE binaries), try
    runtime.pclntab symbol.
    
    This should make cmd/objdump able to print the file/line
    information for PIE binaries.
    
    I attempted to do this a few years ago, but that wasn't enough,
    because the pclntab itself contains dynamic relocations which are
    not applied by the tool. As of Go 1.18 the pclntab is mostly
    position independent and does not contain dynamic relocations, so
    this should be possible now.
    
    Fixes #17883.
    Updates #46639.
    
    Change-Id: I85dc3d50ffcc1a4b187a349479a6a162de1ab2b5
    Reviewed-on: https://go-review.googlesource.com/c/go/+/227483
    
    
    Run-TryBot: Cherry Mui <cherryyz@google.com>
    Reviewed-by: default avatarThan McIntosh <thanm@google.com>
    Reviewed-by: default avatarJoel Sing <joel@sing.id.au>
    TryBot-Result: Gopher Robot <gobot@golang.org>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.