Questions tagged [relocation]

Relocation is the adaptation of a piece of code assembled on a certain address in memory to another address It is a typical task of dynamic linkers and program loaders, and thus last step in a standard development toolchain.

Relocation is the adaptation of a piece of code assembled on a certain address in memory to another address. It is a typical task of dynamic linkers and program loaders, and thus last step in a standard development toolchain. (typically make - preprocessor - compiler - assembler - archiver - linker - loader)

Relocations can be symbolic or by just adding the base load address of the module (binary/library), the latter is often called a fixup. The object code of some executable formats is assembled to start at 0, making the normal linking process have some relocation aspects also.

The standard book about this subject is "Linkers and Loaders" by John R. Levine.

247 questions
1
vote
2 answers

How are relocations supposed to work in static PIE binaries?

Consider this GNU Assembler program for AMD64 Linux: .globl _start _start: movl $59, %eax # SYS_execve leaq .pathname(%rip), %rdi # position-independent addressing leaq .argv(%rip), %rsi movq (%rsp), %rdx leaq…
1
vote
1 answer

Absolute addressing using PC-relative addressing in a relocatable program. What would the modification record be like?

I'm trying to solve the following exercise from section 2.2 of System Software: An Introduction to Systems Programming (For VTU), 3/e by Leland L. Beck. There is an assembler for a machine that has only program-counter relative addressing. If we…
user10648668
1
vote
0 answers

Why can't I group input sections from --emit-relocs ld option inside a common output section?

I have to relocate an elf at runtime and so I want to have access to all the relocations emitted by the linker: hence the use of the --emit-relocs ld option. The thing is I want to group all the .rela.* sections into one .rela.dyn section in the…
alexghiti
  • 91
  • 4
1
vote
1 answer

relocation error & Linux sw distributing

This is my goal: I developed software in Linux and I need to distribute it without source code. The idea is to create a zip file that contains all the necessary items to run the executable. The user will download the zip, extract it, double-click,…
Alessandro
  • 11
  • 2
1
vote
0 answers

Relocatable code for .SO and .DLL libraries

I am developing a C++ library that requires some external assembly functions to be included. Currently, the C/C++ functions are being declared this way (generic format, not the exact code): #if defined _WIN32 #define DLL_ENTITY…
kanito73
  • 87
  • 4
1
vote
1 answer

Location of Relocation table in ELF file

I don't find any information about where is located the relocation table in ELF file. My project is to display information about a ELF file like readelf. I did the display of the Header, Section Header and Symbol table but I don't know where to find…
Léandre
  • 125
  • 2
  • 13
1
vote
0 answers

U-boot does not silence its output

I have this uboot VERSION = 2017 PATCHLEVEL = 03 I am trying to silent the console using the silent variable.I defined this #define CONFIG_SILENT_CONSOLE So at boot time I am interrupting the console, and entering setenv silent 1 save reset Now…
1
vote
0 answers

symbol relocation - extern,static and no storage class

I have 3 sample codes below(all .so files): 1) int myglob = 42; int fun(int a, int b) { return myglob + a + b; } 2) static int myglob = 42; int fun(int a, int b) { return myglob + a + b; } 3) extern int myglob; int fun(int a, int…
ray an
  • 1,132
  • 3
  • 17
  • 42
1
vote
1 answer

The Symbol Relocation

The following is how a function call(for the 1st time) would be resolved in a PIC Jump to the PLT entry of our symbol. Jump to the GOT entry of our symbol. Jump back to the PLT entry and push an offset on the stack. That the offset is actually an…
ray an
  • 1,132
  • 3
  • 17
  • 42
1
vote
0 answers

Rebuilding executable images from memory

Is it doable? Are there any tools? I have an EXE compressed in a non-standard way and would like to get the decompressed version this way. Can relocation be undone or inverted, so that I can save a decompressed EXE version automatically? PS: this is…
1
vote
0 answers

fixing textrelocation library

I have a very important android native library which has text relocation problems. I have developed one android project using this library. It works well on Android devices which have Android OS version before 6.0, but this project is not working on…
1
vote
2 answers

Fix relocations for global variables in position-independent executables with GCC

I'm looking for a gcc command-line flag or other settings to produce GOTOFF relocations rather than GOT relocations for my statically linked, position-independent i386 executable. More details on what I was trying below. My source file g1.s looks…
pts
  • 80,836
  • 20
  • 110
  • 183
1
vote
1 answer

Issue faced on GLIBC_PRIVATE not defined during ansible container build

Code : container.yml version: '2' settings: conductor_base: centos:7 services: ansible.play_container: from: "play:8_jre_security" roles: - play_container ports: - "9000:9000" user: play command: ['app/xxx/docker-entrypoint.sh'] registries:…
1
vote
0 answers

Can't make sense of relocation R_x86_64_32s against '.data' error

I'm recently starting an assignment for a class, and I'm trying to implement my program but I cannot get it to compile for testing. I can't figure out what to do with the error I'm getting nor what it means. /usr/bin/ld: /tmp/ccPPQgOb.o:…
tiger123
  • 23
  • 7
1
vote
0 answers

Linux kernel address relocation

I don't understand a thing about the address relocation process of Linux at boot time. This process affects only virtual addresses or also the physical ones? I tried to figure it out by myself reading the Linux source code, but I'm still having the…