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 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.

David A. Holland

Home | Main Index | Thread Index | Old Index