I have a program that places some structs in a named section using __attribute__ ((".sdh_ble_observers"))
and extern mytype * ___start_sdh_ble_observers
.
I'm using the following linker script
SECTIONS
{
.sdh_ble_observers :
{
PROVIDE(___start_sdh_ble_observers = .);
KEEP(*(SORT(.sdh_ble_observers*)))
PROVIDE(___stop_sdh_ble_observers = .);
}
}
INSERT AFTER .data;
When I use g++ to link the application using the -T flag for the linker script, the executable becomes un-executable cannot execute binary file: Exec format error
.
When I remove the extern declarations in the code and don't use the -T flag in g++ the executable runs fine.
What can be the cause of this? The platform is cygwin.