relocation

What does the concept of relocation mean? [closed]

感情迁移 提交于 2019-11-29 03:36:30
I'm new to assembly and hence want to understand more about the concept of relocation. Why exactly do we need to relocate programs, data? How exactly is it done? It would be great if someone could explain with a beginner level example. The assembler has one source file to look at. It has to build a memory image based on that one source file. So it starts with 0 for the code, and also for 0 with the data. The results go into an object file. Now, the linker comes along and needs to combine many object files into an executable (or kernel image, or whatever). It can't leave everyone at 0, they

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

荒凉一梦 提交于 2019-11-28 02:02:30
问题 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 code, I couldn't believe it first. As far as I know, the elf file format supports relocations, just like the - in my eyes much better - Windows DLL system works: On Windows the linker relocates all the offsets in the DLLs, if this is necessary. I

What does the concept of relocation mean? [closed]

人盡茶涼 提交于 2019-11-27 17:41:11
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I'm new to assembly and hence want to understand more about the concept of relocation. Why exactly do we need to relocate programs, data? How exactly is it done? It would be great if someone could explain with a beginner level example. 回答1: The assembler has one source file to look

What do R_X86_64_32S and R_X86_64_64 relocation mean?

梦想的初衷 提交于 2019-11-26 14:28:45
Got the following error when I tried to compile a C application in 64-bit FreeBSD: relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC What is R_X86_64_32S relocation and what is R_X86_64_64 ? I've googled about the error, and it's possible causes - It'd be great if anyone could tell what R_X86_64_32S really means. The R_X86_64_32S and R_X86_64_64 are names of relocation types, for code compiled for the amd64 architecture. You can look all of them up in the amd64 ABI . According to it, R_X86_64_64 is broken down to: R_X86_64 - all names are prefixed with

What do R_X86_64_32S and R_X86_64_64 relocation mean?

 ̄綄美尐妖づ 提交于 2019-11-26 02:35:29
问题 Got the following error when I tried to compile a C application in 64-bit FreeBSD: relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC What is R_X86_64_32S relocation and what is R_X86_64_64 ? I\'ve googled about the error, and it\'s possible causes - It\'d be great if anyone could tell what R_X86_64_32S really means. 回答1: The R_X86_64_32S and R_X86_64_64 are names of relocation types, for code compiled for the amd64 architecture. You can look all of them

32-bit absolute addresses no longer allowed in x86-64 Linux?

我与影子孤独终老i 提交于 2019-11-25 22:17:33
问题 64 bit Linux uses the small memory model by default, which puts all code and static data below the 2GB address limit. This makes sure that you can use 32-bit absolute addresses. Older versions of gcc use 32-bit absolute addresses for static arrays in order to save an extra instruction for relative address calculation. However, this no longer works. If I try to make a 32-bit absolute address in assembly, I get the linker error: \"relocation R_X86_64_32S against `.data\' can not be used when