Giter Site home page Giter Site logo

Comments (4)

0-wiz-0 avatar 0-wiz-0 commented on July 21, 2024

Do you know a symbol we could use instead?
Does 'remove@@' work?

from nihtest.

miller-alex avatar miller-alex commented on July 21, 2024

No, remove@@ doesn't help. The symbol versions have to match exactly, or the symbol from the preloaded library will not be considered.

In this case it gets a little complicated because different libcs (in case of glibc even different (sub)archs) use different symbol versions (or none). So I guess you have to check what version gets actually used:

  • Link nihtest-file before libineffective-remove.so.
  • List its dynamic symbols, e.g. with nm -D nihtest-file.
  • Find the symbol you want to override (i.e. remove) and extract the symbol version, if any.
  • If the symbol has a version suffix, then link libineffective-remove.so with a version script that sets the expected symbol version.

Alternatively, you could search for the default version of remove in libc, i.e. the one with @@ in the name (there is no other version in my libc, though). That is slightly more complicated (you have to find the correct libc) but could be done in the configure step.

The version script should look like @REMOVE_VER@ { global: remove; }; where @REMOVE_VER@ is to be replaced by the expected symbol version. For example, on my system, where nihtest-file has an undefind symbol remove@GLIBC_2.2.5,
the version script becomes GLIBC_2.2.5 { global: remove; };.
Pass the version script to the linker with -Wl,--version-script=libineffective-remove.map assuming the version script file name is libineffective-remove.map.

I don't know whether cmake provides support that can simplify the task.

See https://sourceware.org/binutils/docs/ld/VERSION.html for basic info on symbol versions and linker scripts or https://www.akkadia.org/drepper/dsohowto.pdf for more background.

from nihtest.

0-wiz-0 avatar 0-wiz-0 commented on July 21, 2024

I took a different route - in the test we're not really interested in if we can override a libc symbol, it's enough if we can override a symbol from a library. So I made a library and overrode its symbol.
Please verify that this fixes the problem for you too!

from nihtest.

miller-alex avatar miller-alex commented on July 21, 2024

With 266c455 applied, tests work as expected here:

100% tests passed, 0 tests failed out of 54

Total Test time (real) =   4.01 sec

The following tests did not run:
         44 - preload-skip.test (Skipped)

Thanks for the quick fix.

from nihtest.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.