1 1.6 christos source_sh ${srcdir}/emulparams/elf32ppccommon.sh 2 1.6 christos source_sh ${srcdir}/emulparams/plt_unwind.sh 3 1.7 christos source_sh ${srcdir}/emulparams/dt-relr.sh 4 1.1 christos EXTRA_EM_FILE=ppc64elf 5 1.1 christos ELFSIZE=64 6 1.1 christos OUTPUT_FORMAT="elf64-powerpc" 7 1.1 christos TEXT_START_ADDR=0x10000000 8 1.1 christos #SEGMENT_SIZE=0x10000000 9 1.1 christos ARCH=powerpc:common64 10 1.3 christos unset EXECUTABLE_SYMBOLS 11 1.3 christos unset SDATA_START_SYMBOLS 12 1.3 christos unset SDATA2_START_SYMBOLS 13 1.3 christos unset SBSS_START_SYMBOLS 14 1.3 christos unset SBSS_END_SYMBOLS 15 1.3 christos unset OTHER_END_SYMBOLS 16 1.3 christos unset OTHER_RELRO_SECTIONS 17 1.1 christos OTHER_TEXT_SECTIONS="*(.sfpr .glink)" 18 1.3 christos OTHER_SDATA_SECTIONS=" 19 1.1 christos .tocbss ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.tocbss)}" 20 1.1 christos 21 1.1 christos if test x${RELOCATING+set} = xset; then 22 1.1 christos GOT=" 23 1.3 christos .got : ALIGN(256) { *(.got .toc) }" 24 1.1 christos else 25 1.1 christos GOT=" 26 1.1 christos .got 0 : { *(.got) } 27 1.1 christos .toc 0 : { *(.toc) }" 28 1.1 christos fi 29 1.1 christos # Put .opd relocs first so ld.so will process them before any ifunc relocs. 30 1.1 christos INITIAL_RELOC_SECTIONS=" 31 1.1 christos .rela.opd ${RELOCATING-0} : { *(.rela.opd) }" 32 1.1 christos OTHER_GOT_RELOC_SECTIONS=" 33 1.1 christos .rela.toc ${RELOCATING-0} : { *(.rela.toc) } 34 1.3 christos .rela.toc1 ${RELOCATING-0} : { *(.rela.toc1) } 35 1.3 christos .rela.tocbss ${RELOCATING-0} : { *(.rela.tocbss) } 36 1.1 christos .rela.branch_lt ${RELOCATING-0} : { *(.rela.branch_lt) }" 37 1.7 christos # The idea behind setting .branch_lt address as we do below is to put 38 1.7 christos # it up against .got which is 256 byte aligned, so that the offset 39 1.7 christos # from .TOC. to an entry in .branch_lt remains fixed after stub 40 1.7 christos # sizing. (.eh_frame is edited late.) When -z relro -z now, we have 41 1.7 christos # .branch_lt, .plt, .iplt, then .got, so in that case we move 42 1.7 christos # .branch_lt so that the end of .iplt is against .got. All of these 43 1.7 christos # sections are linker generated, with alignment eight and size a 44 1.7 christos # multiple of eight, but a user playing games with their own 45 1.7 christos # .branch_lt, .plt or .iplt sections can result in unexpected 46 1.7 christos # alignment or size. Cope with that anyway. Note that if user 47 1.7 christos # alignment of .branch_lt is 256 or more then nothing special need be 48 1.7 christos # done. 49 1.7 christos # 50 1.7 christos # To understand what is going on here consider that the end address 51 1.7 christos # of .iplt should be 0 mod 256, so the start of .iplt should be 52 1.7 christos # -sizeof(.iplt) mod 256. But the start is constrained by alignment, 53 1.7 christos # so goes down to (-alignof(.iplt) & -sizeof(.iplt)) mod 256. Repeat 54 1.7 christos # that calculation for .plt and .branch_lt to find the start of 55 1.7 christos # .branch_lt then subtract . mod 256 to find the padding. Of course 56 1.7 christos # just one mod 256 suffices, which is done by anding with 255. 57 1.3 christos OTHER_RELRO_SECTIONS_2=" 58 1.3 christos .opd ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) } 59 1.1 christos .toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) } 60 1.7 christos .branch_lt ${RELOCATING-0}${RELOCATING+ALIGNOF(.branch_lt) < 256 && SIZEOF(.got) != 0 ? . + (((-MAX(ALIGNOF(.branch_lt),8) & (-SIZEOF(.branch_lt)${RELRO_NOW+ + (-MAX(ALIGNOF(.plt),8) & (-SIZEOF(.plt) + (-MAX(ALIGNOF(.iplt),8) & -SIZEOF(.iplt))))})) - .) & 255) : ALIGN(MAX(ALIGNOF(.branch_lt), SIZEOF(.got) != 0 ? 256 : 8))} : { *(.branch_lt) }" 61 1.3 christos INITIAL_READWRITE_SECTIONS=" 62 1.3 christos .toc ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc) }" 63 1.3 christos # Put .got before .data 64 1.3 christos DATA_GOT=" " 65 1.3 christos # Always make .got read-only after relocation 66 1.3 christos SEPARATE_GOTPLT=0 67 1.3 christos # Also put .sdata before .data 68 1.3 christos DATA_SDATA=" " 69 1.3 christos # and .plt/.iplt before .data 70 1.3 christos DATA_PLT= 71 1.3 christos PLT_BEFORE_GOT=" " 72