Merge commit '8fef2aa64ec1ee742e8b70b825938d30a0ea7319' into HEAD
This commit is contained in:
@@ -225,6 +225,79 @@ it("retains native inventory facts from captured Apple tool output", async () =>
|
||||
});
|
||||
});
|
||||
|
||||
it("reports a renamed re-export once under its exported name", async () => {
|
||||
const client = new NativeMacOSProvider(
|
||||
{},
|
||||
new FixtureRunner({
|
||||
"dyld_info:-exports": await fixture(
|
||||
"dyld-inventory/renamed-reexports.txt",
|
||||
),
|
||||
nm: "_foo_renamed\n_own\n",
|
||||
}),
|
||||
"darwin",
|
||||
).createClient(machoTarget("/private/fixture"));
|
||||
const execution = await client.execute("inspect_macho", {});
|
||||
if (!execution.ok) throw execution.error;
|
||||
expect(execution.value.result).toMatchObject({
|
||||
exports: {
|
||||
items: [
|
||||
{
|
||||
name: "_foo_renamed",
|
||||
address: null,
|
||||
weak: null,
|
||||
reexport: true,
|
||||
source: "libfoo",
|
||||
},
|
||||
{ name: "_own", reexport: false, source: null },
|
||||
],
|
||||
limitations: [
|
||||
"Merged nm/dyld_info results may be incomplete for stripped binaries.",
|
||||
"Renamed re-exports are listed under their exported name; the source library's symbol name is not reported.",
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("splits re-export rows at the source library", () => {
|
||||
// dyld_info -exports rows for synthetic dylibs: a source symbol named
|
||||
// `operator()`, and a library whose install name contains ` from `.
|
||||
expect(
|
||||
parseDyldSymbols(
|
||||
[
|
||||
"[re-export] _call_renamed (operator() from libfoo)",
|
||||
"[re-export] _g (from lib from foo)",
|
||||
"[re-export] _nested (from lib (from foo))",
|
||||
].join("\n"),
|
||||
"exports",
|
||||
null,
|
||||
new Set(["_call_renamed", "_g", "_nested"]),
|
||||
),
|
||||
).toEqual([
|
||||
{
|
||||
name: "_call_renamed",
|
||||
address: null,
|
||||
weak: null,
|
||||
reexport: true,
|
||||
source: "libfoo",
|
||||
sourceSymbol: "operator()",
|
||||
},
|
||||
{
|
||||
name: "_g",
|
||||
address: null,
|
||||
weak: null,
|
||||
reexport: true,
|
||||
source: "lib from foo",
|
||||
},
|
||||
{
|
||||
name: "_nested",
|
||||
address: null,
|
||||
weak: null,
|
||||
reexport: true,
|
||||
source: "lib (from foo)",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("retains symbol names containing spaces in dyld inventory rows", () => {
|
||||
expect(
|
||||
parseDyldSymbols(" 0x0000 _entry with space (from fixture)", "imports"),
|
||||
@@ -449,6 +522,25 @@ it("leaves an ambiguous short and literal name to the caller's nm inventory", ()
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("retains unmatched re-export rows when the known export inventory is incomplete", () => {
|
||||
expect(
|
||||
parseDyldSymbols(
|
||||
"[re-export] _g (from libfoo)",
|
||||
"exports",
|
||||
null,
|
||||
new Set(["_own"]),
|
||||
),
|
||||
).toEqual([
|
||||
{
|
||||
name: "_g",
|
||||
address: null,
|
||||
weak: null,
|
||||
reexport: true,
|
||||
source: "libfoo",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("retains annotation parsing without nm name evidence", () => {
|
||||
expect(parseDyldSymbols("0x120 _weak [weak-def]", "exports")).toEqual([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user