tech-toolchain archive

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

Re: gcc-4.8 + ld issue for standalone programs

On Sat, Jan 04, 2014 at 01:26:26AM +0000, David Holland wrote:
> On Fri, Jan 03, 2014 at 09:48:50PM +0000, Christos Zoulas wrote:
>  > With gcc-4.5 all of the code ended up in text segment (for our purposes
>  > here), so by invoking:
>  > 
>  >    gcc -N -Ttext 0xfooaddress -e barsymbol file-with-barsymbol-first.o ...
>  > 
>  > We got the first instruction of barsymbol to be at 0xfooaddress.
>  > 
>  > This now changes with gcc-4.8, because it puts things in other subsections
>  > of .text and those come first in the linker -N description file (typically
>  > machine-type.xbn). Here's an example for the elf_i386.xbn
>  > [snip]
> The entry point for a kernel image isn't exactly performance-critical,
> so how about leaving all the ordinary sections alone and inserting a
> .text.entry section that goes first, which contains:
>    j __start
> (for suitable values of "j" and "__start" depending on the machine and
> all that)
> Also, it might be a good idea to insert some makefile logic that uses
> nm or objdump to make sure things came out right.

I suspect the problems are with things like bootxx_ffsv1 and /boot
which have very specific requirements on the start of the text segment.

In most cases the code that loads the actual kernel is capable of
reading the entry point from the elf (or whatever) file.


David Laight:

Home | Main Index | Thread Index | Old Index