[U-Boot] [SOT] linker scripts

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.

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 ?
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
participants (2)
-
Jason
-
Mike Frysinger