summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/binutils/bfd/config.bfd2
-rw-r--r--gnu/usr.bin/binutils/config.guess3
-rw-r--r--gnu/usr.bin/binutils/config.sub4
-rw-r--r--gnu/usr.bin/binutils/configure.in3
-rw-r--r--gnu/usr.bin/binutils/gas/configure1
-rw-r--r--gnu/usr.bin/binutils/gas/configure.in1
-rw-r--r--gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mh7
-rw-r--r--gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mt3
-rw-r--r--gnu/usr.bin/binutils/gdb/config/pa/nm-obsd.h135
-rw-r--r--gnu/usr.bin/binutils/gdb/config/pa/tm-hppaobsd.h49
-rw-r--r--gnu/usr.bin/binutils/gdb/config/pa/xm-hppaobsd.h33
-rw-r--r--gnu/usr.bin/binutils/gdb/configure.host1
-rw-r--r--gnu/usr.bin/binutils/gdb/configure.tgt1
-rw-r--r--gnu/usr.bin/binutils/gdb/hppaobsd-nat.c215
-rw-r--r--gnu/usr.bin/binutils/ld/configure.host9
-rw-r--r--gnu/usr.bin/binutils/ld/configure.tgt1
-rw-r--r--gnu/usr.bin/gcc/config.guess3
-rw-r--r--gnu/usr.bin/gcc/config/pa/pa-openbsd.h89
-rw-r--r--gnu/usr.bin/gcc/config/pa/pa1-openbsd.h24
-rw-r--r--gnu/usr.bin/gcc/config/pa/t-pa10
-rw-r--r--gnu/usr.bin/gcc/config/pa/xm-openbsd.h1
-rw-r--r--gnu/usr.bin/gcc/configure7
-rw-r--r--gnu/usr.bin/gcc/configure.in7
-rw-r--r--gnu/usr.bin/gcc/libgcc1-test.c3
24 files changed, 606 insertions, 6 deletions
diff --git a/gnu/usr.bin/binutils/bfd/config.bfd b/gnu/usr.bin/binutils/bfd/config.bfd
index 33293713859..2edb24eeec9 100644
--- a/gnu/usr.bin/binutils/bfd/config.bfd
+++ b/gnu/usr.bin/binutils/bfd/config.bfd
@@ -129,7 +129,7 @@ case "${targ}" in
targ_underscore=yes
;;
- hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4*)
+ hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-openbsd*)
targ_defvec=bfd_elf32_hppa_vec
;;
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
diff --git a/gnu/usr.bin/binutils/config.guess b/gnu/usr.bin/binutils/config.guess
index 5ba0ad6bde5..4f35da2b897 100644
--- a/gnu/usr.bin/binutils/config.guess
+++ b/gnu/usr.bin/binutils/config.guess
@@ -356,6 +356,9 @@ EOF
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
+ hppa*:OpenBSD*:*:*)
+ echo hppa-hp-openbsd
+ exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
diff --git a/gnu/usr.bin/binutils/config.sub b/gnu/usr.bin/binutils/config.sub
index 6c308390aa2..004a196d500 100644
--- a/gnu/usr.bin/binutils/config.sub
+++ b/gnu/usr.bin/binutils/config.sub
@@ -161,7 +161,7 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid \
- | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
+ | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
| alpha | we32k | ns16k | clipper | i370 | sh \
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| mips | pdp11 | mips64el | mips64orion | mips64orionel \
@@ -202,7 +202,7 @@ case $basic_machine in
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
- | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+ | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-*)
diff --git a/gnu/usr.bin/binutils/configure.in b/gnu/usr.bin/binutils/configure.in
index 8ee9087c262..d78b40dd883 100644
--- a/gnu/usr.bin/binutils/configure.in
+++ b/gnu/usr.bin/binutils/configure.in
@@ -422,7 +422,8 @@ case "${target}" in
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
;;
hppa*-*-*elf* | \
- hppa*-*-lites*)
+ hppa*-*-lites* | \
+ hppa*-*-openbsd*)
# Do configure ld/binutils/gas for this case.
;;
hppa*-*-*)
diff --git a/gnu/usr.bin/binutils/gas/configure b/gnu/usr.bin/binutils/gas/configure
index 02e1d0c568b..153214e6b69 100644
--- a/gnu/usr.bin/binutils/gas/configure
+++ b/gnu/usr.bin/binutils/gas/configure
@@ -775,6 +775,7 @@ for this_target in $target $canon_targets ; do
hppa-*-*elf*) fmt=elf em=hppa ;;
hppa-*-lites*) fmt=elf em=hppa ;;
+ hppa-*-openbsd*) fmt=elf em=hppa ;;
hppa-*-osf*) fmt=som em=hppa ;;
hppa-*-hpux*) fmt=som em=hppa ;;
hppa-*-bsd*) fmt=som em=hppa ;;
diff --git a/gnu/usr.bin/binutils/gas/configure.in b/gnu/usr.bin/binutils/gas/configure.in
index 1707f200358..7e8b57eb34f 100644
--- a/gnu/usr.bin/binutils/gas/configure.in
+++ b/gnu/usr.bin/binutils/gas/configure.in
@@ -130,6 +130,7 @@ changequote([,])dnl
hppa-*-*elf*) fmt=elf em=hppa ;;
hppa-*-lites*) fmt=elf em=hppa ;;
+ hppa-*-openbsd*) fmt=elf em=hppa ;;
hppa-*-osf*) fmt=som em=hppa ;;
hppa-*-hpux*) fmt=som em=hppa ;;
hppa-*-bsd*) fmt=som em=hppa ;;
diff --git a/gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mh b/gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mh
new file mode 100644
index 00000000000..fd6bfb35e79
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mh
@@ -0,0 +1,7 @@
+# Host: Hewlett-Packard PA-RISC machine, running BSD w/ elf
+XDEPFILES= ser-tcp.o
+XM_FILE= xm-hppab.h
+NAT_FILE= nm-hppab.h
+NATDEPFILES= hppab-nat.o corelow.o core-elf.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
+
+GDBSERVER_DEPFILES= low-hppaelf.o
diff --git a/gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mt b/gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mt
new file mode 100644
index 00000000000..33b30cb1c65
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/config/pa/hppaelf.mt
@@ -0,0 +1,3 @@
+# Target: HP PA-RISC running bsd
+TDEPFILES= hppa-tdep.o remote-pa.o
+TM_FILE= tm-hppab.h
diff --git a/gnu/usr.bin/binutils/gdb/config/pa/nm-obsd.h b/gnu/usr.bin/binutils/gdb/config/pa/nm-obsd.h
new file mode 100644
index 00000000000..b31ab5c9bb7
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/config/pa/nm-obsd.h
@@ -0,0 +1,135 @@
+/* HP PA-RISC machine native support for BSD, for GDB.
+ Copyright 1991, 1992 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "somsolib.h"
+
+#define U_REGS_OFFSET 0
+
+#define KERNEL_U_ADDR 0
+
+/* What a coincidence! */
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+{ addr = (int)(blockend) + REGISTER_BYTE (regno);}
+
+/* 3rd argument to ptrace is supposed to be a caddr_t. */
+
+#define PTRACE_ARG3_TYPE caddr_t
+
+/* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
+ with five arguments, so programs written for normal ptrace lose. */
+#define FIVE_ARG_PTRACE
+
+
+/* This macro defines the register numbers (from REGISTER_NAMES) that
+ are effectively unavailable to the user through ptrace(). It allows
+ us to include the whole register set in REGISTER_NAMES (inorder to
+ better support remote debugging). If it is used in
+ fetch/store_inferior_registers() gdb will not complain about I/O errors
+ on fetching these registers. If all registers in REGISTER_NAMES
+ are available, then return false (0). */
+
+#define CANNOT_STORE_REGISTER(regno) \
+ ((regno) == 0) || \
+ ((regno) == PCSQ_HEAD_REGNUM) || \
+ ((regno) >= PCSQ_TAIL_REGNUM && (regno) < IPSW_REGNUM) || \
+ ((regno) > IPSW_REGNUM && (regno) < FP4_REGNUM)
+
+/* fetch_inferior_registers is in hppab-nat.c. */
+#define FETCH_INFERIOR_REGISTERS
+
+/* attach/detach works to some extent under BSD and HPUX. So long
+ as the process you're attaching to isn't blocked waiting on io,
+ blocked waiting on a signal, or in a system call things work
+ fine. (The problems in those cases are related to the fact that
+ the kernel can't provide complete register information for the
+ target process... Which really pisses off GDB.) */
+
+#define ATTACH_DETACH
+
+/* The PA-BSD kernel has support for using the data memory break bit
+ to implement fast watchpoints.
+
+ Watchpoints on the PA act much like traditional page protection
+ schemes, but with some notable differences.
+
+ First, a special bit in the page table entry is used to cause
+ a trap when a specific page is written to. This avoids having
+ to overload watchpoints on the page protection bits. This makes
+ it possible for the kernel to easily decide if a trap was caused
+ by a watchpoint or by the user writing to protected memory and can
+ signal the user program differently in each case.
+
+ Second, the PA has a bit in the processor status word which causes
+ data memory breakpoints (aka watchpoints) to be disabled for a single
+ instruction. This bit can be used to avoid the overhead of unprotecting
+ and reprotecting pages when it becomes necessary to step over a watchpoint.
+
+
+ When the kernel receives a trap indicating a write to a page which
+ is being watched, the kernel performs a couple of simple actions. First
+ is sets the magic "disable memory breakpoint" bit in the processor
+ status word, it then sends a SIGTRAP to the process which caused the
+ trap.
+
+ GDB will take control and catch the signal for the inferior. GDB then
+ examines the PSW-X bit to determine if the SIGTRAP was caused by a
+ watchpoint firing. If so GDB single steps the inferior over the
+ instruction which caused the watchpoint to trigger (note because the
+ kernel disabled the data memory break bit for one instruction no trap
+ will be taken!). GDB will then determines the appropriate action to
+ take. (this may include restarting the inferior if the watchpoint
+ fired because of a write to an address on the same page as a watchpoint,
+ but no write to the watched address occured). */
+
+#define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */
+
+/* The PA can watch any number of locations, there's no need for it to reject
+ anything (generic routines already check that all intermediates are
+ in memory). */
+#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
+ ((type) == bp_hardware_watchpoint)
+
+/* When a hardware watchpoint fires off the PC will be left at the
+ instruction which caused the watchpoint. It will be necessary for
+ GDB to step over the watchpoint.
+
+ On a PA running BSD, it is trivial to identify when it will be
+ necessary to step over a hardware watchpoint as we can examine
+ the PSW-X bit. If the bit is on, then we trapped because of a
+ watchpoint, else we trapped for some other reason. */
+#define STOPPED_BY_WATCHPOINT(W) \
+ ((W).kind == TARGET_WAITKIND_STOPPED \
+ && (W).value.sig == TARGET_SIGNAL_TRAP \
+ && ((int) read_register (IPSW_REGNUM) & 0x00100000))
+
+/* The PA can single step over a watchpoint if the kernel has set the
+ "X" bit in the processor status word (disable data memory breakpoint
+ for one instruction).
+
+ The kernel will always set this bit before notifying the inferior
+ that it hit a watchpoint. Thus, the inferior can single step over
+ the instruction which caused the watchpoint to fire. This avoids
+ the traditional need to disable the watchpoint, step the inferior,
+ then enable the watchpoint again. */
+#define HAVE_STEPPABLE_WATCHPOINT
+
+/* Use these macros for watchpoint insertion/deletion. */
+/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
+#define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1)
+#define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0)
diff --git a/gnu/usr.bin/binutils/gdb/config/pa/tm-hppaobsd.h b/gnu/usr.bin/binutils/gdb/config/pa/tm-hppaobsd.h
new file mode 100644
index 00000000000..87697f48e5d
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/config/pa/tm-hppaobsd.h
@@ -0,0 +1,49 @@
+/* Parameters for execution on an HP PA-RISC machine running BSD, for GDB.
+ Contributed by the Center for Software Science at the
+ University of Utah (pa-gdb-bugs@cs.utah.edu). */
+
+/* For BSD:
+
+ The signal context structure pointer is always saved at the base
+ of the frame + 0x4.
+
+ We get the PC & SP directly from the sigcontext structure itself.
+ For other registers we have to dive in a little deeper:
+
+ The hardware save state pointer is at offset 0x10 within the
+ signal context structure.
+
+ Within the hardware save state, registers are found in the same order
+ as the register numbers in GDB. */
+
+#define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
+{ \
+ *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+ *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
+}
+
+#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
+{ \
+ *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+ *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
+}
+
+#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
+{ \
+ int i; \
+ CORE_ADDR TMP; \
+ TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+ TMP = read_memory_integer (TMP + 0x10, 4); \
+ for (i = 0; i < NUM_REGS; i++) \
+ { \
+ if (i == SP_REGNUM) \
+ (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
+ else \
+ (FSR)->regs[i] = TMP + i * 4; \
+ } \
+}
+
+/* It's mostly just the common stuff. */
+#include "pa/tm-hppa.h"
+
+#define GDB_TARGET_IS_PA_ELF
diff --git a/gnu/usr.bin/binutils/gdb/config/pa/xm-hppaobsd.h b/gnu/usr.bin/binutils/gdb/config/pa/xm-hppaobsd.h
new file mode 100644
index 00000000000..463c1e08dcb
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/config/pa/xm-hppaobsd.h
@@ -0,0 +1,33 @@
+/* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB.
+ Copyright 1991, 1992 Free Software Foundation, Inc.
+
+ Contributed by the Center for Software Science at the
+ University of Utah (pa-gdb-bugs@cs.utah.edu).
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* This is a big-endian host. */
+
+#define HOST_BYTE_ORDER BIG_ENDIAN
+
+#include "pa/xm-pa.h"
+
+#ifndef SEEK_SET
+# define SEEK_SET 0 /* Set file pointer to "offset" */
+# define SEEK_CUR 1 /* Set file pointer to current plus "offset" */
+# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
+#endif /* SEEK_SET */
diff --git a/gnu/usr.bin/binutils/gdb/configure.host b/gnu/usr.bin/binutils/gdb/configure.host
index cb6ff7b1f31..af18d910db0 100644
--- a/gnu/usr.bin/binutils/gdb/configure.host
+++ b/gnu/usr.bin/binutils/gdb/configure.host
@@ -44,6 +44,7 @@ hppa*-*-bsd*) gdb_host=hppabsd ;;
hppa*-*-hiux*) gdb_host=hppahpux ;;
hppa*-*-hpux*) gdb_host=hppahpux ;;
hppa*-*-osf*) gdb_host=hppaosf ;;
+hppa*-*-openbsd*) gdb_host=obsd ;;
i[3456]86-ncr-*) gdb_host=ncr3000 ;;
i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix
diff --git a/gnu/usr.bin/binutils/gdb/configure.tgt b/gnu/usr.bin/binutils/gdb/configure.tgt
index 0717726aa92..721d4ecda4d 100644
--- a/gnu/usr.bin/binutils/gdb/configure.tgt
+++ b/gnu/usr.bin/binutils/gdb/configure.tgt
@@ -63,6 +63,7 @@ hppa*-*-pro*) gdb_target=hppapro ;;
hppa*-*-hpux*) gdb_target=hppahpux ;;
hppa*-*-hiux*) gdb_target=hppahpux ;;
hppa*-*-osf*) gdb_target=hppaosf ;;
+hppa*-*-openbsd*) gdb_target=obsd ;;
i[3456]86-sequent-bsd*) gdb_target=symmetry ;;
i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;;
diff --git a/gnu/usr.bin/binutils/gdb/hppaobsd-nat.c b/gnu/usr.bin/binutils/gdb/hppaobsd-nat.c
new file mode 100644
index 00000000000..57360f3fd64
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/hppaobsd-nat.c
@@ -0,0 +1,215 @@
+/* Machine-dependent hooks for the unix child process stratum. This
+ code is for the HP PA-RISC cpu.
+
+ Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+
+ Contributed by the Center for Software Science at the
+ University of Utah (pa-gdb-bugs@cs.utah.edu).
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "target.h"
+#include <sys/ptrace.h>
+
+/* Use an extra level of indirection for ptrace calls.
+ This lets us breakpoint usefully on call_ptrace. It also
+ allows us to pass an extra argument to ptrace without
+ using an ANSI-C specific macro. */
+
+#define ptrace call_ptrace
+
+#if !defined (offsetof)
+#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
+#endif
+
+/* U_REGS_OFFSET is the offset of the registers within the u area. */
+#if !defined (U_REGS_OFFSET)
+#define U_REGS_OFFSET \
+ ptrace (PT_READ_U, inferior_pid, \
+ (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
+ - KERNEL_U_ADDR
+#endif
+
+/* Fetch one register. */
+
+static void
+fetch_register (regno)
+ int regno;
+{
+ register unsigned int regaddr;
+ char buf[MAX_REGISTER_RAW_SIZE];
+ register int i;
+
+ /* Offset of registers within the u area. */
+ unsigned int offset;
+
+ offset = U_REGS_OFFSET;
+
+ regaddr = register_addr (regno, offset);
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+ {
+ errno = 0;
+ *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
+ regaddr += sizeof (int);
+ if (errno != 0)
+ {
+ /* Warning, not error, in case we are attached; sometimes the
+ kernel doesn't let us at the registers. */
+ char *err = safe_strerror (errno);
+ char *msg = alloca (strlen (err) + 128);
+ sprintf (msg, "reading register %s: %s", reg_names[regno], err);
+ warning (msg);
+ goto error_exit;
+ }
+ }
+ supply_register (regno, buf);
+ error_exit:;
+}
+
+/* Fetch all registers, or just one, from the child process. */
+
+void
+fetch_inferior_registers (regno)
+ int regno;
+{
+ if (regno == -1)
+ for (regno = 0; regno < NUM_REGS; regno++)
+ fetch_register (regno);
+ else
+ fetch_register (regno);
+}
+
+/* Store our register values back into the inferior.
+ If REGNO is -1, do this for all registers.
+ Otherwise, REGNO specifies which register (so we can save time). */
+
+void
+store_inferior_registers (regno)
+ int regno;
+{
+ register unsigned int regaddr;
+ char buf[80];
+ extern char registers[];
+ register int i;
+ unsigned int offset = U_REGS_OFFSET;
+ int scratch;
+
+ if (regno >= 0)
+ {
+ if (CANNOT_STORE_REGISTER (regno))
+ return;
+ regaddr = register_addr (regno, offset);
+ errno = 0;
+ if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
+ {
+ scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
+ ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ scratch);
+ if (errno != 0)
+ {
+ /* Error, even if attached. Failing to write these two
+ registers is pretty serious. */
+ sprintf (buf, "writing register number %d", regno);
+ perror_with_name (buf);
+ }
+ }
+ else
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
+ {
+ errno = 0;
+ ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ *(int *) &registers[REGISTER_BYTE (regno) + i]);
+ if (errno != 0)
+ {
+ /* Warning, not error, in case we are attached; sometimes the
+ kernel doesn't let us at the registers. */
+ char *err = safe_strerror (errno);
+ char *msg = alloca (strlen (err) + 128);
+ sprintf (msg, "writing register %s: %s",
+ reg_names[regno], err);
+ warning (msg);
+ return;
+ }
+ regaddr += sizeof(int);
+ }
+ }
+ else
+ for (regno = 0; regno < NUM_REGS; regno++)
+ store_inferior_registers (regno);
+}
+
+/* PT_PROT is specific to the PA BSD kernel and isn't documented
+ anywhere (except here).
+
+ PT_PROT allows one to enable/disable the data memory break bit
+ for pages of memory in an inferior process. This bit is used
+ to cause "Data memory break traps" to occur when the appropriate
+ page is written to.
+
+ The arguments are as follows:
+
+ PT_PROT -- The ptrace action to perform.
+
+ INFERIOR_PID -- The pid of the process who's page table entries
+ will be modified.
+
+ PT_ARGS -- The *address* of a 3 word block of memory which has
+ additional information:
+
+ word 0 -- The start address to watch. This should be a page-aligned
+ address.
+
+ word 1 -- The ending address to watch. Again, this should be a
+ page aligned address.
+
+ word 2 -- Nonzero to enable the data memory break bit on the
+ given address range or zero to disable the data memory break
+ bit on the given address range.
+
+ This call may fail if the given addresses are not valid in the inferior
+ process. This most often happens when restarting a program which
+ as watchpoints inserted on heap or stack memory. */
+
+#define PT_PROT 21
+
+int
+hppa_set_watchpoint (addr, len, flag)
+ int addr, len, flag;
+{
+ int pt_args[3];
+ pt_args[0] = addr;
+ pt_args[1] = addr + len;
+ pt_args[2] = flag;
+
+ /* Mask off the lower 12 bits since we want to work on a page basis. */
+ pt_args[0] >>= 12;
+ pt_args[1] >>= 12;
+
+ /* Rounding adjustments. */
+ pt_args[1] -= pt_args[0];
+ pt_args[1]++;
+
+ /* Put the lower 12 bits back as zero. */
+ pt_args[0] <<= 12;
+ pt_args[1] <<= 12;
+
+ /* Do it. */
+ return ptrace (PT_PROT, inferior_pid, (PTRACE_ARG3_TYPE) pt_args, 0);
+}
diff --git a/gnu/usr.bin/binutils/ld/configure.host b/gnu/usr.bin/binutils/ld/configure.host
index 720b0adb4b9..74e430f0d52 100644
--- a/gnu/usr.bin/binutils/ld/configure.host
+++ b/gnu/usr.bin/binutils/ld/configure.host
@@ -41,6 +41,15 @@ alpha-*-openbsd*)
HOSTING_CRT0=/usr/lib/crt0.o
;;
+hppa-*-openbsd*)
+ # The new BSD `make' has a bug: it doesn't pass empty arguments in
+ # shell commands. So we need to make this value non-empty in order
+ # for the genscripts.sh call to work. There's nothing magic about
+ # the value `/lib'; it's just a dummy.
+ NATIVE_LIB_DIRS=/lib
+ HOSTING_CRT0=/usr/lib/crt0.o
+ ;;
+
alpha-*-*)
HOSTING_CRT0=/usr/ccs/lib/crt0.o
NATIVE_LIB_DIRS=/usr/ccs/lib
diff --git a/gnu/usr.bin/binutils/ld/configure.tgt b/gnu/usr.bin/binutils/ld/configure.tgt
index 6f9f16570a6..35dc77b6f2d 100644
--- a/gnu/usr.bin/binutils/ld/configure.tgt
+++ b/gnu/usr.bin/binutils/ld/configure.tgt
@@ -117,6 +117,7 @@ m68*-*-psos*) targ_emul=m68kpsos ;;
m68*-*-rtems*) targ_emul=m68kcoff ;;
hppa*-*-*elf*) targ_emul=hppaelf ;;
hppa*-*-lites*) targ_emul=hppaelf ;;
+hppa*-*-openbsd*) targ_emul=hppaelf ;;
vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;;
mips*-dec-ultrix*) targ_emul=mipslit ;;
mips*-dec-osf*) targ_emul=mipslit ;;
diff --git a/gnu/usr.bin/gcc/config.guess b/gnu/usr.bin/gcc/config.guess
index 30230b3dfe9..ba38770abaa 100644
--- a/gnu/usr.bin/gcc/config.guess
+++ b/gnu/usr.bin/gcc/config.guess
@@ -416,6 +416,9 @@ EOF
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-hp-openbsd
+ exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
diff --git a/gnu/usr.bin/gcc/config/pa/pa-openbsd.h b/gnu/usr.bin/gcc/config/pa/pa-openbsd.h
new file mode 100644
index 00000000000..45db5d836d4
--- /dev/null
+++ b/gnu/usr.bin/gcc/config/pa/pa-openbsd.h
@@ -0,0 +1,89 @@
+/* Definitions for HP-PA systems running BSD as target machine for GNU compiler.
+ Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* We settle for little endian for now */
+
+#define TARGET_ENDIAN_DEFAULT 0
+
+#ifndef CROSS_COMPILE
+/* Look for the G++ include files in the system-defined place. */
+
+#undef GPLUSPLUS_INCLUDE_DIR
+#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
+
+/* Under OpenBSD, the normal location of the various *crt*.o files is the
+ /usr/lib directory. */
+
+#undef STANDARD_STARTFILE_PREFIX
+#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
+#endif
+
+/* Provide a LINK_SPEC appropriate for OpenBSD. Here we provide support
+ for the special GCC options -static, -assert, and -nostdlib. */
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{EB} %{EL} %{shared} %{non_shared} \
+ %{call_shared} %{no_archive} %{exact_version} \
+ %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
+ %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
+
+/* We have atexit(3). */
+
+#define HAVE_ATEXIT
+
+/* Implicit library calls should use memcpy, not bcopy, etc. */
+
+#define TARGET_MEM_FUNCTIONS
+
+/* Define hppa-specific OpenBSD predefines... */
+#ifndef CPP_PREDEFINES
+#define CPP_PREDEFINES "-Dunix -D__ANSI_COMPAT \
+-Asystem(unix) -Asystem(OpenBSD) -Amachine(hppa) \
+-D__OpenBSD__ -D__hppa__ -D__hppa"
+#endif
+
+/* Always uses gas. */
+#ifndef ASM_SPEC
+#define ASM_SPEC "\
+%|"
+#endif
+
+#ifndef CPP_SPEC
+#define CPP_SPEC "\
+%{posix:-D_POSIX_SOURCE}"
+#endif
+
+#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+#define STARTFILE_SPEC \
+ "%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}"
+
+#ifndef MACHINE_TYPE
+#define MACHINE_TYPE "OpenBSD/hppa"
+#endif
+
+#define LOCAL_LABEL_PREFIX "."
+
+/* Since gas and gld are standard on OpenBSD, we don't need this */
+#undef ASM_FINAL_SPEC
+#undef STARTFILE_SPEC
+
diff --git a/gnu/usr.bin/gcc/config/pa/pa1-openbsd.h b/gnu/usr.bin/gcc/config/pa/pa1-openbsd.h
new file mode 100644
index 00000000000..c791b553769
--- /dev/null
+++ b/gnu/usr.bin/gcc/config/pa/pa1-openbsd.h
@@ -0,0 +1,24 @@
+/* Definitions of target machine for GNU compiler, for HP PA-RISC 1.1
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ Contributed by Tim Moore (moore@defmacro.cs.utah.edu)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#define TARGET_DEFAULT 1 /* TARGET_SNAKE */
+
+#include "pa/pa-openbsd.h"
diff --git a/gnu/usr.bin/gcc/config/pa/t-pa b/gnu/usr.bin/gcc/config/pa/t-pa
index a359918a125..ecb5b2ac840 100644
--- a/gnu/usr.bin/gcc/config/pa/t-pa
+++ b/gnu/usr.bin/gcc/config/pa/t-pa
@@ -1,8 +1,14 @@
-LIBGCC1=libgcc1.null
-CROSS_LIBGCC1=libgcc1.null
+LIBGCC1=libgcc1-asm.a
+CROSS_LIBGCC1=libgcc1-asm.a
ADA_CFLAGS=-mdisable-indexing
+LIB1ASMSRC=pa/lib1funcs.asm
+LIB1ASMFUNCS=_divI _divU _modI _modU _remI _remU
LIB2FUNCS_EXTRA=lib2funcs.asm ee.asm ee_fp.asm
+lib1funcs.asm: $(srcdir)/config/pa/lib1funcs.asm
+ rm -f lib1funcs.asm
+ cp $(srcdir)/config/pa/lib1funcs.asm .
+
lib2funcs.asm: $(srcdir)/config/pa/lib2funcs.asm
rm -f lib2funcs.asm
cp $(srcdir)/config/pa/lib2funcs.asm .
diff --git a/gnu/usr.bin/gcc/config/pa/xm-openbsd.h b/gnu/usr.bin/gcc/config/pa/xm-openbsd.h
new file mode 100644
index 00000000000..7d1314fdc56
--- /dev/null
+++ b/gnu/usr.bin/gcc/config/pa/xm-openbsd.h
@@ -0,0 +1 @@
+#include "pa/xm-pa.h"
diff --git a/gnu/usr.bin/gcc/configure b/gnu/usr.bin/gcc/configure
index 4c39911d380..3a296a7f8b6 100644
--- a/gnu/usr.bin/gcc/configure
+++ b/gnu/usr.bin/gcc/configure
@@ -3165,6 +3165,13 @@ for machine in $build $host $target; do
use_collect2=yes
fixincludes=Makefile.in
;;
+ hppa*-*-openbsd*)
+ target_cpu_default=1
+ tm_file="${tm_file} pa/pa-openbsd.h pa/pa-gas.h"
+ xm_file=pa/xm-openbsd.h
+ use_collect2=yes
+ fixincludes=Makefile.in
+ ;;
i370-*-mvs*)
;;
i[34567]86-ibm-aix*) # IBM PS/2 running AIX
diff --git a/gnu/usr.bin/gcc/configure.in b/gnu/usr.bin/gcc/configure.in
index c12f8b9ce64..9f6533e1080 100644
--- a/gnu/usr.bin/gcc/configure.in
+++ b/gnu/usr.bin/gcc/configure.in
@@ -664,6 +664,13 @@ for machine in $build $host $target; do
use_collect2=yes
fixincludes=Makefile.in
;;
+ hppa*-*-openbsd*)
+ target_cpu_default=1
+ tm_file="${tm_file} pa/pa-openbsd.h pa/pa-gas.h"
+ xm_file=pa/xm-openbsd.h
+ use_collect2=yes
+ fixincludes=Makefile.in
+ ;;
i370-*-mvs*)
;;
i[[34567]]86-ibm-aix*) # IBM PS/2 running AIX
diff --git a/gnu/usr.bin/gcc/libgcc1-test.c b/gnu/usr.bin/gcc/libgcc1-test.c
index 977b9c76188..9442b51e2e3 100644
--- a/gnu/usr.bin/gcc/libgcc1-test.c
+++ b/gnu/usr.bin/gcc/libgcc1-test.c
@@ -96,8 +96,11 @@ dfoo ()
extern void start() __asm__("start");
extern void _start() __asm__("_start");
extern void __start() __asm__("__start");
+extern void ___start() __asm__("$START$");
+int global __asm__("$global$");
void start() {}
void _start() {}
void __start() {}
+void ___start() {}
void mainCRTStartup() {}