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
2
votes
0 answers

How does an operating system change a process's virtual base address?

To clarify, my specific confusion is centered around the fact that all instructions in a PE executable are written assuming the base image address is = 00400000. However, when debugging an executable, the addresses used adapt to whatever base image…
2
votes
0 answers

Shade a dependency in maven which is used by other dependency as well

I am stuck with one shading stuff, Need help if there is known way out. I have a project module which has bunch of dependencies and I want to shade and relocate one of the dependency. I did that, but the problem is the other dependency also uses the…
Quiyan H
  • 21
  • 1
2
votes
1 answer

DOS inserting segment addresses at runtime

I noticed a potential bug in some code i'm writing. I though that if I used mov ax, seg segment_name, the program might be non-portable and only work on one machine in a specific configuration since the load location can vary from machine to…
bad
  • 939
  • 6
  • 18
2
votes
1 answer

So most of the binary is composed of reloc table?

I just used objdump -x ... to check the sections of a PE file. There's about 90,000 lines of reloc entries: reloc 92 offset bc0 [524bc0] HIGHLOW reloc 93 offset bc4 [524bc4] HIGHLOW .... Does it hold true that the majority space of most…
compile-fan
  • 16,885
  • 22
  • 59
  • 73
2
votes
1 answer

C compiling: relocation truncated to fit R_X86_64_PC32 against symbol

/* my program author/date: me/now */ # include # define XX 1000 # define YY 20000 /* value of 1000 is ok */ # define ZZ 6000 /* global variable declaration */ int some_variable_this; int some_variable_that; double…
ron
  • 967
  • 6
  • 23
2
votes
1 answer

Is there an ELF equivalent of PE base relocations?

I've been looking at some disassembly of some ELF binaries and I noticed this: 0000000000401020 <_start>: 401020: 31 ed xor ebp,ebp 401022: 49 89 d1 mov r9,rdx 401025: 5e …
tzoz
  • 51
  • 3
2
votes
2 answers

relocation truncated to fit r_386_8 against .bss'

When I try to build my source into a 32-bit static executable for Linux with nasm -f elf -F dwarf -g loop.asm ld -m elf_i386 -o loop loop.o I get this R_386_8 error, any idea what causes it? foo.o: in function `loop1': foo.asm:(.text+0x12):…
Mase
  • 85
  • 2
  • 11
2
votes
2 answers

Why relocations (.reloc section) in executable file?

I wonder why some Windows executables do have relocations. Why is there a need for it when an executable always can be loaded at any virtual address, unlike a DLL?
def
  • 521
  • 4
  • 16
2
votes
2 answers

What is a relocatable program?

What are relocatable programs and what makes a program relocatable? From the OS memory management context, why programs (processes) need to be relocatable?
Mikeez
  • 127
  • 1
  • 10
2
votes
1 answer

Relocation truncated error in assembler

I'm totaly new to assembly language. I tried to make simple program to decipher a Caesar cipher. The problem is that after linking I get these errors: cezar.o: In function `loop': (.text+0xbf): relocation truncated to fit: R_X86_64_8 against…
Wylfryd
  • 55
  • 8
2
votes
1 answer

PE injection image relocation

All, I have been trying to figure this out for a couple of days now and I need some help. For a research project for work I have written some custom malware, the malware itself is not the issue here and I won't share any code, but I do need some…
2
votes
0 answers

ElasticSearch cluster auto relocation unbalanced

I have 7 nodes in my es cluster with the same cpu and memory. 5 of them have three 1T disks, the other 2 have only one 1T disk. I find that the shards on my cluster frequently relocate, but the disk usage is very unbalanced, for example as…
hello free
  • 21
  • 4
2
votes
1 answer

Runtime error in c++. Relocation protocol version %d

Please help me with following problem of transforming expression of spoj here is the link. It is giving runtime error. #include #include #include using namespace std; int main() { int testcases; cin >>…
Patel Parth
  • 315
  • 5
  • 16
2
votes
1 answer

What is the difference between PIC code and `ld -r`?

I know both are used to make code that can be placed in different locations, but how does each work, and why?
user6754053
2
votes
1 answer

How do I specify manual relocation for GCC code?

I am in a situation in an embedded system (an xtensa processor) where I need to manually override a symbol, but the symbol happens to be in the middle of another symbol. When I try using -Wl,--wrap=symbol it won't work, since the symbol isn't its…
Charles Lohr
  • 695
  • 1
  • 8
  • 23