Skip to content

ObjFile on stripped binaries #42954

@stevemk14ebr

Description

@stevemk14ebr

On GO binaries with stripped .symtab sections the objfile tool fails to located the pclntab and fails to print embedded symbols. The table can still be found however by byte scanning the .text section of the binary for the header magic for the table:

const go12magic = 0xfffffffb
const go116magic = 0xfffffffa

The gosym NewTable method does not require the .symtab section to correctly parse the pclntab table and is still useful for this case of stripped binaries. It may simply be passed an empty byte array as it's first argument:

return gosym.NewTable(symtab, gosym.NewLineTable(pclntab, textStart))

I propose that a simple byte scan be added in objfile.go if the .pcln() method fails to locate the table by the standard symbols lookup. By falling back to byte scanning the tool can still print much useful information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions