microblaze-elf - missing priority for the constructors
nick clifton
nickc@redhat.com
Fri Mar 30 16:10:00 GMT 2012
Hi Christophe,
> I cross-compiled GCC 4.6.3 and binutil 2.22 for microblaze
> and I came into a problem when trying an eCos RTOS based application.
> The constructors table is not sorted by priority, actually the priority
> seem to be gone. I have added this template in the linker script:
Strange - that should not be needed. The built-in microblaze linker
script already includes support for sorting constructors:
% microblaze-elf-ld --verbose
[...]
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
[...]
> The result of the constructor section is the following:
>
> .ctors 0x0000000090092030 0x4 /tmp/ecos/spartan3adsp_net/install/lib/libtarget.a(compat_posix_pthread.o)
>
> With
> a similar application compiled with powerpc-eabi
>
> .ctors.07535 0x00150684 0x4 /tmp/ecos/mpc8572ds_net/install/lib/libtarget.a(compat_posix_pthread.o)
I suspect that this is en eCos issue, rather than a linker one. My
guess would be that the eCos configuration/build system is deciding that
the microblaze toolchain does not support constructor/destructor
priorities, and so it is not bothering to annotate the constructor
section names with their priority.
Have a look at the eCos configuration logs. Maybe you can find
something there.
Cheers
Nick
More information about the Binutils
mailing list