source: rtems/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds @ f419349

5
Last change on this file since f419349 was f419349, checked in by Sebastian Huber <sebastian.huber@…>, on May 27, 2019 at 8:14:48 AM

bsps/powerpc: Adjust ppcboot.lds

The GNU ld had a couple of changes which resulted in a broken bootloader
image generation. Recent linker versions tie assignments to their
nearest output section statement. Place all absolute symbols which are
used with @sectoff relocations into a special section.

See also:

"Binutils 2.28 on PowerPC: dangerous relocation: generic linker can't
handle R_PPC_SECTOFF_HA"

https://www.sourceware.org/ml/binutils/2019-05/msg00183.html

Update #3727

  • Property mode set to 100644
File size: 2.3 KB
Line 
1OUTPUT_ARCH(powerpc)
2OUTPUT_FORMAT ("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
3/* Do we need any of these for elf?
4   __DYNAMIC = 0;    */
5SECTIONS
6{
7  .text :
8  {
9    /* We have to build the header by hand, painful since ppcboot
10        format support is very poor in binutils.
11        objdump -b ppcboot zImage --all-headers can be used to check. */
12    /* The following line can be added as a branch to use the same image
13     * for netboot as for prepboots, the only problem is that objdump
14     * did not in this case recognize the format since it insisted
15     * in checking the x86 code area held only zeroes.
16     */
17    LONG(0x48000000+start);
18    . = 0x1be; BYTE(0x80); BYTE(0)
19    BYTE(2); BYTE(0); BYTE(0x41); BYTE(1);
20    BYTE(0x12); BYTE(0x4f); LONG(0);
21    BYTE(((_edata + 0x1ff)>>9)&0xff);
22    BYTE(((_edata + 0x1ff)>>17)&0xff);
23    BYTE(((_edata + 0x1ff)>>25)&0xff);
24    . = 0x1fe;
25    BYTE(0x55);
26    BYTE(0xaa);
27    BYTE(start&0xff);
28    BYTE((start>>8)&0xff);
29    BYTE((start>>16)&0xff);
30    BYTE((start>>24)&0xff);
31    BYTE(_edata&0xff);
32    BYTE((_edata>>8)&0xff);
33    BYTE((_edata>>16)&0xff);
34    BYTE((_edata>>24)&0xff);
35    BYTE(0); /* flags */
36    BYTE(0); /* os_id */
37    BYTE(0x4C); BYTE(0x69); BYTE(0x6e);
38    BYTE(0x75); BYTE(0x78); /* Partition name */
39    . = 0x400;
40    *(.text)
41    *(.sdata2)
42    *(.rodata)
43    *(.rodata*)
44  }
45/*  . = ALIGN(16); */
46  .image :
47  {
48    rtems.gz(*)
49    . = ALIGN(4);
50    *.gz(*)
51  }
52  /* Read-write section, merged into data segment: */
53  /* . = ALIGN(4096); */
54  .reloc   :
55  {
56    *(.got)
57    _GOT2_TABLE_ = .;
58    *(.got2)
59    _FIXUP_TABLE_ = .;
60    *(.fixup)
61    _FIXUP_END_ = .;
62  }
63
64  .handlers :
65  {
66    *(.exception)
67  }
68
69  .data    :
70  {
71    *(.data)
72    *(.data*)
73    *(.sdata)
74    . = ALIGN(4);
75    _data_end = .;
76  }
77  .bss :
78  {
79    *(.sbss)
80    *(.bss)
81    . = ALIGN(4);
82  }
83  .abs 0 : {
84    __got2_entries = ABSOLUTE((_FIXUP_TABLE_ - _GOT2_TABLE_) >>2);
85    __fixup_entries = ABSOLUTE((_FIXUP_END_ - _FIXUP_TABLE_)>>2);
86    _edata = ABSOLUTE(_data_end);
87    PROVIDE(_binary_initrd_gz_start = ABSOLUTE(0));
88    PROVIDE(_binary_initrd_gz_end = ABSOLUTE(0));
89    _rtems_gz_size = ABSOLUTE(_binary_rtems_gz_end - _binary_rtems_gz_start);
90    _rtems_size = ABSOLUTE(__rtems_end - __rtems_start);
91    __bss_words = ABSOLUTE(SIZEOF(.bss)>>2);
92    __size = ABSOLUTE(.);
93  }
94
95  /DISCARD/ :
96  {
97    *(.comment)
98  }
99}
100
Note: See TracBrowser for help on using the repository browser.