This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: freebsd, binutils-2.9.1 and arm-aout




On Tue, 6 Jun 2000, Richard Earnshaw wrote:

> 
> I'm sorry, but I don't fully understand what your problem is.
> 
> When you have BEFORE set to 1, the first symbol in your object file is 
> _start, so the entry point to your file is the same as the load address.
> 
> When you have BEFORE set to 0, the first symbol in your object file is 
> _main, and _start follows it.  So while the load address of the file 
> remains at 0x8000 (the default load address), the entry point has changed 
> to 0x8044.

The problem is that file offset changes from 0x8000 to 0x20.

> 
> Richard.

Thanks,

Aleksey

> 
> > 
> > Hi, 
> > 
> > I had built  a set of tools implementing arm-unknown-aout from
> > binutils-2.9.1, newlib-1.8.2 and gcc-2.95.2 and a few patches
> > found on the net. 
> > 
> > It seems like linker has a bug. I am using following command
> > to build a test program:
> > 
> >         $(CC) $(CFLAGS) -o tst -nostartfiles -Wl,-e,_start tst.c
> > 
> > Test program is below:
> > 
> > 
> > #include <stdio.h>
> > 
> > #define BEFORE 1
> > 
> > #if BEFORE
> > void
> > start(void)
> > {
> > }
> > #endif
> > 
> > int
> > main(int argc, char *argv[])
> > {
> >    printf("Hello, world\n");
> > 
> >    return 0;
> > }
> > 
> > #if !BEFORE
> > void
> > start(void)
> > {
> > }
> > #endif
> > 
> > 
> > It has OK file header:
> > 
> > tst:     file format a.out-arm-little
> > tst
> > architecture: arm, flags 0x000001be:
> > EXEC_P, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS, WP_TEXT, D_PAGED
> > start address 0x00008000
> > 
> > Sections:
> > Idx Name          Size      VMA       LMA       File off  Algn
> >   0 .text         00010000  00008000  00008000  00008000  2**4
> >                   CONTENTS, ALLOC, LOAD, CODE
> >   1 .data         00008000  00018000  00018000  00018000  2**4
> >                   CONTENTS, ALLOC, LOAD, DATA
> >   2 .bss          00000000  00020000  00020000  00000000  2**4
> >                   ALLOC
> > 
> > However,once I change BEFORE to 0, the file header will beecome
> > 
> > tst:     file format a.out-arm-little
> > tst
> > architecture: arm, flags 0x000001be:
> > EXEC_P, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS, WP_TEXT, D_PAGED
> > start address 0x00008044
> > 
> > Sections:
> > Idx Name          Size      VMA       LMA       File off  Algn
> >   0 .text         0000ffe0  00008000  00008000  00000020  2**4
> >                   CONTENTS, ALLOC, LOAD, CODE
> >   1 .data         00008000  00018000  00018000  00010000  2**4
> >                   CONTENTS, ALLOC, LOAD, DATA
> >   2 .bss          00000000  00020000  00020000  00000000  2**4
> >                   ALLOC
> > 
> > Which is incorrect because text will still be located at offset
> > 0x8000 in the file.
> > 
> > So, I am quite puzzled to say the least, is it a known bug ?
> > 
> > Thanks,
> > 
> > Aleksey
> > 
> > 
> >  
> > 
> > 
> > 
> > 
> > ------
> > Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> > Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
> > 
> 
> 


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]