Open randomPoison opened 1 month ago
The zlib linker script can be seen here: https://github.com/immunant/zlib/blob/1849c2400150304c100af9d3e3b9b92ac0337290/zlib.map
The problem here is basically the same thing as 414 (missing the right type of callgate), but I'm not sure this can be fixed in the rewriter alone. Basically we'll need something similar to IA2_BEGIN_NO_WRAP
to get the rewriter to create the correct callgates for these functions.
I think this is just something we need to document in the usage docs. The user will have to do some additional source annotation (e.g. add the used
attribute) to handle this case since we can't do it automatically, so we should note this limitation and tell the user how to manually fix it.
Right, though I don't think the used annotation by itself does the right thing here.
The simplest thing I can think of is a CLI param for the rewriter that tells it to treat a symbol as internal. Were you thinking of adding an annotation to the sources instead, Ayrton? That works too, probably cleaner, but technically the linker script allows the build system to hide the symbol independently from the source file, so in some configurations it might and in some it might not.
If a project has a function
foo
that is used as an address-taken function that has been rewritten by the rewriter, and the project uses a linker script to markfoo
local, then the function gates inlibcallgates.so
will generate linker errors when they can't findfoo
in the compartmentalized library. Note that this is basically the same error as in #414, but caused by a linker script instead of astatic
modifier.