Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linker script generator

I recently spent many hours trying to fix a problematic ld script. Once I had drawn (on paper) all the different sections I could figure out the problem.

So I started searching for some sort of LD script generator, but could not find any! Does anybody know if such a tool exist? Something that can import/export ld scripts or map-file/elf-file and show the different objects/sections and the addresses?

I know there are some IDEs out there where you do not need to worry about LD-scripts but I am using eclipse and it does not even offer syntax highlighting!

like image 394
theAlse Avatar asked Jun 28 '11 13:06

theAlse


2 Answers

To my knowledge, there are no non-proprietary tools for this purpose.

like image 186
Rox Avatar answered Oct 22 '22 23:10

Rox


I don't know of any WYSIWYG editors for LD scripts but I may be able to help you graphically debug these types of problems.

I assume that this was a run-time problem and not a compile time problem. If that is the case then you can use the map output from the linker to get an idea of what is going on.

gcc -Wl,-Map=main.map main.c

The map file can then be parsed with grep or you can use a graphical viewer for the file to debug problems with sections and symbols.

You can also use nm to get similar results from a linked executable:

nm -S --size-sort a.out 
like image 43
CodePoet Avatar answered Oct 23 '22 00:10

CodePoet