Skip to content

Add --emit-symbol-resolution-report option for a standalone JSON report - #1630

Open
Parth (parth-07) wants to merge 1 commit into
qualcomm:mainfrom
parth-07:SymbolResolutionReport
Open

Add --emit-symbol-resolution-report option for a standalone JSON report#1630
Parth (parth-07) wants to merge 1 commit into
qualcomm:mainfrom
parth-07:SymbolResolutionReport

Conversation

@parth-07

@parth-07 Parth (parth-07) commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Add --emit-symbol-resolution-report option for a standalone JSON report

This commit moves the symbol resolution report out of the text map file
into a dedicated --emit-symbol-resolution-report=<file> option that emits
the report as standalone JSON, and it removes the old
--MapDetail show-symbol-resolution sub-option that previously embedded the
report inside a -MapStyle txt map file.

The emitted JSON is versioned and lists, for every symbol, the selected
definition and each candidate with its input file, section, size, binding,
type, visibility, and bitcode origin, including the corresponding post-LTO
object symbol where applicable. Binding and visibility are always present so
that consumers see a complete picture instead of the abbreviated form the
text report used to print.

{
  "SymbolResolutionReportVersion": 1,
  "Symbols": [
    {
      "Name": "foo",
      "Selected": "libc.a(malloc.o)(foo)",  // <InputFile>(<SymbolName>)
      "Candidates": [
        {
          "Name": "foo",
          "InputFile": "libc.a(malloc.o)",
          "Section": ".text",             // omitted when no section
          "Plugin": "MyPlugin",           // only for plugin-created symbols
          "Size": 4,
          "Bitcode": false,
          "SectionIndexKind": "Def",
          "Binding": "Global",            // always present
          "Type": "Object",
          "Visibility": "Default",        // always present
          "IsSelected": true,
          "LTOObjectSymbol": { ...same shape... } // bitcode post-LTO sym
        }
      ]
    }
  ]
}

A standalone Python inspector tool is added under
tools/SymbolResolutionInspector to query the report by symbol name or by a
per-candidate description, and to re-emit a filtered report as
JSON.

Existing symbol resolution tests are migrated to the new option and
drive their checks through this inspector.

This commit moves the symbol resolution report out of the text map file
into a dedicated `--emit-symbol-resolution-report=<file>` option that emits
the report as standalone JSON, and it removes the old
`--MapDetail show-symbol-resolution` sub-option that previously embedded the
report inside a `-MapStyle txt` map file.

The emitted JSON is versioned and lists, for every symbol, the selected
definition and each candidate with its input file, section, size, binding,
type, visibility, and bitcode origin, including the corresponding post-LTO
object symbol where applicable. Binding and visibility are always present so
that consumers see a complete picture instead of the abbreviated form the
text report used to print.

```
{
  "SymbolResolutionReportVersion": 1,
  "Symbols": [
    {
      "Name": "foo",
      "Selected": "libc.a(malloc.o)(foo)",  // <InputFile>(<SymbolName>)
      "Candidates": [
        {
          "Name": "foo",
          "InputFile": "libc.a(malloc.o)",
          "Section": ".text",             // omitted when no section
          "Plugin": "MyPlugin",           // only for plugin-created symbols
          "Size": 4,
          "Bitcode": false,
          "SectionIndexKind": "Def",
          "Binding": "Global",            // always present
          "Type": "Object",
          "Visibility": "Default",        // always present
          "IsSelected": true,
          "LTOObjectSymbol": { ...same shape... } // bitcode post-LTO sym
        }
      ]
    }
  ]
}
```

A standalone Python inspector tool is added under
`tools/SymbolResolutionInspector` to query the report by symbol name or by a
per-candidate description, and to re-emit a filtered report as
JSON.

Existing symbol resolution tests are migrated to the new option and
drive their checks through this inspector.

Signed-off-by: Parth Arora <partaror@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant