Linker script generator

I recently spent many hours trying to fix a problematic ld script. As soon as I drew (on paper) all the different sections, I could figure out the problem.

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

I know that there are some IDEs where you do not need to worry about LD scripts, but I use eclipse and it does not even offer syntax highlighting!

+6
source share
2 answers

To my knowledge, there are no generic tools for this purpose.

+2
source

I do not know any WYSIWYG editor for LD scripts, but I can help you graphically debug these problems.

I assume this was a run-time problem, not a compile-time problem. If so, 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 

Then the map file can be parsed using grep, or you can use the graphical viewer so that the file can debug problems with sections and symbols.

You can also use nm to get similar results from the associated executable:

 nm -S --size-sort a.out 
+3
source

Source: https://habr.com/ru/post/891553/


All Articles