Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static address-taken functions generate linker errors #420

Closed
randomPoison opened this issue Oct 4, 2024 · 1 comment
Closed

static address-taken functions generate linker errors #420

randomPoison opened this issue Oct 4, 2024 · 1 comment

Comments

@randomPoison
Copy link
Contributor

In zlib we have some static address-taken functions that the rewriter has rewritten and generated call gates for, e.g. deflate_fast. These both get compiled into libz.so, which is then used as a dependency when linking the final binary. However, we get linker errors when we try to link the final binary:

/usr/bin/ld: libz.so.1.3.1.1-motley: undefined reference to `deflate_fast'

If I run nm libz.so | rg deflate_ I get:

0000000000018480 R deflate_copyright
                 U deflate_fast
                 U deflate_slow
                 U deflate_stored
0000000000005305 t __ia2_deflate_fast
00000000000053bd t __ia2_deflate_slow
0000000000005475 t __ia2_deflate_stored

So deflate_fast is showing up as an undefined reference in libz.so, even though deflate_fast is defined within that shared object.

Removing the static modifier resolves the issue, but isn't an ideal solution here. We currently are deliberately generating the callgate assembly within the same file as the function specifically so that we can directly reference the function. But for some reason this doesn't seem to be working for zlib.

@randomPoison
Copy link
Contributor Author

Duplicate of #414

@randomPoison randomPoison marked this as a duplicate of #414 Oct 4, 2024
@randomPoison randomPoison closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
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

No branches or pull requests

1 participant