]> Git Repo - binutils.git/blob - ld/scripttempl/elfppc.sc
Add support for .got1 and .got2 sections; Offset _GLOBAL_OFFSET_TABLE_ by 32768 from...
[binutils.git] / ld / scripttempl / elfppc.sc
1 #
2 # Unusual variables checked by this code:
3 #       NOP - two byte opcode for no-op (defaults to 0)
4 #       DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
5 #       OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ...
6 #               (e.g., .PARISC.milli)
7 #       OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ...
8 #               (e.g., .PARISC.global)
9 #       OTHER_SECTIONS - at the end
10 #       EXECUTABLE_SYMBOLS - symbols that must be defined for an
11 #               executable (e.g., _DYNAMIC_LINK)
12 #       TEXT_START_SYMBOLS - symbols that appear at the start of the
13 #               .text section.
14 #       DATA_START_SYMBOLS - symbols that appear at the start of the
15 #               .data section.
16 #       OTHER_BSS_SYMBOLS - symbols that appear at the start of the
17 #               .bss section besides __bss_start.
18 #       DATA_PLT - .plt should be in data segment, not text segment.
19 #
20 # When adding sections, do note that the names of some sections are used
21 # when specifying the start address of the next.
22 #
23 test -z "$ENTRY" && ENTRY=_start
24 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
25 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
26 test "$LD_FLAG" = "N" && DATA_ADDR=.
27 INTERP=".interp   ${RELOCATING-0} : { *(.interp)        }"
28 PLT=".plt    ${RELOCATING-0} : { *(.plt)        }"
29 cat <<EOF
30 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
31               "${LITTLE_OUTPUT_FORMAT}")
32 OUTPUT_ARCH(${ARCH})
33 ENTRY(${ENTRY})
34
35 ${RELOCATING+${LIB_SEARCH_DIRS}}
36 ${RELOCATING+/* Do we need any of these for elf?
37    __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
38 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
39 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
40   if gld -r is used and the intermediate file has sections starting
41   at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
42   bug.  But for now assigning the zero vmas works.  */}
43 SECTIONS
44 {
45   /* Read-only sections, merged into text segment: */
46   ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
47   ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
48   ${CREATE_SHLIB-${INTERP}}
49   .hash        ${RELOCATING-0} : { *(.hash)             }
50   .dynsym      ${RELOCATING-0} : { *(.dynsym)           }
51   .dynstr      ${RELOCATING-0} : { *(.dynstr)           }
52   .rel.text    ${RELOCATING-0} : { *(.rel.text)         }
53   .rela.text   ${RELOCATING-0} : { *(.rela.text)        }
54   .rel.data    ${RELOCATING-0} : { *(.rel.data)         }
55   .rela.data   ${RELOCATING-0} : { *(.rela.data)        }
56   .rel.rodata  ${RELOCATING-0} : { *(.rel.rodata)       }
57   .rela.rodata ${RELOCATING-0} : { *(.rela.rodata)      }
58   .rel.got     ${RELOCATING-0} : { *(.rel.got)          }
59   .rela.got    ${RELOCATING-0} : { *(.rela.got)         }
60   .rel.got1    ${RELOCATING-0} : { *(.rel.got1)         }
61   .rela.got1   ${RELOCATING-0} : { *(.rela.got1)        }
62   .rel.got2    ${RELOCATING-0} : { *(.rel.got2)         }
63   .rela.got2   ${RELOCATING-0} : { *(.rela.got2)        }
64   .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)        }
65   .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)       }
66   .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)        }
67   .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)       }
68   .rel.init    ${RELOCATING-0} : { *(.rel.init) }
69   .rela.init   ${RELOCATING-0} : { *(.rela.init)        }
70   .rel.fini    ${RELOCATING-0} : { *(.rel.fini) }
71   .rela.fini   ${RELOCATING-0} : { *(.rela.fini)        }
72   .rel.bss     ${RELOCATING-0} : { *(.rel.bss)          }
73   .rela.bss    ${RELOCATING-0} : { *(.rela.bss)         }
74   .rel.plt     ${RELOCATING-0} : { *(.rel.plt)          }
75   .rela.plt    ${RELOCATING-0} : { *(.rela.plt)         }
76   .init        ${RELOCATING-0} : { *(.init)     } =${NOP-0}
77   ${DATA_PLT-${PLT}}
78   .text    ${RELOCATING-0} :
79   {
80     ${RELOCATING+${TEXT_START_SYMBOLS}}
81     *(.text)
82     /* .gnu.warning sections are handled specially by elf32.em.  */
83     *(.gnu.warning)
84   } =${NOP-0}
85   ${RELOCATING+_etext = .;}
86   ${RELOCATING+PROVIDE (etext = .);}
87   .fini    ${RELOCATING-0} : { *(.fini)    } =${NOP-0}
88   .rodata  ${RELOCATING-0} : { *(.rodata)  }
89   .rodata1 ${RELOCATING-0} : { *(.rodata1) }
90   ${RELOCATING+${OTHER_READONLY_SECTIONS}}
91
92   /* Read-write section, merged into data segment: */
93   ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
94   .data  ${RELOCATING-0} :
95   {
96     ${RELOCATING+${DATA_START_SYMBOLS}}
97     *(.data)
98     ${CONSTRUCTING+CONSTRUCTORS}
99   }
100   .data1 ${RELOCATING-0} : { *(.data1) }
101   ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
102   .ctors       ${RELOCATING-0} : { *(.ctors) }
103   .dtors       ${RELOCATING-0} : { *(.dtors) }
104
105   ${RELOCATING+_GOT1_START_ = .;}
106   .got1 ${RELOCATING-0} :  { *(.got1) }
107   ${RELOCATING+_GOT1_END_ = .;}
108
109   ${RELOCATING+_GOT2_START_ = .;}
110   .got2 ${RELOCATING-0} :  { *(.got2) }
111   ${RELOCATING+_GOT2_END_ = .;}
112
113   ${RELOCATING+_GOT_START_ = .;}
114   ${RELOCATING+_GLOBAL_OFFSET_TABLE_ = . + 32768;}
115   ${RELOCATING+_SDA_BASE_ = .;}
116   .got         ${RELOCATING-0} : { *(.got.plt) *(.got) }
117   ${RELOCATING+_GOT_END_ = .;}
118   .dynamic     ${RELOCATING-0} : { *(.dynamic) }
119   ${DATA_PLT+${PLT}}
120   /* We want the small data sections together, so single-instruction offsets
121      can access them all, and initialized data all before uninitialized, so
122      we can shorten the on-disk segment size.  */
123   .sdata   ${RELOCATING-0} : { *(.sdata) }
124   ${RELOCATING+_edata  =  .;}
125   ${RELOCATING+PROVIDE (edata = .);}
126   ${RELOCATING+__bss_start = .;}
127   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
128   .sbss    ${RELOCATING-0} : { *(.sbss) *(.scommon) }
129   .bss     ${RELOCATING-0} :
130   {
131    *(.dynbss)
132    *(.bss)
133    *(COMMON)
134   }
135   ${RELOCATING+_end = . ;}
136   ${RELOCATING+PROVIDE (end = .);}
137
138   /* These are needed for ELF backends which have not yet been
139      converted to the new style linker.  */
140   .stab 0 : { *(.stab) }
141   .stabstr 0 : { *(.stabstr) }
142
143   /* These must appear regardless of ${RELOCATING}.  */
144   ${OTHER_SECTIONS}
145 }
146 EOF
This page took 0.031624 seconds and 4 git commands to generate.