How do I get ld to pull sections from archived objects?

David Fernandez david.fernandez.work@googlemail.com
Wed Aug 21 10:23:00 GMT 2013


Hi there,

I've been trying for arm-eabi-ld (binutils 2.23.2, gcc 4.8.1, newlib
top-of tree) to pick data sections from archived objects, but it
silently ignores them. For instance:

SECTIONS
{
...
    my_special_thing ORIGIN(rom) : {
        KEEP(*(my_special_thing))
    }
...
}

If all the objects containing "my_special_thing" section are in
archives, this section never makes it to the final elf file.

I've also learn that using archive specifiers doesn't work either:

SECTIONS
{
...
    my_special_thing ORIGIN(rom) : {
        KEEP(myspecials:*(my_special_thing))
    }
...
}

as, ld keeps silently ignoring that (I've tried all forms, i.e. full
archive name and extension, with wildcards after and before, the
archive without the lib prefix, etc.), the ":" archive specifier seems
completely broken..

The only way seems to be to refer to actual object files, or, if some
dependency pulls a file from the archive for other reasons, then
"my_special_thing" section gets considered in the input section
specification above.

Is this expected? What am I doing wrong? Am I missing some command-line option?

Let me know if you need more details or to try something.

Regards.



More information about the Binutils mailing list