[Cbe-oss-dev] ppu-ld can't link linux kernel anymore

Geoff Levand geoffrey.levand at am.sony.com
Fri Apr 25 11:17:56 EST 2008


Hi,

I found that the ppu-ld from the Cell SDK 3.0 can't properly
link the current linux mainline kernel.

A change in the kernel linker script introduced the use of the
linker script AT() function, and it seems the Cell SDK 3.0
ppu-ld doesn't handle that correctly.  The native ld from
Fedora 8 ppc work OK.

The kernel change is here:

  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=366234f657879aeb7a1e2ca582f2f24f3fae9269


The resulting vmlinux binary boots OK, but it cannot be stripped:

  BFD: /target/tool/boot/vmlinux.strip: section .text lma 0x0 overlaps previous sections
  BFD: /target/tool/boot/vmlinux.strip: section .ref.text lma 0x335000 overlaps previous sections
  BFD: /target/tool/boot/vmlinux.strip: section .devinit.text lma 0x335eec overlaps previous sections
  BFD: /target/tool/boot/vmlinux.strip: section .meminit.text lma 0x337454 overlaps previous sections
  BFD: /target/tool/boot/vmlinux.strip: section .rodata lma 0x339000 overlaps previous sections


I made a small test program below that isolates this
problem.  The output shows the results of using
. = 0xd000000000000000; vs. . = 0xc000000000000000;

---------
/* test.c */
void _start()
{}
---------
/* test.lds */
SECTIONS
{
/*	. = 0xd000000000000000; */
	. = 0xc000000000000000;

	.text : AT(ADDR(.text) - 0xc000000000000000) {. = ALIGN(8);}
	. = ALIGN(4096);
	.data : AT(ADDR(.data) - 0xc000000000000000) {*(.branch_lt)}
	. = ALIGN(4096);
	.opd : AT(ADDR(.opd) - 0xc000000000000000) {}
	. = ALIGN(4096);
	.bss : AT(ADDR(.bss) - 0xc000000000000000) {}
}
---------

$ /opt/cell/toolchain/bin/ppu-gcc -nostdlib -Wl,--script,test.lds -o test test.c && /opt/cell/toolchain/bin/ppu-objdump -h test

test:     file format elf64-powerpc

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         00000028  d000000000000000  1000000000000000  00010000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  d000000000001000  1000000000001000  00011000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  2 .opd          00000018  d000000000001000  1000000000001000  00011000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  3 .comment      00000012  0000000000000000  0000000000000000  00011018  2**0
                  CONTENTS, READONLY

$ /opt/cell/toolchain/bin/ppu-gcc -nostdlib -Wl,--script,test.lds -o test test.c && /opt/cell/toolchain/bin/ppu-objdump -h test

test:     file format elf64-powerpc

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         00000028  c000000000000000  c000000000000000  00010000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  c000000000001000  c000000000001000  00011000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  2 .opd          00000018  c000000000001000  c000000000001000  00011000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  3 .comment      00000012  0000000000000000  0000000000000000  00011018  2**0
                  CONTENTS, READONLY
---------






More information about the cbe-oss-dev mailing list