Subject: Re: toolchain
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Matt Fredette <fredette@theory.lcs.mit.edu>
List: port-hp700
Date: 06/05/2002 11:31:41
> > by me for hppa--netbsdelf. While it is possible to arrange everything
> > into a tree that builds, it's hairy. Maybe only a good source of diffs
> > back to gcc-current, binutils-current?
>
> binutils 2.12 and -current already have an hppa-netbsd configuration,
> which uses the elf32-hppa format. Are you using elf32-hppa or
> elf32-hppa-linux?
elf32-hppa. You're right, my binutils diffs (attached) are shorter than
I thought they were. I did have to do some work on ld/scripttempl/hppaelf.sc.
The .note section thing is one thing I know is a bad hack, and there are
probably others.
> > I've only ever used this cross-toolchain to make statically linked
> > binaries. I would be surprised if it could make dynamic libraries
> > and executables.
>
> It will probably work fine, just ld.elf_so work is needed, I guess.
Ya.
Matt
--
Matt Fredette
[snip]
Index: gnusrc/gnu/dist/toolchain/configure.in
diff -u gnusrc/gnu/dist/toolchain/configure.in:1.1.1.1 gnusrc/gnu/dist/toolchain/configure.in:1.3
--- gnusrc/gnu/dist/toolchain/configure.in:1.1.1.1 Thu Oct 4 12:30:24 2001
+++ gnusrc/gnu/dist/toolchain/configure.in Wed Nov 21 16:44:08 2001
@@ -691,6 +691,10 @@
h8500-*-*)
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
;;
+ hppa*-*-netbsdelf*)
+ # No C++ support yet.
+ noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
+ ;;
hppa*-*-*elf* | \
hppa*-*-linux-gnu* | \
hppa*-*-lites* | \
Index: gnusrc/gnu/dist/toolchain/gas/configure.in
diff -u gnusrc/gnu/dist/toolchain/gas/configure.in:1.1.1.1 gnusrc/gnu/dist/toolchain/gas/configure.in:1.2
--- gnusrc/gnu/dist/toolchain/gas/configure.in:1.1.1.1 Thu Oct 4 12:31:18 2001
+++ gnusrc/gnu/dist/toolchain/gas/configure.in Fri Oct 26 11:32:39 2001
@@ -214,6 +214,7 @@
hppa*)
fmt=elf em=linux;;
esac ;;
+ hppa-*-netbsdelf*) fmt=elf em=nbsd ;;
hppa-*-*elf*) fmt=elf em=hppa ;;
hppa-*-lites*) fmt=elf em=hppa ;;
hppa-*-osf*) fmt=som em=hppa ;;
Index: gnusrc/gnu/dist/toolchain/gas/config/tc-hppa.h
diff -u gnusrc/gnu/dist/toolchain/gas/config/tc-hppa.h:1.1.1.1 gnusrc/gnu/dist/toolchain/gas/config/tc-hppa.h:1.2
--- gnusrc/gnu/dist/toolchain/gas/config/tc-hppa.h:1.1.1.1 Thu Oct 4 12:31:27 2001
+++ gnusrc/gnu/dist/toolchain/gas/config/tc-hppa.h Fri Oct 26 11:32:39 2001
@@ -85,6 +85,13 @@
#define ASEC_NULL (asection *)0
+#ifdef TE_NetBSD
+/* XXX fredette - the OpenBSD code requires this. perhaps
+ we can add colons to it someday? */
+/* Labels are not required to have a colon for a suffix. */
+#define LABELS_WITHOUT_COLONS 1
+#endif
+
/* pa_define_label gets used outside of tc-hppa.c via tc_frob_label. */
extern void pa_define_label PARAMS ((symbolS *));
Index: gnusrc/gnu/dist/toolchain/ld/scripttempl/hppaelf.sc
diff -u gnusrc/gnu/dist/toolchain/ld/scripttempl/hppaelf.sc:1.1.1.1 gnusrc/gnu/dist/toolchain/ld/scripttempl/hppaelf.sc:1.4
--- gnusrc/gnu/dist/toolchain/ld/scripttempl/hppaelf.sc:1.1.1.1 Thu Oct 4 12:36:33 2001
+++ gnusrc/gnu/dist/toolchain/ld/scripttempl/hppaelf.sc Fri Feb 1 11:21:34 2002
@@ -1,23 +1,38 @@
DATA_ADDR=0x40000000
test "$LD_FLAG" = "N" && DATA_ADDR=.
+INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
ENTRY("\$START\$")
${RELOCATING+${LIB_SEARCH_DIRS}}
+${RELOCATING- /* Currently, GNU ld tries to assign section VMAs even under
+ -r, which seems to be a bug, because these section VMAs end up making
+ symbol offsets not line up with their section contents, screwing up
+ future linking. elf.sc seems to note the same problem by saying
+ "For some reason, the Solaris linker makes bad executables
+ if gld -r is used and the intermediate file has sections starting
+ at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
+ bug. But for now assigning the zero vmas works." So we do the same. */}
SECTIONS
{
- .text 0x1000 ${RELOCATING++${TEXT_START_ADDR}}:
+ /* XXX fredette - gross hack, be sure to keep the size of the
+ .note section <= 0x200 */
+ . = 0x1e00;
+ ${CREATE_SHLIB-${INTERP}}
+ .text ${RELOCATING-0} ${RELOCATING+0x1000+${TEXT_START_ADDR}}:
{
${RELOCATING+__text_start = .};
CREATE_OBJECT_SYMBOLS
*(.PARISC.stubs)
*(.text)
+ ${RELOCATING+*(.text.*)}
${RELOCATING+etext = .};
${RELOCATING+_etext = .};
}
+ .PARISC.unwind : { *(.PARISC.unwind) }
${RELOCATING+. = ${DATA_ADDR};}
- .data :
+ .data ${RELOCATING-0} :
{
${RELOCATING+ . = . + 0x1000 };
${RELOCATING+__data_start = .};
@@ -26,8 +41,20 @@
${RELOCATING+edata = .};
${RELOCATING+_edata = .};
}
- ${RELOCATING+. = ${DATA_ADDR} + SIZEOF(.data);}
- .bss :
+ .ctors ${RELOCATING-0} :
+ {
+ *(.ctors)
+ }
+ .dtors ${RELOCATING-0} :
+ {
+ *(.dtors)
+ }
+ .eh_frame ${RELOCATING-0} :
+ {
+ *(.eh_frame)
+ }
+ ${RELOCATING+. = ${DATA_ADDR} + SIZEOF(.data) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame);}
+ .bss ${RELOCATING-0} :
{
*(.bss)
*(COMMON)
[snip]