Skip to contentSkip to conversation

linker scripts

U-Boot Jason 2 participants 2 messages Apr 26, 2012 – Apr 27, 2012

lore
Share & tools
lore

Jason

author
#0 lore raw

All,

I know this is a little off topic, but u-boot is the only project I've found implementing a feature I'd like to add to a project. Specifically, the macro U_BOOT_CMD() and it's use of section(".u_boot_cmd").

I'd like to implement something similar in a userspace C program, but I can't get it to work. A lot of my searches on the net for my various errors leads me to believe I should let gcc do the linking and not mess with ld.

I've gotten to the point where it compiles cleanly, but then I get 'No such file or directory" from bash when trying to run the resulting executable. (Using ld)

Is there a succinct way to use the modified output of 'ld -v' from gcc so that I can place the array of structs between _blah_start and _blah_end?

I've tried 'gcc -Wl,-T,mylink.lds -Wl,-u_blah_thisone ...' and that compiles fine, and runs, but there is no struct found when I iterate from _blah_start to _blah_end. The output of 'strings a.out | grep _blah' gives only _blah_end. I'm a bit out of my depth here. Any help appreciated.

thx,

Jason.

#1 lore raw
Quoted 4 lines · On Thursday 26 April 2012 00:16:24 Jason wrote:

I know this is a little off topic, but u-boot is the only project I've found implementing a feature I'd like to add to a project. Specifically, the macro U_BOOT_CMD() and it's use of section(".u_boot_cmd").

what is it you want to do ? a list of func pointers to execute ? can't you do this with constructor attributes ?

Quoted 4 lines

I'd like to implement something similar in a userspace C program, but I can't get it to work. A lot of my searches on the net for my various errors leads me to believe I should let gcc do the linking and not mess with ld.

a better place would probably be the binutils mailing list
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120427/72262979/attachment.pgp>