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

glibc/abilists: add libresolv stubs #12629

Merged
merged 2 commits into from
Aug 26, 2022

Conversation

motiejus
Copy link
Contributor

Generated with ziglang/glibc-abi-tool#2

Fixes #12628

@motiejus
Copy link
Contributor Author

motiejus commented Aug 25, 2022

Note: because zig does not yet have universal-headers, the repro in #12628 will need to use a couple of extra flags (taken from #9485):

Files for the compiler and linker

$ grep . *.h *.map
dn_expand.h:#ifdef __ASSEMBLER__
dn_expand.h:.symver dn_expand, __dn_expand@GLIBC_2.2.5
dn_expand.h:#else
dn_expand.h:__asm__(".symver dn_expand, __dn_expand@GLIBC_2.2.5");
dn_expand.h:#endif
res_query.h:#ifdef __ASSEMBLER__
res_query.h:.symver res_query, __res_query@GLIBC_2.2.5
res_query.h:#else
res_query.h:__asm__(".symver res_query, __res_query@GLIBC_2.2.5");
res_query.h:#endif
dn_expand.map:GLIBC_2.2.5 {
dn_expand.map:  __dn_expand;
dn_expand.map:}
res_query.map:GLIBC_2.2.5 {
res_query.map:  __res_query;
res_query.map:}

testresolv.c

#include <stdio.h>
#include <resolv.h>

int main() {
    printf("res_query: %p\n", res_query);
    printf("dn_expand: %p\n", dn_expand);
}

Compile and run

$ zig cc --target=x86_64-linux-gnu.2.19 -Wl,--version-script,res_query.map -include res_query.h -Wl,--version-script,dn_expand.map -include dn_expand.h testresolv.c -o testresolv

abilists now use Zig's arch, no need for a separate one.
@andrewrk
Copy link
Member

Great work!

@andrewrk andrewrk merged commit aa45449 into ziglang:master Aug 26, 2022
@motiejus motiejus deleted the libresolv-abilists branch September 1, 2022 06:51
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.

zig cc not creating libresolv stubs
2 participants