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

.symver under gcc 9.x and 10.x #3708

Open
signalogic opened this issue Mar 11, 2024 · 6 comments
Open

.symver under gcc 9.x and 10.x #3708

signalogic opened this issue Mar 11, 2024 · 6 comments

Comments

@signalogic
Copy link

signalogic commented Mar 11, 2024

In overrides.c, this line:

asm(".symver dlsym, dlsym@GLIBC_2.2.5");

fails under gcc 9.x and 10.x with:

no symbol version section for versioned symbol `dlsym@GLIBC_2.2.5'

but works under gcc versions lower and higher (or at least doesn't issue an error). Notes:

-same error occurs with version script of GLIBC_2.2.5 { dlsym; }; (or global: dlsym)
-flto is enabled
-with just the version script, functionality is achieved, but I'm hoping there is way to avoid gcc version work-arounds
-symver attribute might be an option, but I don't see how to apply it for glibc functions

Did you guys find a work-around to build overrides.c on a range of gcc versions, for example linker command line options or symver attribute ? Thanks

@rocallahan
Copy link
Collaborator

I have no idea about this.

@signalogic
Copy link
Author

Ok thanks. I documented the problem in detail in the comments section at:

https://maskray.me/blog/2020-11-26-all-about-symbol-versioning

it seems corrected under gcc 11.x and higher

@rocallahan
Copy link
Collaborator

-with just the version script, functionality is achieved, but I'm hoping there is way to avoid gcc version work-arounds

What do you mean "with just the version script"?

@signalogic
Copy link
Author

cat > a.map <<e
GLIBC_2.2.5 { dlsym; };
e
gcc cmd line ... -Wl,--version-script=a.map -o a.so

@rocallahan
Copy link
Collaborator

So that works with all versions of gcc? Any reason to not use that all the time?

@signalogic
Copy link
Author

with gcc 4.x thru 10.x and only the version script, objdump on the resulting lib shows:

0000000000000000 g DO ABS 0000000000000000 GLIBC_2.2.5 GLIBC_2.2.5

which looks odd to me. With 11.x, the .symver is required, and objdump shows:

0000000000000000 DF UND 0000000000000000 GLIBC_2.2.5 dlsym

which looks correct to me. I haven't tried 12.x yet, planning to do that

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

2 participants