This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: PowerPC linking error messages


>-----Original Message-----
>From: eddy@fericom.net [mailto:eddy@fericom.net]
>Sent: 04 February 2002 19:29


  Hi again Eddy!


>- I use the -S option with GCC to learn about the confusing guts of RISC
>  assembler. Is there an option to GCC to add the C lines that produced the
>  assembler as comments? I only found -fverbose-asm but that didn't do.

  Yes, the compiler doesn't seem to have any way to do this.  The best 
option is to build your code using -g and -O0, then use objdump like:

    powerpc-eabi-objdump -SD <.o file name>

to get a listing back.

>- What does the __eabi() function do?

  It calls all the constructors for all the static class objects in the 
application.  All the class objects must be constructed correctly before
the application starts running, so the compiler inserts the call to __eabi
at the start of main(...) and the linker builds a table of pointers to
each constructor routine and puts it in the .ctors section.  If you aren't
using static C++ objects you can ignore this or replace it with an empty
dummy function.

>- If I compile my code as S-records and download it, how do I generate a
>  file with symbols and debugging information for GDB?

  Compile it initially as ELF, with debugging info.  Use objcopy like:

   powerpc-eabi-objcopy -O srec <.o file name> <output srec file name>

to convert the ELF file to an SREC version with the debug info stripped out.

Download the SREC version, but tell GDB the path to the full ELF .o file.

>- How is the GOT accessed the first time? I didn't find any
>  dedicated register that contains the value of the GOT and in the 
>  EABI there is no initial stack provided by the OS. This lets me 
>  guess, that also if you want relocatable code the adress of the 
>  GOT is specified at linking time...

>- Can I tell GCC to produce code that uses absolute 
>  adressing insted of having a GOT?  I know this can cost 
>  performance but for the start it would make things easier...

>- Currently I am compiling without libc or newlib. To enter a C routine 
>  from my assembler initialisation do I need to set something else than 
>  the stack pointer? (I am using -msdata=none, so there should not be
>  any sdata pointer registers that need initialisation). 

  I'll have to get back to you later on these questions; the answers center
on the fact that the crt0 (C runtime lib startup) code is responsible for
these areas, with a bit of help from the linker.

  You definitely can make GCC not output nor use a GOT, I think it's as
simple as just *not* using -fpic, but need to look that up.

  Don't forget not just to set up your stack but to set it up aligned to 8
bytes before entering the code.  Apart from that I would recommend you get
newlib going, as then the CRT code can take care of all these problems for
you!

>OK, I guess if I asked more you would kick me off the list (:

  Nope, not me, I'm not in charge, I'm just a loudmouth!

>If there is any FAQ where I should look instead, please tell
>me where.

  I don't know of any FAQs; to answer your questions I'd have to go and
re-read the (E)ABI documentation myself, then look at the crt0.s code from
newlib, and try and work it out.  Make sure you have read the gcc.info
(texinfo format) files that are built when you build the compiler, as
they are more up-to-date and complete than any of the other docs and faqs
around, and if you build newlib you'll find that also has some .info files
explaining how the internals are structured.  Apart from that I can only
offer generic advice such as searching google and talking to people on
newsgroups like comp.compilers or comp.arch.embedded etc.


         DaveK
-- 
Burn your ID card!  http://www.optional-identity.org.uk/
Help support the campaign, copy this into your .sig!


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

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


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