[PATCH] Use .init_array, .fini_array sections for ARM EABI (broke -target=avr)

Mark Mitchell mark@codesourcery.com
Sun May 1 17:11:00 GMT 2005


Joseph S. Myers wrote:
> On Sat, 30 Apr 2005, Mark Mitchell wrote:
> 
> 
>>Joseph S. Myers wrote:
>>
>>
>>>/usr/ccs/bin/ld: Unsatisfied symbols:
>>>   __main (first referenced in build/genmodes.o) (code)
>>>collect2: ld returned 1 exit status
>>>make[2]: *** [build/genmodes] Error 1
>>
>>Has this configuration always used __main, but now we fail to define it?  Or
>>are we now calling it where before we did not?
> 
> 
> Previously (with a 2005-04-29 compiler), "int main(){return 0;}" compiles 
> to code not calling __main.  Now (with a 2005-04-30 compiler) it compiles 
> to code calling __main.

I believe this patch will fix the problem.  The key mistake was that we 
were failing to check HAS_INIT_SECTION in deciding whether or not to 
call __main.  I think that when I wrote the original version of this 
patch I mistakenly believed that HAS_INIT_SECTION would be defined iff 
INIT_SECTION_ASM_OP was defined; that is not true.

I have tested this patch by looking at the assembly output from 
compiling a file that defines "main" on hppa2.0w-hp-hpux11.23, and am 
running a full bootstrap/test on x86_64-unknown-linux-gnu; I will check 
in once that finishes.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050501/25cfc09f/attachment.ksh>


More information about the Gcc-patches mailing list