Thu Jan 19 19:58:17 2012 UTC ()
Use a ldscript to make sure boot programs are linked correctly.


(matt)
diff -r1.9 -r1.10 src/sys/arch/sbmips/stand/Makefile.bootprogs
diff -r1.2 -r1.3 src/sys/arch/sbmips/stand/boot/Makefile
diff -r0 -r1.1 src/sys/arch/sbmips/stand/common/boot.ldscript
diff -r1.5 -r1.6 src/sys/arch/sbmips/stand/netboot/Makefile

cvs diff -r1.9 -r1.10 src/sys/arch/sbmips/stand/Makefile.bootprogs (switch to unified diff)

--- src/sys/arch/sbmips/stand/Makefile.bootprogs 2011/02/20 07:47:39 1.9
+++ src/sys/arch/sbmips/stand/Makefile.bootprogs 2012/01/19 19:58:16 1.10
@@ -1,156 +1,158 @@ @@ -1,156 +1,158 @@
1# $NetBSD: Makefile.bootprogs,v 1.9 2011/02/20 07:47:39 matt Exp $ 1# $NetBSD: Makefile.bootprogs,v 1.10 2012/01/19 19:58:16 matt Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4.include <bsd.sys.mk> # for HOST_SH 4.include <bsd.sys.mk> # for HOST_SH
5 5
6S= ${.CURDIR}/../../../.. 6S= ${.CURDIR}/../../../..
7 7
8.PATH: ${.CURDIR}/../common 8.PATH: ${.CURDIR}/../common
9 9
10STRIPFLAG= 10STRIPFLAG=
11BINMODE= 444 11BINMODE= 444
12 12
13# XXX SHOULD NOT NEED TO DEFINE THESE! 13# XXX SHOULD NOT NEED TO DEFINE THESE!
14LIBCRT0= 14LIBCRT0=
15LIBC= 15LIBC=
16LIBCRTBEGIN= 16LIBCRTBEGIN=
17LIBCRTEND= 17LIBCRTEND=
18 18
19STRIP?= strip 19STRIP?= strip
20 20
21CHECKSIZE_CMD= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh 21CHECKSIZE_CMD= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
22 22
23.PHONY: machine-links 23.PHONY: machine-links
24beforedepend: machine-links .WAIT 24beforedepend: machine-links .WAIT
25# ${MACHINE} then ${MACHINE_ARCH} 25# ${MACHINE} then ${MACHINE_ARCH}
26machine-links: 26machine-links:
27 -rm -f machine && \ 27 -rm -f machine && \
28 ln -s $S/arch/sbmips/include machine 28 ln -s $S/arch/sbmips/include machine
29 -rm -f mips && \ 29 -rm -f mips && \
30 ln -s $S/arch/mips/include mips 30 ln -s $S/arch/mips/include mips
31CLEANFILES+=machine mips 31CLEANFILES+=machine mips
32 32
33realall: machine-links ${PROG} 33realall: machine-links ${PROG}
34 34
35AFLAGS+= -DASSEMBLER -D_LOCORE -mno-abicalls -mips64 35AFLAGS+= -DASSEMBLER -D_LOCORE -mno-abicalls -mips64
36# -I${.CURDIR}/../.. done by Makefile.inc 36# -I${.CURDIR}/../.. done by Makefile.inc
37CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S} 37CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S}
38CFLAGS= -Os -g -ffreestanding -mno-abicalls -msoft-float -G 0 38CFLAGS= -Os -g -ffreestanding -mno-abicalls -msoft-float -G 0
39CFLAGS+= -mips64 39CFLAGS+= -mips64
40CFLAGS+= -Werror ${CWARNFLAGS} 40CFLAGS+= -Werror ${CWARNFLAGS}
41 41
42NETBSD_VERS!=${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh 42NETBSD_VERS!=${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
43CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 43CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
44 44
45CWARNFLAGS+= -Wno-main  45CWARNFLAGS+= -Wno-main
46CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 46CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
47CWARNFLAGS+= -Wno-pointer-sign 47CWARNFLAGS+= -Wno-pointer-sign
48 48
49# if there is a 'version' file, add rule for vers.c and add it to SRCS 49# if there is a 'version' file, add rule for vers.c and add it to SRCS
50# and CLEANFILES 50# and CLEANFILES
51.if exists(version) 51.if exists(version)
52.PHONY: vers.c 52.PHONY: vers.c
53vers.c: version 53vers.c: version
54 ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \ 54 ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
55 -N ${.CURDIR}/version "sbmips" 55 -N ${.CURDIR}/version "sbmips"
56 56
57SRCS+= vers.c 57SRCS+= vers.c
58CLEANFILES+= vers.c 58CLEANFILES+= vers.c
59.endif 59.endif
60 60
61#  61#
62# Refer to CFE documentation for a description of these regions. 62# Refer to CFE documentation for a description of these regions.
63#  63#
64 64
65REGION1_START= 0x20000000 # "Region 1 start" 65REGION1_START= 0x20000000 # "Region 1 start"
66REGION1_SIZE!= expr 256 \* 1024 # 256k 66REGION1_SIZE!= expr 256 \* 1024 # 256k
67 67
 68LDSCRIPT= ${.CURDIR}/../common/boot.ldscript
 69
68# our memory lauout: 70# our memory lauout:
69 71
70# 'unified' boot loaders (e.g. netboot) can consume all of region 72# 'unified' boot loaders (e.g. netboot) can consume all of region
71# 1 for their text+data, or text+data+bss. 73# 1 for their text+data, or text+data+bss.
72 74
73UNIFIED_LOAD_ADDRESS= ${REGION1_START} 75UNIFIED_LOAD_ADDRESS= ${REGION1_START}
74UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE} 76UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE}
75UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE} 77UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE}
76 78
77#UNIFIED_HEAP_START= right after secondary bss 79#UNIFIED_HEAP_START= right after secondary bss
78UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 80UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
79 81
80# two-stage boot loaders must share region 1. The first stage 82# two-stage boot loaders must share region 1. The first stage
81# loads into the lowest portion, and uses the higest portion 83# loads into the lowest portion, and uses the higest portion
82# for its heap. The second stage loads in between the primary image 84# for its heap. The second stage loads in between the primary image
83# and the heap, and can reuse the memory after it (i.e. the primary's 85# and the heap, and can reuse the memory after it (i.e. the primary's
84# heap) for its own heap. 86# heap) for its own heap.
85 87
86PRIMARY_LOAD_ADDRESS= ${REGION1_START} 88PRIMARY_LOAD_ADDRESS= ${REGION1_START}
87#PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL} 89#PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL}
88PRIMARY_MAX_TOTAL!= expr 16 \* 1024 90PRIMARY_MAX_TOTAL!= expr 16 \* 1024
89 91
90# XXX SECONDARY_LOAD_ADDRESS should be 92# XXX SECONDARY_LOAD_ADDRESS should be
91# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy 93# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
92# XXX way to do that calculation and 'ld' wants a single number. 94# XXX way to do that calculation and 'ld' wants a single number.
93SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX 95SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX
94SECONDARY_MAX_LOAD!= expr 112 \* 1024 96SECONDARY_MAX_LOAD!= expr 112 \* 1024
95SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL} 97SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
96 98
97PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD}) 99PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
98PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 100PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
99 101
100#SECONDARY_HEAP_START= right after secondary bss 102#SECONDARY_HEAP_START= right after secondary bss
101SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 103SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
102 104
103# standalone programs are like kernels. They load at 105# standalone programs are like kernels. They load at
104# 0xfffffc0000300000 and can use the rest of memory. 106# 0xfffffc0000300000 and can use the rest of memory.
105 107
106STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000 108STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000
107 109
108 110
109FILE_FORMAT_CPPFLAGS= -DBOOT_ELF 111FILE_FORMAT_CPPFLAGS= -DBOOT_ELF
110 112
111UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \ 113UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \
112 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \ 114 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
113 ${FILE_FORMAT_CPPFLAGS} 115 ${FILE_FORMAT_CPPFLAGS}
114 116
115PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \ 117PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \
116 -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \ 118 -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
117 -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \ 119 -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
118 -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \ 120 -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
119 -DHEAP_START="${PRIMARY_HEAP_START}" 121 -DHEAP_START="${PRIMARY_HEAP_START}"
120 122
121SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \ 123SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \
122 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \ 124 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
123 ${FILE_FORMAT_CPPFLAGS} 125 ${FILE_FORMAT_CPPFLAGS}
124 126
125STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM 127STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM
126 128
127.include <bsd.prog.mk> 129.include <bsd.prog.mk>
128 130
129### find out what to use for libkern 131### find out what to use for libkern
130KERN_AS= library 132KERN_AS= library
131.include "${S}/lib/libkern/Makefile.inc" 133.include "${S}/lib/libkern/Makefile.inc"
132LIBKERN= ${KERNLIB} 134LIBKERN= ${KERNLIB}
133 135
134### find out what to use for libz 136### find out what to use for libz
135Z_AS= library 137Z_AS= library
136.include "${S}/lib/libz/Makefile.inc" 138.include "${S}/lib/libz/Makefile.inc"
137LIBZ= ${ZLIB} 139LIBZ= ${ZLIB}
138 140
139### find out what to use for libsa 141### find out what to use for libsa
140SA_AS= library 142SA_AS= library
141SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 143SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
142.include "${S}/lib/libsa/Makefile.inc" 144.include "${S}/lib/libsa/Makefile.inc"
143LIBSA= ${SALIB} 145LIBSA= ${SALIB}
144 146
145/usr/lib/crt0.o: 147/usr/lib/crt0.o:
146 true 148 true
147 149
148/usr/lib/crtbegin.o: 150/usr/lib/crtbegin.o:
149 true 151 true
150 152
151/usr/lib/crtend.o: 153/usr/lib/crtend.o:
152 true 154 true
153 155
154cleandir: .WAIT cleandirlocal 156cleandir: .WAIT cleandirlocal
155cleandirlocal: 157cleandirlocal:
156 -rm -rf lib 158 -rm -rf lib

cvs diff -r1.2 -r1.3 src/sys/arch/sbmips/stand/boot/Makefile (switch to unified diff)

--- src/sys/arch/sbmips/stand/boot/Makefile 2011/02/20 07:47:39 1.2
+++ src/sys/arch/sbmips/stand/boot/Makefile 2012/01/19 19:58:16 1.3
@@ -1,32 +1,32 @@ @@ -1,32 +1,32 @@
1# $NetBSD: Makefile,v 1.2 2011/02/20 07:47:39 matt Exp $ 1# $NetBSD: Makefile,v 1.3 2012/01/19 19:58:16 matt Exp $
2 2
3PROG = boot 3PROG = boot
4 4
5SRCS = start.S boot.c blkdev.c cfe.c cfe_api.c  5SRCS = start.S boot.c blkdev.c cfe.c cfe_api.c
6SRCS+= filesystem.c booted_dev.c 6SRCS+= filesystem.c booted_dev.c
7 7
8BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS} 8BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS}
9 9
10CPPFLAGS += ${SECONDARY_CPPFLAGS} \ 10CPPFLAGS += ${SECONDARY_CPPFLAGS} \
11 -DBOOT_TYPE_NAME='"Secondary"' \ 11 -DBOOT_TYPE_NAME='"Secondary"' \
12 -DLIBSA_SINGLE_DEVICE=blkdev \ 12 -DLIBSA_SINGLE_DEVICE=blkdev \
13 -D"blkdevioctl(x,y,z)=EINVAL" 13 -D"blkdevioctl(x,y,z)=EINVAL"
14 14
15CLEANFILES+= ${PROG}.sym 15CLEANFILES+= ${PROG}.sym
16 16
17${PROG}: ${PROG}.sym 17${PROG}: ${PROG}.sym
18 @echo creating ${PROG} from ${PROG}.sym... 18 @echo creating ${PROG} from ${PROG}.sym...
19 @${OBJCOPY} --output-target=binary -R .reginfo ${PROG}.sym ${PROG} 19 @${OBJCOPY} --output-target=binary -R .reginfo ${PROG}.sym ${PROG}
20 @chmod 644 ${PROG} 20 @chmod 644 ${PROG}
21 @ls -l ${PROG} 21 @ls -l ${PROG}
22 @${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${SECONDARY_MAX_LOAD} \ 22 @${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${SECONDARY_MAX_LOAD} \
23 ${SECONDARY_MAX_TOTAL} || (rm -f ${PROG} ; false) 23 ${SECONDARY_MAX_TOTAL} || (rm -f ${PROG} ; false)
24 24
25SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=yes 25SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=yes
26.include "../Makefile.bootprogs" 26.include "../Makefile.bootprogs"
27 27
28${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 28${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LDSCRIPT}
29 ${_MKTARGET_LINK} 29 ${_MKTARGET_LINK}
30 ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym \ 30 ${LD} -T ${LDSCRIPT} -N -e start -o ${PROG}.sym \
31 ${OBJS} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} 31 ${OBJS} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
32 ${SIZE} ${PROG}.sym 32 ${SIZE} ${PROG}.sym

File Added: src/sys/arch/sbmips/stand/common/boot.ldscript
/* Script for -N: mix text and data on same page; don't align data */
OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips",
	      "elf32-tradlittlemips")
OUTPUT_ARCH(mips)
ENTRY(__start)
SEARCH_DIR("=/usr/lib");
SECTIONS
{
  /* Read-only sections, merged into text segment: */
  PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x20000000)); . = SEGMENT_START("text-segment", 0x20000000) + SIZEOF_HEADERS;
  .interp         : { *(.interp) }
  .reginfo        : { *(.reginfo) }
  .note.gnu.build-id : { *(.note.gnu.build-id) }
  .dynamic        : { *(.dynamic) }
  .hash           : { *(.hash) }
  .gnu.hash       : { *(.gnu.hash) }
  .dynsym         : { *(.dynsym) }
  .dynstr         : { *(.dynstr) }
  .gnu.version    : { *(.gnu.version) }
  .gnu.version_d  : { *(.gnu.version_d) }
  .gnu.version_r  : { *(.gnu.version_r) }
  .rel.init       : { *(.rel.init) }
  .rela.init      : { *(.rela.init) }
  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
  .rel.fini       : { *(.rel.fini) }
  .rela.fini      : { *(.rela.fini) }
  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
  .rel.ctors      : { *(.rel.ctors) }
  .rela.ctors     : { *(.rela.ctors) }
  .rel.dtors      : { *(.rel.dtors) }
  .rela.dtors     : { *(.rela.dtors) }
  .rel.got        : { *(.rel.got) }
  .rela.got       : { *(.rela.got) }
  .rel.dyn        : { *(.rel.dyn) }
  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
  .rel.iplt       :
    {
      PROVIDE_HIDDEN (__rel_iplt_start = .);
      *(.rel.iplt)
      PROVIDE_HIDDEN (__rel_iplt_end = .);
    }
  .rela.iplt      :
    {
      PROVIDE_HIDDEN (__rela_iplt_start = .);
      *(.rela.iplt)
      PROVIDE_HIDDEN (__rela_iplt_end = .);
    }
  .rel.plt        :
    {
      *(.rel.plt)
    }
  .rela.plt       :
    {
      *(.rela.plt)
    }
  .init           :
  {
    KEEP (*(.init))
  } =0
  .plt            : { *(.plt) }
  .iplt           : { *(.iplt) }
  .text           :
  {
    _ftext = . ;
    *(.text.unlikely .text.*_unlikely)
    *(.text.exit .text.exit.*)
    *(.text.startup .text.startup.*)
    *(.text.hot .text.hot.*)
    *(.text .stub .text.* .gnu.linkonce.t.*)
    /* .gnu.warning sections are handled specially by elf32.em.  */
    *(.gnu.warning)
    *(.mips16.fn.*) *(.mips16.call.*)
  } =0
  .fini           :
  {
    KEEP (*(.fini))
  } =0
  PROVIDE (__etext = .);
  PROVIDE (_etext = .);
  PROVIDE (etext = .);
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  .rodata1        : { *(.rodata1) }
  .sdata2         :
  {
    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
  }
  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
  .eh_frame_hdr : { *(.eh_frame_hdr) }
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  . = .;
  /* Exception handling  */
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  /* Thread Local Storage sections  */
  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  .preinit_array     :
  {
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array))
    PROVIDE_HIDDEN (__preinit_array_end = .);
  }
  .init_array     :
  {
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(SORT(.init_array.*)))
    KEEP (*(.init_array))
    PROVIDE_HIDDEN (__init_array_end = .);
  }
  .fini_array     :
  {
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(SORT(.fini_array.*)))
    KEEP (*(.fini_array))
    PROVIDE_HIDDEN (__fini_array_end = .);
  }
  .ctors          :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */
    KEEP (*crtbegin.o(.ctors))
    KEEP (*crtbegin?.o(.ctors))
    /* We don't want to include the .ctor section from
       the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  }
  .dtors          :
  {
    KEEP (*crtbegin.o(.dtors))
    KEEP (*crtbegin?.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
  }
  .jcr            : { KEEP (*(.jcr)) }
  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
  .data           :
  {
    _fdata = . ;
    *(.data .data.* .gnu.linkonce.d.*)
    SORT(CONSTRUCTORS)
  }
  .data1          : { *(.data1) }
  .got.plt        : { *(.got.plt) }
  . = .;
  _gp = ALIGN(16) + 0x7ff0;
  .got            : { *(.got) }
  /* We want the small data sections together, so single-instruction offsets
     can access them all, and initialized data all before uninitialized, so
     we can shorten the on-disk segment size.  */
  .sdata          :
  {
    *(.sdata .sdata.* .gnu.linkonce.s.*)
  }
  .lit8           : { *(.lit8) }
  .lit4           : { *(.lit4) }
  _edata = .; PROVIDE (edata = .);
  __bss_start = .;
  _fbss = .;
  .sbss           :
  {
    *(.dynsbss)
    *(.sbss .sbss.* .gnu.linkonce.sb.*)
    *(.scommon)
  }
  .bss            :
  {
   *(.dynbss)
   *(.bss .bss.* .gnu.linkonce.b.*)
   *(COMMON)
   /* Align here to ensure that the .bss section occupies space up to
      _end.  Align after .bss to ensure correct alignment even if the
      .bss section disappears because there are no input sections.
      FIXME: Why do we need it? When there is no .bss section, we don't
      pad the .data section.  */
   . = ALIGN(. != 0 ? 32 / 8 : 1);
  }
  . = ALIGN(32 / 8);
  . = ALIGN(32 / 8);
  _end = .; PROVIDE (end = .);
  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
  /* DWARF 3 */
  .debug_pubtypes 0 : { *(.debug_pubtypes) }
  .debug_ranges   0 : { *(.debug_ranges) }
  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }
  .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }
  .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }
  .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }
  .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }
  .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }
  .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
  .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}

cvs diff -r1.5 -r1.6 src/sys/arch/sbmips/stand/netboot/Makefile (switch to unified diff)

--- src/sys/arch/sbmips/stand/netboot/Makefile 2011/02/20 07:47:39 1.5
+++ src/sys/arch/sbmips/stand/netboot/Makefile 2012/01/19 19:58:17 1.6
@@ -1,32 +1,32 @@ @@ -1,32 +1,32 @@
1# $NetBSD: Makefile,v 1.5 2011/02/20 07:47:39 matt Exp $ 1# $NetBSD: Makefile,v 1.6 2012/01/19 19:58:17 matt Exp $
2 2
3PROG = netboot 3PROG = netboot
4 4
5SRCS = start.S boot.c cfe_api.c cfe.c 5SRCS = start.S boot.c cfe_api.c cfe.c
6SRCS+= dev_net.c conf.c devopen.c 6SRCS+= dev_net.c conf.c devopen.c
7SRCS+= if_cfe.c getsecs.c booted_dev.c 7SRCS+= if_cfe.c getsecs.c booted_dev.c
8 8
9BOOT_RELOC = ${UNIFIED_LOAD_ADDRESS} 9BOOT_RELOC = ${UNIFIED_LOAD_ADDRESS}
10 10
11CLEANFILES+= ${PROG}.sym 11CLEANFILES+= ${PROG}.sym
12 12
13CPPFLAGS += ${UNIFIED_CPPFLAGS} -DSUPPORT_DHCP \ 13CPPFLAGS += ${UNIFIED_CPPFLAGS} -DSUPPORT_DHCP \
14 -DBOOT_TYPE_NAME='"Network"' 14 -DBOOT_TYPE_NAME='"Network"'
15 15
16${PROG}: ${PROG}.sym 16${PROG}: ${PROG}.sym
17 @echo creating ${PROG} from ${PROG}.sym... 17 @echo creating ${PROG} from ${PROG}.sym...
18 @${OBJCOPY} --output-target=binary -R .reginfo -R .rel.dyn \ 18 @${OBJCOPY} --output-target=binary -R .reginfo -R .rel.dyn \
19 ${PROG}.sym ${PROG} 19 ${PROG}.sym ${PROG}
20 @chmod 644 ${PROG} 20 @chmod 644 ${PROG}
21 @ls -l ${PROG} 21 @ls -l ${PROG}
22 @${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${UNIFIED_MAX_LOAD} \ 22 @${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${UNIFIED_MAX_LOAD} \
23 ${UNIFIED_MAX_TOTAL} || (rm -f ${PROG} ; false) 23 ${UNIFIED_MAX_TOTAL} || (rm -f ${PROG} ; false)
24 24
25SAMISCMAKEFLAGS= SA_INCLUDE_NET=yes SA_USE_CREAD=yes 25SAMISCMAKEFLAGS= SA_INCLUDE_NET=yes SA_USE_CREAD=yes
26.include "../Makefile.bootprogs" 26.include "../Makefile.bootprogs"
27 27
28${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 28${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LDSCRIPT}
29 ${_MKTARGET_LINK} 29 ${_MKTARGET_LINK}
30 ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym \ 30 ${LD} -T ${LDSCRIPT} -N -e start -o ${PROG}.sym \
31 ${OBJS} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}  31 ${OBJS} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
32 ${SIZE} ${PROG}.sym 32 ${SIZE} ${PROG}.sym