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

Eclipse CDT ELF Parser unnable to parse debug file

TL;DR CDT ELF parser and ObjDump cannot parse my relocatable file, but both work properly with Executable File. I wonder if they are related. ObjDump has wrong abbrev offsets, CDT parser throws BufferUnderflowException The Problem I'm working with…
souzaviv
  • 21
  • 4
2
votes
2 answers

How to get rid of DLL .reloc section using MinGW-gcc?

I'm building vtables by hand in C. When exported from a DLL, they generate a lot of entries in its relocation table. Sample objdump output: Virtual Address: 00002000 Chunk size 24 (0x18) Number of fixups 8 reloc 0 offset 0 [2000] HIGHLOW …
Philip
  • 271
  • 1
  • 15
2
votes
1 answer

ELF Relocation Types on MSP430

I have to take a relocatable ELF file and fix the addresses in a MSP430-F5529 with red hat compiler (not TI). However, I don't understand how the relocations have to be made as I don't get the notation used. Here are the types and their…
UDKOX
  • 738
  • 3
  • 15
2
votes
2 answers

Assembly relocation truncated to fit

Hi I've been trying to write a simple hello world program in assembly and compile it into a .o file, then link it with the standard C library to create a .exe so that I can view the disassembly for 'puts' on my system using gdb -tui. I am using…
v3nd3774
  • 55
  • 2
  • 8
2
votes
1 answer

Moving the ELF64 relocation table

I'm attempting to move the .rela.plt relocation table of a shared object to the end of the file (Because I'm going to add new relocation entries in the future). First, I read all entries in the .rela.plt section. The original section is at offset…
kubuzetto
  • 1,046
  • 1
  • 12
  • 31
2
votes
1 answer

How to resolve "relocation truncated to fit: R_X86_64_PC32 against undefined symbol `xercesc_3_1::AbstractDOMParser::adoptDocument()'"

I am trying to build a C++ program in Eclipse that uses a library xerces-c-3.1.1-x86_64-linux-gcc-3.4 (binary). I see the below errors ... relocation truncated to fit: R_X86_64_PC32 against undefined symbol…
user4815418
2
votes
1 answer

How to create a subversion repository from local working copy and keep logs and history?

I have a local working copy of a subversion repository. The server for this project does not exist anymore but I would like to use the working copy I have to create a new local repository that keeps logs and history of the project if possible. I…
VinzO
  • 37
  • 1
  • 7
2
votes
2 answers

Howto extend SomeActivity to relocate e.g. onCreateOptionsMenu?

I know this should be fairly simple but I don't get it anyhow. I've got an Activity (let's call it XyActivity) which has gotten pretty long. Therefore, I'd like to relocate some overriden methods to a subclass (let's call it XyOptions). Looks like…
stfn
  • 1,140
  • 5
  • 19
  • 33
2
votes
1 answer

GCC inline asm: how to use variable address as immediate operand in a shared lib?

The following code compiles into an executable with no problems: static const char *foo = "bar"; void main(void) { __asm__ ("mov %0,%%rax" : : "i"(&foo) : "%rax"); } But as a shared lib, I get an…
Byron Hawkins
  • 2,536
  • 2
  • 24
  • 34
2
votes
1 answer

Django not finding my static files

I'm trying to reorganize my project, as the files in it are very unorganized. There is a static folder in the main project folder that should only have all of the apps. So I'm relocating some of the .js files into their respective apps. One of the…
skullkid
  • 448
  • 4
  • 13
2
votes
1 answer

How does code know the addresses of API functions?

Once again, sorry for the bad title. So I've been researching the PE format the last week, and I didn't quite get something. When a process loads, all the DLL's get mapped into memory. What I don't understand is, because a DLL can get loaded at a…
user2073973
  • 564
  • 6
  • 21
2
votes
1 answer

Create .SO files on Linux without using PIC (position independent code) (x86 32bit)

As far as I know, x86 assembly code is very much constrained by the limited amount of registers. When I learnt that on Linux, to create a .so file, one has to specify the -fPIC command line argument to gcc in order to create position independent…
Christian
  • 2,903
  • 4
  • 31
  • 34
2
votes
1 answer

Use relocated dependencies in child projects

Heyho, I'm currently developing a bukkit plugin and I want to use guava. Bukkit still uses Guava 11.0, but I want to use 14.0. So I tried to relocate guava in my main module. This worked perfectly. An other module on the same level uses guava too…
maxammann
  • 1,018
  • 3
  • 11
  • 17
2
votes
1 answer

SVN update not working after SVN relocate

I have recently migrated my SVN repository from SERVER1 to SERVER2. installed SVN on SERVER2. used svnrdump utility to dump the repository. used svndump load utility to load the dump file to new svn server. I checked out a working copy WC from…
Learn More
  • 1,535
  • 4
  • 29
  • 51
2
votes
1 answer

Using GNU ld, how can I force the address of a specific (external) symbol without getting a "relocation truncated" error?

I have two functions, a() and b(), that both have specific, fixed load/run-time addresses. I am compiling a() myself, while b() is already provided (e.g. in ROM). The file a.c is as follows: extern void b(void); void a(void) { b(); } This…
Vegard
  • 2,081
  • 1
  • 17
  • 26