Re: Controlling ld and as with GCC-Backend

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

 



2013/3/18 Jens Mehler <jens.mehler@xxxxxxxxxx>:
> Hi Jasonwucj,
>
> I implemented the start.o and end.o.
> Fixed some errors in my binutils by letting the default functions taking
> care of relaction and just adjust the reloc entries to the correct values.
> Thanks for all your help!
> ~ Jens
>

Hi Jens,

Oh~ so the problem is caused by binutils relocation?
It's great that you found the solution. :)

I do enjoy writing a new GCC backend as much as you did.
So it is my pleasure to share another tip with you about startup stuff.
(Because you said that you know the crt0.o comes with the clibrary but
 not presented at the moment.)

According to your first mail, I assume your target is 'eco32'.
It is supposed that you have your own makefile fragment t-eco32 (or
other file name)
under libgcc/config/eco32 directory and modified libgcc/config.host to use it.

Before your c library is ready, you can add some rules in the
makefile fragment to produce preliminary startup object file.

For example:

# Use this rule if and only if your startup stuff do not come from C library
# Also, be sure to add 'start.o' and 'end.o' in extra_parts in
libgcc/config.host
# and make changes on STARTFILE_SPEC/ENDFILE_SPEC in eco32.h

start.o: $(srcdir)/config/eco32/start.S $(GCC_PASSES) $(CONFIG_H)
        $(GCC_FOR_TARGET) $(INCLUDES) \
        -c $(srcdir)/config/eco32/start.S -o start.o

end.o: $(srcdir)/config/eco32/end.S $(GCC_PASSES) $(CONFIG_H)
        $(GCC_FOR_TARGET) $(INCLUDES) \
        -c $(srcdir)/config/eco32/end.S -o end.o


With such rules, you will have start.o and end.o after building libgcc.
The target macros STARTFILE_SPEC/ENDFILE_SPEC will guide linker to
create binary correctly. You do not need to create binary by hand~~ :p

Hope it helps. :)


Best regards,
jasonwucj


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux