Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to pass command line arguments to GNU LD to create a section, define size and place it in a specific memory?

I want to create a section in RAM, allocate a specific size and place it an an address? Is it possible to do all these operations without passing a linker script "file" or w/o modifying the existing linker script ?

.myspace :
{
        . = 0x10000;
        . = . + STACK_SIZE;
} > ram

Is it possible to do all the operation done by linker script in command line with GNU LD/GCC ?

like image 812
ted Avatar asked Jun 11 '14 06:06

ted


People also ask

What is the ld command used for?

Description. The ld command, also called the linkage editor or binder, combines object files, archives, and import files into one output object file, resolving external references. It produces an executable object file that can be run.

What is ld file in C?

The ld command language is a collection of statements; some are simple keywords setting a particular option, some are used to select and group input files or name output files; and two statement types have a fundamental and pervasive impact on the linking process.

What is a ld file?

An LD file is a script written in the GNU "linker command language." It contains one or more commands that are used to configure how input files storing static object code are to be compiled into a single executable program or library for the GNU operating system.


1 Answers

Seems like a way outdated answer, but anyway.

It's not possible to reserve the section size via ld command line options, but if the next section starts at the end of your special section, you can try something like this:

ld --section-start=.myspace=0x10000 -Ttext=0x11000 ...
like image 93
Iron Bug Avatar answered Oct 26 '22 00:10

Iron Bug