Questions tagged [ld]

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. Linking is usually the final step of compiling a program.

2795 questions
1
vote
1 answer

How does ld load itself?

When I do /lib64/ld-linux-x86-64.so.2 ./a.out it loads my a.out program. But how does the /lib64/ld-linux-x86-64.so.2 get loaded in the first place? Also, what does the /lib64/ld-linux-x86-64.so.2 use underneath? Fork or Clone ... ?
Bibrak
  • 544
  • 4
  • 20
1
vote
2 answers

Need explanation on linker (ld) error "Absolute addressing .. not allowed in slidable image"

I've created "bundle" xcode target and linked it against several static libs. I got "Absolute addressing (perhaps -mdynamic-no-pic) used in ... from ... not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs. After…
fspirit
  • 2,537
  • 2
  • 19
  • 27
1
vote
0 answers

LLD error on -O2 Function Scoped Static TLS cannot be used against symbol recompile with -fPIC

I am using LLVM's LLD8 to replace GNU-LD to improve link speed. But when I make .so file, there is a strange error in the release mode. After streamlining, I reproduced this problem with a simple example test.h: #ifndef TEST_H #define TEST_H inline…
CChip
  • 11
  • 3
1
vote
0 answers

Assembly Gas - compile using gcc and ld cuase segmentation fault

I am using Ubuntu 18.04 in a virtual box to run assembly GAS code. .section .rodata input_int: .string "%d" .text .global main .type main, @function main: movq %rsp, %rbp #for correct debugging -added by the ide pushq …
Montoya
  • 2,819
  • 3
  • 37
  • 65
1
vote
1 answer

LD_PRELOAD multiple interdependent libraries

I Have Libraries with a tree of dependencies, i.e. some of the dependencies have other dependencies I want to Preload. How can I do this? LD_PRELOAD \ /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicudata.so.60…
danba
  • 842
  • 11
  • 32
1
vote
1 answer

Make ld ignore directory from /etc/ld.so.conf

TL,DR: Is there a way for me (no root access) to make the linker (invoked by gcc) unaware of the contents of a directory contained in /etc/ld.so.conf after it has been cached via ldconfig? In Detail: I'm trying (and failing) to compile HTCondor on a…
user35915
  • 1,222
  • 3
  • 17
  • 23
1
vote
1 answer

QNX QCC linker includes file timestamps

Is there a flag to pass into the linker which will NOT include each file's timestamp in the library.a output? We are creating a library with the qcc -A parameter and when it does this it gathers all the compiled files into the library correctly but…
Ovi Tisler
  • 6,425
  • 3
  • 38
  • 63
1
vote
1 answer

Cannot link a shared library for python

I make a module for apache, and use gcc for compile: gcc \ $(apr-1-config --cflags) \ $(apr-1-config --includes) \ $(python3.6-config --cflags) \ -fPIC -DSHARED_MODULE \ -I/usr/include/httpd/ \ -c mod_demo.c But when I try…
e-info128
  • 3,727
  • 10
  • 40
  • 57
1
vote
2 answers

Data-only static libraries with GCC

How can I make static libraries with only binary data, that is without any object code, and make that data available to a C program? Here's the build process and simplified code I'm trying to make…
regularfry
  • 3,248
  • 2
  • 21
  • 27
1
vote
1 answer

How linker adds Program Headers to the Relocatable file?

So we know that linker (in my case ld ) adds the Program Headers to the Relocatable file while creating the actual Executable. Then these Headers are used to load the program into memory at run-time. First of all how ld calculates and adds these…
Kobayashi
  • 2,402
  • 3
  • 16
  • 25
1
vote
0 answers

How to add a directory to Search Dir for linker script to search for the libraries in GNU 2.17

I have been trying to link the custom library to my cpp files using the following comamnd g++ xx.cpp -I .../mydir/ -lfoo where foo located in ../mydir and added this directory in LD_LIBRARY_PATH and executed ldconfig command and can find this…
pari
  • 185
  • 1
  • 1
  • 10
1
vote
1 answer

Why doesn't ld search rpaths from a DSO itself at link time

I have libA.so, libB.so, and an executable 'foo'. 'foo' needs libB.so which itself needs libA.so. During linking foo explicitly links with libB because it directly uses symbols from it. 'foo' does not directly use symbols from libA. When linking…
pups
  • 82
  • 7
1
vote
0 answers

Recording name conflict when linking

When compiling project on Solaris I get ld fatal error: fatal: recording name conflict 'path/lib.so' and 'otherpath/lib.so' provide identical dependency. Libs are the same, but cmake somehow generates makefile linking to both. It does work under…
myschu
  • 91
  • 1
  • 8
1
vote
1 answer

How to keep a free function from a static library in a shared library

When I build a shared library from a static library, its free functions disappear. I know a workaround to keep the symbol in the final library but I would like to understand why I need this workaround in the first place. Let's consider this source…
Julien
  • 2,139
  • 1
  • 19
  • 32
1
vote
0 answers

Is it possible to reference a shared library (.so) via a static library (.a)

I want to (effectively) resolve references to symbols in multiple shared libraries by incorporating them into a static library and linking against the static library at compile time. I want to do this to simplify the build process across multiple…