summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2004-03-31 19:05:39 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2004-03-31 19:05:39 +0000
commit56b73e67770f6fa5d8c4a770c5ac26a66ae5df9a (patch)
tree347441505003fde36743133e432148031d14b676
parent467d5fce5c192326332ef5b64abb25f42cc89af1 (diff)
byteswap strtab length on writing w/o affecting variable's
byte order as it seems to be used later on again. does not affect native linker at all. also fix includes order to avoid picking up native machine/ includes instead of the target (for cross-ld build).
-rw-r--r--gnu/usr.bin/ld/Makefile4
-rw-r--r--gnu/usr.bin/ld/ld.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/gnu/usr.bin/ld/Makefile b/gnu/usr.bin/ld/Makefile
index 9acd52e6e31..4e477fdb00d 100644
--- a/gnu/usr.bin/ld/Makefile
+++ b/gnu/usr.bin/ld/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.10 2002/03/07 09:41:50 fgsch Exp $
+# $OpenBSD: Makefile,v 1.11 2004/03/31 19:05:37 mickey Exp $
# $NetBSD: Makefile,v 1.13 1995/04/23 07:58:46 cgd Exp $
TARGET_MACHINE_ARCH?= $(MACHINE_ARCH)
@@ -14,7 +14,7 @@ ld.o:
.if ($(TARGET_MACHINE_ARCH) != $(MACHINE_ARCH))
CPPFLAGS+= -DCROSS_LINKER -DXHOST=$(MACHINE_ARCH) \
- -Icross-include
+ -idirafter cross-include -U__ELF__
beforedepend:
mkdir -p cross-include
-rm cross-include/${TARGET_MACHINE_ARCH}
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index 20bca5004db..c7b67f7ea17 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.c,v 1.30 2003/08/15 23:13:06 deraadt Exp $ */
+/* $OpenBSD: ld.c,v 1.31 2004/03/31 19:05:38 mickey Exp $ */
/* $NetBSD: ld.c,v 1.52 1998/02/20 03:12:51 jonathan Exp $ */
/*-
@@ -3332,7 +3332,7 @@ void
write_syms(void)
{
/* Number of symbols written so far. */
- int syms_written = 0;
+ int strsize, syms_written = 0;
struct nlist nl;
/*
@@ -3585,8 +3585,8 @@ printf("writesym(#%d): %s, type %x\n", syms_written, sp->name, sp->defined);
if (fseek(outstream, strtab_offset, SEEK_SET) != 0)
err(1, "write_syms: fseek");
- strtab_size = md_swap_long(strtab_size);
- mywrite(&strtab_size, 1, sizeof(int), outstream);
+ strsize = md_swap_long(strtab_size);
+ mywrite(&strsize, 1, sizeof(int), outstream);
}