avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Is there a reason why avr-gcc does not support constr


From: Senthil Kumar Selvaraj
Subject: Re: [avr-gcc-list] Is there a reason why avr-gcc does not support constructor priority (both in C and C++ worlds)?
Date: Tue, 18 Mar 2014 22:49:41 +0530
User-agent: Mutt/1.5.22 (2013-10-16)

On Tue, Mar 18, 2014 at 11:51:33AM +0000, David Fernandez wrote:
> Hi there,
> 
> I've been trying to use both the attributes "init_priority" for C++, and
> "constructor" for C, with priority numbers, in atxmega{16,32}a4u, and the
> compiler complains saying "error: 'init_priority' attribute is not supported
> on this platform", or "error: constructor priorities are not supported".

This features requires the target backend to opt in (by declaring
SUPPORTS_INIT_PRIORITY) to a non-zero value. The avr backend doesn't, even on 
the latest sources, so newer versions don't have it either.

I checked out what the x86_64 target does with init_priority. It actually

* generates individual intitializer functions for each unique priority
* generates a .init_array.<priority> section for each unique priority
  and puts a pointer to the initializer function inside it.
* These input sections are sorted in the linker script with 
SORT_BY_INIT_PRIORITY, instead of just SORT to so that the linker will
do a numerical sort on priority.

I don't see a reason to not support this though. Can you please file a
bug so we can track this?

Regards
Senthil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]