I am working on a project where I need to use LD_PRELOAD to load some libraries into the memory space. It’s like: Due to certain reasons (I am actually working on some binary hacking), I must know the memory address (not a symbol) of certain functions (let’s say, foo) in libapp.so and instrument the binary code of my_app before execution.
Tag: shared-libraries
How to include dependencies information when creating shared libraries in linux?
I’m writing a shared library based on libpthread.so. To build it, I use the following command: But when linking files that use libfoo.so, I have to specify the option -lpthread -lfoo not just -lfoo. In addition, ldd libfoo.so doesn’t show anything about libpthread.so. So, is there any way so that I can avoid ‘-lpthread’? Answer Extending @Someprogrammerdude ‘s comment: Your
Using uclibc linker for glibc compiled binary?
I have a binary which I need to get working on an embedded system which uses uclibc, the binary was compiled against glibc, should this work? I get an error saying that the binary doesn’t exist when I try to run it, so I checked what libraries were missing. I was able to symlink all of these but one to
Can I get symbol names from one .so and make another .so see it?
I’ve built zlib and libpng separately (what are these libs doesn’t matter), so I’ve got libz.so and libpng.so now. With dlopen() and dlsym() I get function pointers from libpng.so and use them, but the problem is that, since libpng depends on zlib, I get linker errors when libpng function calls some zlib function inside itself. So my quiestion is: Is
How can a shared library know where it resides?
I’m developing a shared library for linux machines, which is dynamically loaded relative to the main executable with rpath. Now, the library itself tries to load other libraries dynamically relative to its location but without rpath (I use scandir to search for shared libraries in a certain folder – I don’t know their names yet). This works only, if the
How to list dependencies of c/c++ static library?
For a static library (.a file), how to list the module-level dependencies of it? I know for a shared library (.so), we can use objdump or readelf to do this: or I can get something like NEEDED libOne.so NEEDED libc.so.6 But for a static library, I can only get the dependencies in symbol-level, for example, by running I will get
Function of shared library is loaded at different physical addresses for different processes
I get physical addresses of function “printf” in libc.so in two programs, and two physical addresses are different. And I read two different physical address, the content are almost the same. This means function “printf” has two copies in memory? Details: My os is 32-bit linux. Physical address is calculated by read “/proc/self/pagemap”. Physical address reading is implemented with fmem
ldconfig can’t find lib in standard location
EDIT: Cloudera says that CentOS is supported please check Cloudera manual install as they have instructions on how to do so, it relies on libpython2.6.so.1.0 and libsasl2.so.2. When installing a package ( impala from cloudera repository ) I am told that libsasl2.so.2 and libpython2.6.so.1.0 are missing. After some searching people have said that soft linking the more up to date
Linux – cannot find shared library
Using Code::Blocks (13.12) / g++ to create some test code using the DVB V5 libraries on Ubuntu 14.04. The library was downloaded, built and installed following instructions in the download. Had it all working then had a disk crash. Decided to reinstall everything from scratch rather than use a backup, and downloaded libdvbv5 source again and rebuilt it. All seemed
How can I compile GCC with a shared library?
I create shared library libpl.so. I use this command to create connections: And now I try to compile my program using: but I have errors: What should I do to fix it? How can I compile it? Answer The line works correctly. Compile with: Run with: