dynamic-linking

What's the difference between the -symbolic and -shared GCC flags?

泄露秘密 提交于 2019-12-03 07:39:59
问题 From the documentation's description, they seem to do the same thing except that "not all systems" support shared and "only some systems" support symbolic (it's unclear if these are the same set of systems): -shared Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option. For predictable results, you must also specify the same set of options that were used to generate code (-fpic, -fPIC, or model suboptions) when you

Overload symbols of running process (LD_PRELOAD attachment)

喜欢而已 提交于 2019-12-03 06:07:01
问题 I'm working on a heap profiler for Linux, called heaptrack. Currently, I rely on LD_PRELOAD to overload various (de-)allocation functions, and that works extremely well. Now I would like to extend the tool to allow runtime attaching to an existing process, which was started without LD_PRELOAD ing my tool. I can dlopen my library via GDB just fine, but that won't overwrite malloc etc. I think, this is because at that point the linker already resolved the position dependent code of the already

How to distribute a Mac OS X with dependent libraries?

混江龙づ霸主 提交于 2019-12-03 05:58:50
问题 I have a program (specifically my entry for the SO DevDays Countdown app challenge) which relies on several dynamic libraries, namely libSDL, libSDL_ttf, and others. I have these libraries installed under /opt/local/lib via MacPorts, and many people won't have these installed (and some might have them installed, but not at that location). How do I distribute my program so that people without these libraries installed can run it out-of-the-box? Obviously I'll have to distribute the various

How to insert a LC_LOAD_DYLIB command into a Mach-O binary or join a static library to an existing binary (IOS)

落爺英雄遲暮 提交于 2019-12-03 05:11:56
问题 This is the first time I am asking on stackoverflow and I am desperate. My task is to load a dylib or join a static lib to an already existing executable for an IOS device. I will be using the static void __attribute__((constructor)) initialize(void) to start the swizzling. This executable is for in house enterprise appstore so i do not need to go thru the apple appstore (since they will reject it). The reason for this is to take an existing IPA from a customer and their signing keys and add

Why I cannot override search path of dynamic libraries with LD_LIBRARY_PATH?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 04:33:00
问题 Edit: I resolved this issue, the solution is below. I am building a code in a shared computing cluster dedicated for scientific computing, thus I can only control files in my home folder. Although I am using fftw as an example, I would like to understand the specific reason, why my attempt to setup LD_LIBRARY_PATH does not work. I build the fftw and fftw_mpi libraries in my home folder like this ./configure --prefix=$HOME/install/fftw --enable-mpi --enable-shared make install It builds fine,

What is the difference between .got and .got.plt section?

吃可爱长大的小学妹 提交于 2019-12-02 23:30:08
What is the difference between .got and .got.plt section in ELF format? My previous comment turns to be right, the example below makes things a bit clear. These are the relocations for my 32 bits i686-linux /lib/libm.so Relocation section '.rel.dyn' at offset 0x32b8 contains 8 entries: Offset Info Type Sym.Value Sym. Name 00025030 00000008 R_386_RELATIVE 00024fd8 00005706 R_386_GLOB_DAT 00025034 _LIB_VERSION 00024fdc 00000406 R_386_GLOB_DAT 00000000 __gmon_start__ 00024fe0 00000506 R_386_GLOB_DAT 00000000 _Jv_RegisterClasses 00024fe4 00000806 R_386_GLOB_DAT 00000000 _rtld_global_ro 00024fe8

What's the difference between the -symbolic and -shared GCC flags?

我们两清 提交于 2019-12-02 21:07:18
From the documentation's description, they seem to do the same thing except that "not all systems" support shared and "only some systems" support symbolic (it's unclear if these are the same set of systems): -shared Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option. For predictable results, you must also specify the same set of options that were used to generate code (-fpic, -fPIC, or model suboptions) when you specify this option.[1] -symbolic Bind references to global symbols when building a shared object. Warn

Overload symbols of running process (LD_PRELOAD attachment)

纵饮孤独 提交于 2019-12-02 20:46:31
I'm working on a heap profiler for Linux, called heaptrack . Currently, I rely on LD_PRELOAD to overload various (de-)allocation functions, and that works extremely well. Now I would like to extend the tool to allow runtime attaching to an existing process, which was started without LD_PRELOAD ing my tool. I can dlopen my library via GDB just fine, but that won't overwrite malloc etc. I think, this is because at that point the linker already resolved the position dependent code of the already running process - correct? So what do I do instead to overload malloc and friends? I am not proficient

How to distribute a Mac OS X with dependent libraries?

不打扰是莪最后的温柔 提交于 2019-12-02 19:20:06
I have a program (specifically my entry for the SO DevDays Countdown app challenge ) which relies on several dynamic libraries, namely libSDL, libSDL_ttf, and others. I have these libraries installed under /opt/local/lib via MacPorts, and many people won't have these installed (and some might have them installed, but not at that location). How do I distribute my program so that people without these libraries installed can run it out-of-the-box? Obviously I'll have to distribute the various .dylib files, but doing this is insufficient. The dynamic loader still looks for the libraries installed

Why I cannot override search path of dynamic libraries with LD_LIBRARY_PATH?

一个人想着一个人 提交于 2019-12-02 18:30:32
Edit: I resolved this issue, the solution is below. I am building a code in a shared computing cluster dedicated for scientific computing, thus I can only control files in my home folder. Although I am using fftw as an example, I would like to understand the specific reason, why my attempt to setup LD_LIBRARY_PATH does not work. I build the fftw and fftw_mpi libraries in my home folder like this ./configure --prefix=$HOME/install/fftw --enable-mpi --enable-shared make install It builds fine, but in install/fftw/lib, I find that the freshly built libfftw3_mpi.so links to wrong version of fftw