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

support for adding and assigning new auxiliary symbol versions #670

Closed
wants to merge 1 commit into from
Closed

support for adding and assigning new auxiliary symbol versions #670

wants to merge 1 commit into from

Conversation

ahaensler
Copy link

@ahaensler ahaensler commented Feb 24, 2022

This PR has helped me patch an old library. It was built against an old glibc version, and pthread_yield didn't have an auxiliary symbol version entry. I made it work by adding "GLIBC_2.2".

The use case in Python

import lief

filename = "library.so"
lib = lief.parse(filename)

for svr in lib.symbols_version_requirement:
    if svr.name == "libc.so.6":
        ar = lief.ELF.SymbolVersionAuxRequirement()
        ar.other = 12
        ar.name = "GLIBC_2.2"
        sauxr = svr.add_auxiliary_requirement(ar)
        break

for x in lib.dynamic_symbols:
    if x.name == "pthread_yield":
        x.symbol_version.symbol_version_auxiliary = sauxr

lib.write(filename)  

@romainthomas
Copy link
Member

Thank you @ahaensler!

I merged your commit with a few modifications (documentation, const-ness) here: 9331982

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.

None yet

2 participants