[libcxx-commits] [PATCH] D150691: [runtimes] Refactor Symbol Checking Tool
Michael Francis via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 16 13:33:36 PDT 2023
francii added a comment.
Using a simple C file:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Compiled with: `clang testfile.c -shared -fPIC -o testlib.so`
`generate_abi_list.py` will output the following JSON (whether to stdout or a file):
[
{
"Name": "_ITM_deregisterTMCloneTable",
"Type": "NoType",
"Undefined": true,
"Weak": true
},
{
"Name": "_ITM_registerTMCloneTable",
"Type": "NoType",
"Undefined": true,
"Weak": true
},
{
"Name": "__cxa_finalize",
"Type": "Func",
"Undefined": true,
"Weak": true
},
{
"Name": "__gmon_start__",
"Type": "NoType",
"Undefined": true,
"Weak": true
},
{
"Name": "main",
"Type": "Func"
},
{
"Name": "printf",
"Type": "Func",
"Undefined": true
}
]
Saving this output to a file (`sample.json`) and giving both the file and the library to `get_sym_diff.py` outputs:
Symbols unchanged
In `sample.json`, I changed the name of the first symbol to `Test_ITM_deregisterTMCloneTable` and changed the visibility of the second symbols from `"Weak": true` to `"Weak: false"`. I passed the original library and this altered symbol table to `get_sym_diff.py` as so:
`python3 get_sym_diff.py testlib.so sample.json`
The output is below:
Symbols Added: 1
Added {'Name': 'Test_ITM_deregisterTMCloneTable', 'Type': 'NoType', 'Undefined': True, 'Weak': True}
Symbols Removed: 1
Removed {'Name': '_ITM_deregisterTMCloneTable', 'Type': 'NoType', 'Undefined': True, 'Weak': True}
Symbols Changed: 1
_ITM_registerTMCloneTable: {'Name': '_ITM_registerTMCloneTable', 'Type': 'NoType', 'Undefined': True, 'Weak': True} -> {'Name': '_ITM_registerTMCloneTable', 'Type': 'NoType', 'Undefined': True, 'Weak': False}
ABI BREAKAGE!: 1 added, 0 removed, 0 changed.
I'd like to update the `symbols changed` output to show what parts of the symbols changed (i.e. Type) instead of just dumping all the information for both the old and the new.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150691/new/
https://reviews.llvm.org/D150691
More information about the libcxx-commits
mailing list