Top "Ld" questions

The ld (linker or loader) program combines object files, archive files and (references from) shared libraries, relocates their data and addresses together with symbol references.

How to specify RPATH in a makefile?

I'm trying to specify rpath in my binary. My makefile looks like this- CC=gcc CFLAGS=-Wall LDFLAGS= -rpath='../…

makefile gnu-make ld rpath ldflags
What does KEEP mean in a linker script?

The LD manual does not explain what the KEEP command does. Below is a snippet from a third-party linker script …

linker ld linker-scripts
ld: library not found for -lcrt0.o on OSX 10.6 with gcc/clang -static flag

When I try to build the following program: #include <stdio.h> int main(void) { printf("hello world\n"); …

macos gcc ld
GNU gcc/ld - wrapping a call to symbol with caller and callee defined in the same object file

to clarify, my question refers to wrapping/intercepting calls from one function/symbol to another function/symbol when the caller …

gcc linker mocking ld interceptor
Linking a C program directly with ld fails with undefined reference to `__libc_csu_fini`

I'm trying to compile a C program under Linux. However, out of curiosity, I'm trying to execute some steps by …

c gcc linker glibc ld
MacOS -- how to link a dynamic library with a relative path using gcc/ld

If you are trying to understand dynamic linking, this question is likely to be of interest. One of the answers …

macos gcc linker ld dynamic-library
g++ compile error: undefined reference to a shared library function which exists

I recently installed the hdf5 library on an ubuntu machine, and am now having trouble linking to the exported functions. …

g++ shared-libraries ld hdf5 undefined-reference
How can I force linking with a static library when a shared library of same name is present

Suppose I have a file main.cpp which uses sin() function which is defined in libmath. Also suppose that we …

linux gcc g++ ld
Why am I getting a gcc "undefined reference" error trying to create shared objects?

Why am I getting an "undefined reference" error using gcc? I am trying to create a shared object (.so) that …

c gcc ld shared-libraries
Include binary file with GNU ld linker script

I have a working linker script. I want to add another data section whose contents is pulled directly from a …

binary gnu ld