[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: How to generate and Loade a "Relocatable and executable ELF" file

From: ravinder are
Subject: Fwd: How to generate and Loade a "Relocatable and executable ELF" file under ARM
Date: Thu, 18 Feb 2010 10:46:24 +0530

Hi Philip,
Thanks for the reply.
I am trying to write a small tiny ELF loader.
My idea is to generate a Relocatable ELF executable file(not object file/shared file) or a position independent code ELF executable.
And Load that ELF at user specified address and run it as a seperate thread in the same process.
I have implemeted a small loader code, in that it will parse the ELF file decides the size of ELF (size of all text , data, BSS sections), and allocates memory for that size, copies the ELF and starts a new thread with starting point of memory where the ELF copied. This concept is working fine.
And at Test ELF side ,   I have tried to generate an ELF with a know  RO-Base address(i.e. the address i got by malloc() in my loader module) , I copied the ELF to the same location that I gave as RO-Base address. This is Working fine.
But Now i want my loader to have the ability to load a relocatable/ position independent code ELF to any address and run it as a new thread.
Please give me some inputs for both LOADER part and Test ELF part(compiler and linker options for elf generation for both relocatable and PIC)
Do i need to do any work in my loader like setting the CODE base register, DATA base regiset and Stack poiter etc.
On Thu, Feb 18, 2010 at 2:13 AM, Philip Guenther <address@hidden> wrote:
On Tuesday, February 16, 2010, ravinder are <address@hidden> wrote:
> I want to build my ELF executable as relocatable under ARM platform, Please specify the correct compiler and linker options for this.
> And also I want load this relocatable ELF dynamically to any location, please let me know how to load this.

I *think* you're looking for the -pie option for compiling and linking
Position Independent Executables, but
1) I don't know if we support PIE on ARM, and
2) it's not completely clear what you're trying to do.

Kurt's slides about the OpenBSD PIE implementation from, IIRC,
DCBSDcon might answer the former.  Of course, only you can answer the
latter: "what problem are you trying to solve?"

Philip Guenther

reply via email to

[Prev in Thread] Current Thread [Next in Thread]