summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-07-05 21:09:23 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-07-05 21:09:23 +0000
commit50508fdc39c1c58bc7a03b6cad331ab7b3917975 (patch)
tree81f29167fcc093569e8b94bf28c8642120bec0ee
parent9028e6b2ff7ab683f990555c944ee64444fef4c3 (diff)
VAX ELF toolchain, using `%' as the register prefix. Heavily based upon
NetBSD.
-rw-r--r--gnu/egcs/gcc/config.gcc2
-rw-r--r--gnu/egcs/gcc/config/vax/openbsdelf.h92
-rw-r--r--gnu/egcs/gcc/config/vax/vax.c40
-rw-r--r--gnu/egcs/gcc/config/vax/vax.h129
-rw-r--r--gnu/usr.bin/binutils/Makefile.bsd-wrapper4
-rw-r--r--gnu/usr.bin/binutils/bfd/config.bfd4
-rw-r--r--gnu/usr.bin/binutils/bfd/elf32-vax.c104
-rw-r--r--gnu/usr.bin/binutils/configure2
-rw-r--r--gnu/usr.bin/binutils/configure.in2
-rw-r--r--gnu/usr.bin/binutils/gas/configure2
-rw-r--r--gnu/usr.bin/binutils/gas/configure.in2
-rw-r--r--gnu/usr.bin/binutils/gdb/configure.tgt1
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.am5
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.in5
-rw-r--r--gnu/usr.bin/binutils/ld/configure.tgt2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32vax_obsd.sh2
16 files changed, 261 insertions, 137 deletions
diff --git a/gnu/egcs/gcc/config.gcc b/gnu/egcs/gcc/config.gcc
index 833fc7c5e45..3281c5481f2 100644
--- a/gnu/egcs/gcc/config.gcc
+++ b/gnu/egcs/gcc/config.gcc
@@ -2768,10 +2768,10 @@ vax-*-netbsd*)
use_collect2=yes
;;
vax-*-openbsd*)
+ tm_file="vax/openbsdelf.h"
tm_file="${tm_file} exec-stack.h"
tmake_file="${tmake_file} vax/t-openbsd"
float_format=vax
- use_collect2=yes
;;
vax-*-ultrix*) # vaxen running ultrix
tm_file="${tm_file} vax/ultrix.h"
diff --git a/gnu/egcs/gcc/config/vax/openbsdelf.h b/gnu/egcs/gcc/config/vax/openbsdelf.h
new file mode 100644
index 00000000000..dbb35ed659f
--- /dev/null
+++ b/gnu/egcs/gcc/config/vax/openbsdelf.h
@@ -0,0 +1,92 @@
+/* Configuration file for a vax OpenBSD target.
+ Copyright (C) 1999 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. */
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT 0
+#include <vax/vax.h>
+
+#undef PCC_BITFIELD_TYPE_MATTERS
+#include <elfos.h>
+
+#define OBSD_NO_DYNAMIC_LIBRARIES
+#include <openbsd.h>
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "-D__unix__ -D__vax__ -D__OpenBSD__ -D__ELF__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(vax) -Amachine(vax)"
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{!nostdlib:%{!r*:%{!e*:-e _start}}} %{R*} %{assert*}"
+
+/* As an elf system, we need crtbegin/crtend stuff. */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+ "%{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} crtbegin%O%s"
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend%O%s"
+
+/* Layout of source language data types. */
+
+/* This must agree with <machine/_types.h> */
+#undef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+#undef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+#undef PCC_STATIC_STRUCT_RETURN
+
+#undef REGISTER_PREFIX
+#define REGISTER_PREFIX "%"
+
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
+/* Redefine this with register prefixes. */
+#undef VAX_ISTREAM_SYNC
+#define VAX_ISTREAM_SYNC "movpsl -(%sp)\n\tpushal 1(%pc)\n\trei"
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ asm_fprintf (FILE, "\tmovab .LP%d,%Rr0\n\tjsb __mcount\n", (LABELNO))
+
+/* Use sjlj exceptions. */
+#undef DWARF2_UNWIND_INFO
+
+/* Make sure .stabs for a function are always the same section. */
+#define DBX_OUTPUT_FUNCTION_END(file,decl) function_section(decl)
+
+/* The VAX wants no space between the case instruction and the jump table. */
+#undef ASM_OUTPUT_BEFORE_CASE_LABEL
+#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE)
+
+/* Get the udiv/urem calls out of the user's namespace */
+#undef UDIVSI3_LIBCALL
+#define UDIVSI3_LIBCALL "*__udiv"
+#undef UMODSI3_LIBCALL
+#define UMODSI3_LIBCALL "*__urem"
diff --git a/gnu/egcs/gcc/config/vax/vax.c b/gnu/egcs/gcc/config/vax/vax.c
index bac442a467d..9170ec36a24 100644
--- a/gnu/egcs/gcc/config/vax/vax.c
+++ b/gnu/egcs/gcc/config/vax/vax.c
@@ -19,7 +19,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
-#include <stdio.h>
+#include "system.h"
#include "rtl.h"
#include "regs.h"
#include "hard-reg-set.h"
@@ -32,6 +32,8 @@ Boston, MA 02111-1307, USA. */
#ifdef VMS_TARGET
#include "tree.h"
#endif
+#include "reload.h"
+#include "recog.h"
/* This is like nonimmediate_operand with a restriction on the type of MEM. */
@@ -43,8 +45,9 @@ split_quadword_operands (operands, low, n)
int i;
/* Split operands. */
- low[0] = low[1] = low[2] = 0;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < n; i++)
+ low[i] = 0;
+ for (i = 0; i < n; i++)
{
if (low[i])
/* it's already been figured out */;
@@ -56,7 +59,7 @@ split_quadword_operands (operands, low, n)
if (which_alternative == 0 && i == 0)
{
addr = XEXP (operands[i], 0);
- operands[i+1] = low[i+1] = gen_rtx (MEM, SImode, addr);
+ operands[i+1] = low[i+1] = gen_rtx_MEM (SImode, addr);
}
}
else
@@ -83,15 +86,15 @@ print_operand_address (file, addr)
goto retry;
case REG:
- fprintf (file, "(%s)", reg_names[REGNO (addr)]);
+ fprintf (file, "(%s%s)", REGISTER_PREFIX, reg_names[REGNO (addr)]);
break;
case PRE_DEC:
- fprintf (file, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]);
+ fprintf (file, "-(%s%s)", REGISTER_PREFIX, reg_names[REGNO (XEXP (addr, 0))]);
break;
case POST_INC:
- fprintf (file, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]);
+ fprintf (file, "(%s%s)+", REGISTER_PREFIX, reg_names[REGNO (XEXP (addr, 0))]);
break;
case PLUS:
@@ -232,7 +235,7 @@ print_operand_address (file, addr)
output_address (offset);
if (breg != 0)
- fprintf (file, "(%s)", reg_names[REGNO (breg)]);
+ fprintf (file, "(%s%s)", REGISTER_PREFIX, reg_names[REGNO (breg)]);
if (ireg != 0)
{
@@ -240,7 +243,7 @@ print_operand_address (file, addr)
ireg = XEXP (ireg, 0);
if (GET_CODE (ireg) != REG)
abort ();
- fprintf (file, "[%s]", reg_names[REGNO (ireg)]);
+ fprintf (file, "[%s%s]", REGISTER_PREFIX, reg_names[REGNO (ireg)]);
}
break;
@@ -249,7 +252,7 @@ print_operand_address (file, addr)
}
}
-char *
+const char *
rev_cond_name (op)
rtx op;
{
@@ -286,8 +289,10 @@ vax_float_literal(c)
register rtx c;
{
register enum machine_mode mode;
+#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT
int i;
union {double d; int i[2];} val;
+#endif
if (GET_CODE (c) != CONST_DOUBLE)
return 0;
@@ -323,7 +328,8 @@ vax_float_literal(c)
2 - indirect */
-int vax_address_cost(addr)
+int
+vax_address_cost (addr)
register rtx addr;
{
int reg = 0, indexed = 0, indir = 0, offset = 0, predec = 0;
@@ -365,6 +371,8 @@ int vax_address_cost(addr)
indir = 2; /* 3 on VAX 2 */
addr = XEXP (addr, 0);
goto restart;
+ default:
+ break;
}
/* Up to 3 things can be added in an address. They are stored in
@@ -402,7 +410,7 @@ vax_rtx_cost (x)
enum machine_mode mode = GET_MODE (x);
register int c;
int i = 0; /* may be modified in switch */
- char *fmt = GET_RTX_FORMAT (code); /* may be modified in switch */
+ const char *fmt = GET_RTX_FORMAT (code); /* may be modified in switch */
switch (code)
{
@@ -427,6 +435,8 @@ vax_rtx_cost (x)
case QImode:
c = 10; /* 3-4 on VAX 9000, 20-28 on VAX 2 */
break;
+ default:
+ break;
}
break;
case UDIV:
@@ -582,7 +592,7 @@ vax_rtx_cost (x)
/* Check a `double' value for validity for a particular machine mode. */
-static char *float_strings[] =
+static const char *const float_strings[] =
{
"1.70141173319264430e+38", /* 2^127 (2^24 - 1) / 2^24 */
"-1.70141173319264430e+38",
@@ -661,7 +671,7 @@ check_float_value (mode, d, overflow)
static
struct extern_list {
struct extern_list *next; /* next external */
- char *name; /* name of the external */
+ const char *name; /* name of the external */
int size; /* external's actual size */
int in_const; /* section type flag */
} *extern_head = 0, *pending_head = 0;
@@ -672,7 +682,7 @@ struct extern_list {
void
vms_check_external (decl, name, pending)
tree decl;
- char *name;
+ const char *name;
int pending;
{
register struct extern_list *p, *p0;
diff --git a/gnu/egcs/gcc/config/vax/vax.h b/gnu/egcs/gcc/config/vax/vax.h
index 6492ea6d331..42b206f867b 100644
--- a/gnu/egcs/gcc/config/vax/vax.h
+++ b/gnu/egcs/gcc/config/vax/vax.h
@@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */
/* If using g-format floating point, alter math.h. */
-#define CPP_SPEC "%{mg:-DGFLOAT}"
+#define CPP_SPEC "%{mg:%{!ansi:-DGFLOAT} -D__GFLOAT}"
/* Choose proper libraries depending on float format.
Note that there are no profiling libraries for g-format.
@@ -51,13 +51,16 @@ extern int target_flags;
/* Macros used in the machine description to test the flags. */
/* Nonzero if compiling code that Unix assembler can assemble. */
-#define TARGET_UNIX_ASM (target_flags & 1)
+#define MASK_UNIX_ASM 1
+#define TARGET_UNIX_ASM (target_flags & MASK_UNIX_ASM)
/* Nonzero if compiling with VAX-11 "C" style structure alignment */
-#define TARGET_VAXC_ALIGNMENT (target_flags & 2)
+#define MASK_VAXC_ALIGNMENT 2
+#define TARGET_VAXC_ALIGNMENT (target_flags & MASK_VAXC_ALIGNMENT)
/* Nonzero if compiling with `G'-format floating point */
-#define TARGET_G_FLOAT (target_flags & 4)
+#define MASK_G_FLOAT 4
+#define TARGET_G_FLOAT (target_flags & MASK_G_FLOAT)
/* Macro to define tables used to set the flags.
This is a list in braces of pairs in braces,
@@ -66,26 +69,26 @@ extern int target_flags;
An empty string NAME is used to identify the default VALUE. */
#define TARGET_SWITCHES \
- { {"unix", 1}, \
- {"gnu", -1}, \
- {"vaxc-alignment", 2}, \
- {"g", 4}, \
- {"g-float", 4}, \
- {"d", -4}, \
- {"d-float", -4}, \
- { "", TARGET_DEFAULT}}
+ { {"unix", MASK_UNIX_ASM, "Generate code for UNIX assembler"}, \
+ {"gnu", -MASK_UNIX_ASM, "Generate code for GNU assembler (gas)"}, \
+ {"vaxc-alignment", MASK_VAXC_ALIGNMENT, "Use VAXC structure conventions"}, \
+ {"g", MASK_G_FLOAT, "Generate GFLOAT double precision code"}, \
+ {"g-float", MASK_G_FLOAT, "Generate GFLOAT double precision code"}, \
+ {"d", -MASK_G_FLOAT, "Generate DFLOAT double precision code"}, \
+ {"d-float", -MASK_G_FLOAT, "Generate DFLOAT double precision code"}, \
+ { "", TARGET_DEFAULT, 0}}
/* Default target_flags if no switches specified. */
#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 1
+#define TARGET_DEFAULT MASK_UNIX_ASM
#endif
/* Target machine storage layout */
/* Define for software floating point emulation of VAX format
when cross compiling from a non-VAX host. */
-/* #define REAL_ARITHMETIC */
+#define REAL_ARITHMETIC
/* Define this if most significant bit is lowest numbered
in instructions that operate on numbered bit-fields.
@@ -258,7 +261,7 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
This is an initializer for a vector of HARD_REG_SET
of length N_REG_CLASSES. */
-#define REG_CLASS_CONTENTS {0, 0xffff}
+#define REG_CLASS_CONTENTS {{0}, {0xffff}}
/* The same information, inverted:
Return the class number of the smallest class containing
@@ -347,8 +350,7 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
/* Given an rtx for the address of a frame,
return an rtx for the address of the word in the frame
that holds the dynamic chain--the previous frame's address. */
-#define DYNAMIC_CHAIN_ADDRESS(frame) \
-gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
+#define DYNAMIC_CHAIN_ADDRESS(FRAME) plus_constant ((FRAME), 12)
/* If we generate an insn to push BYTES bytes,
this says how many the stack pointer really advances by.
@@ -377,14 +379,14 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
/* On the Vax the return value is in R0 regardless. */
#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
+ gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
/* On the Vax the return value is in R0 regardless. */
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
+#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
/* Define this if PCC uses the nonreentrant convention for returning
structure and union values. */
@@ -469,10 +471,11 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
if (warn_stack_larger_than && size > stack_larger_than_size) \
warning ("stack usage is %d bytes", size); \
if ((size) >= 64) \
- fprintf (FILE, "\tmovab %d(sp),sp\n", -size); \
+ fprintf (FILE, "\tmovab %d(%ssp),%ssp\n", -size, \
+ REGISTER_PREFIX, REGISTER_PREFIX); \
else if (size) \
- fprintf (FILE, "\tsubl2 $%d,sp\n", (size)); \
-}
+ fprintf (FILE, "\tsubl2 $%d,%ssp\n", \
+ (size), REGISTER_PREFIX); }
/* vms.h redefines this. */
#define MAYBE_VMS_FUNCTION_PROLOGUE(FILE)
@@ -500,8 +503,9 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
*/
#define BLOCK_PROFILER(FILE, BLOCKNO) \
- fprintf (FILE, "\tmovpsl -(sp)\n\tmovw (sp),2(sp)\n\taddl2 $2,sp\n\taddl2 $1,LPBX2+%d\n\tbicpsw $255\n\tbispsw (sp)+\n", \
- 4 * BLOCKNO)
+ fprintf (FILE, "\tmovpsl -(%ssp)\n\tmovw (%ssp),2(%ssp)\n\taddl2 $2,%ssp\n\taddl2 $1,LPBX2+%d\n\tbicpsw $255\n\tbispsw (%ssp)+\n", \
+ 4 * BLOCKNO, REGISTER_PREFIX, REGISTER_PREFIX, REGISTER_PREFIX, \
+ REGISTER_PREFIX, REGISTER_PREFIX)
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
the stack pointer does not matter. The value is tested only in
@@ -538,10 +542,10 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
#define TRAMPOLINE_TEMPLATE(FILE) \
{ \
ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, GEN_INT (0x8fd0)); \
+ ASM_OUTPUT_SHORT (FILE, GEN_INT (0x8fd0)); \
ASM_OUTPUT_INT (FILE, const0_rtx); \
- ASM_OUTPUT_BYTE (FILE, 0x50+STATIC_CHAIN_REGNUM); \
- ASM_OUTPUT_SHORT (FILE, GEN_INT (0x9f17)); \
+ ASM_OUTPUT_BYTE (FILE, 0x50 + STATIC_CHAIN_REGNUM); \
+ ASM_OUTPUT_SHORT (FILE, GEN_INT (0x9f17)); \
ASM_OUTPUT_INT (FILE, const0_rtx); \
}
@@ -560,16 +564,20 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
FNADDR is an RTX for the address of the function's pure code.
CXT is an RTX for the static chain value for the function. */
+/* This is separated out so register prefixes can be added by a target
+ if it requires them */
+#define VAX_ISTREAM_SYNC "movpsl -(sp)\n\tpushal 1(pc)\n\trei"
+
/* We copy the register-mask from the function's pure code
to the start of the trampoline. */
+
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
{ \
- emit_insn (gen_rtx (ASM_INPUT, VOIDmode, \
- "movpsl -(sp)\n\tpushal 1(pc)\n\trei")); \
- emit_move_insn (gen_rtx (MEM, HImode, TRAMP), \
- gen_rtx (MEM, HImode, FNADDR)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 4)), CXT);\
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 11)), \
+ emit_insn (gen_rtx_ASM_INPUT (VOIDmode, VAX_ISTREAM_SYNC)); \
+ emit_move_insn (gen_rtx_MEM (HImode, TRAMP), \
+ gen_rtx_MEM (HImode, FNADDR)); \
+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), CXT);\
+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 11)), \
plus_constant (FNADDR, 2)); \
FINALIZE_TRAMPOLINE(TRAMP); \
}
@@ -586,7 +594,7 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
#define RETURN_ADDR_RTX(COUNT, FRAME) \
((COUNT == 0) \
- ? gen_rtx (MEM, Pmode, plus_constant (FRAME, RETURN_ADDRESS_OFFSET)) \
+ ? gen_rtx_MEM (Pmode, plus_constant (FRAME, RETURN_ADDRESS_OFFSET)) \
: (rtx) 0)
@@ -841,6 +849,10 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
jumps to the default label instead. */
#define CASE_DROPS_THROUGH
+/* Indicate that jump tables go in the text section. This is
+ necessary when compiling PIC code. */
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+
/* Specify the tree operation to be used to convert reals to integers. */
#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
@@ -1041,14 +1053,17 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
/* Output before read-only data. */
-#define TEXT_SECTION_ASM_OP ".text"
+#define TEXT_SECTION_ASM_OP "\t.text"
/* Output before writable data. */
-#define DATA_SECTION_ASM_OP ".data"
+#define DATA_SECTION_ASM_OP "\t.data"
/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
+ This sequence is indexed by compiler's hard-register-number (see above).
+ The register names will be prefixed by REGISTER_PREFIX, if any. */
+
+#define REGISTER_PREFIX ""
#define REGISTER_NAMES \
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
@@ -1098,7 +1113,7 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12))
/* The prefix to add to user-visible assembler symbols. */
-#define USER_LABEL_PREFIX "_"
+#define USER_LABEL_PREFIX ""
/* This is how to output an internal numbered label where
PREFIX is the class of label and NUM is the number within the class. */
@@ -1159,25 +1174,45 @@ do { char dstr[30]; \
It need not be very fast code. */
#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tpushl %s\n", reg_names[REGNO])
+ fprintf (FILE, "\tpushl %s%s\n", REGISTER_PREFIX, reg_names[REGNO])
/* This is how to output an insn to pop a register from the stack.
It need not be very fast code. */
#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmovl (sp)+,%s\n", reg_names[REGNO])
+ fprintf (FILE, "\tmovl (%ssp)+,%s%s\n", REGISTER_PREFIX, REGISTER_PREFIX, \
+ reg_names[REGNO])
/* This is how to output an element of a case-vector that is absolute.
(The Vax does not use such vectors,
but we must define this macro anyway.) */
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long L%d\n", VALUE)
+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+ do \
+ { \
+ char label[256]; \
+ ASM_GENERATE_INTERNAL_LABEL (label, "L", (VALUE)); \
+ fprintf (FILE, "\t.long "); \
+ assemble_name (FILE, label); \
+ fprintf (FILE, "\n"); \
+ } \
+ while (0)
/* This is how to output an element of a case-vector that is relative. */
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
- fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+ do \
+ { \
+ char label[256]; \
+ ASM_GENERATE_INTERNAL_LABEL (label, "L", (VALUE)); \
+ fprintf (FILE, "\t.word "); \
+ assemble_name (FILE, label); \
+ ASM_GENERATE_INTERNAL_LABEL (label, "L", (REL)); \
+ fprintf (FILE, "-"); \
+ assemble_name (FILE, label); \
+ fprintf (FILE, "\n"); \
+ } \
+ while (0)
/* This is how to output an assembler line
that says to advance the location counter
@@ -1236,7 +1271,7 @@ do { char dstr[30]; \
#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
do { \
fprintf (FILE, "\t.word 0x0ffc\n"); \
- fprintf (FILE, "\taddl2 $%d,4(ap)\n", DELTA); \
+ fprintf (FILE, "\taddl2 $%d,4(%sap)\n", DELTA, REGISTER_PREFIX); \
fprintf (FILE, "\tjmp "); \
assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
fprintf (FILE, "+2\n"); \
@@ -1284,7 +1319,7 @@ VAX operand formatting codes:
((CODE) == '#')
#define PRINT_OPERAND(FILE, X, CODE) \
-{ extern char *rev_cond_name (); \
+{ extern const char *rev_cond_name (); \
if (CODE == '#') fputc (ASM_DOUBLE_CHAR, FILE); \
else if (CODE == 'C') \
fputs (rev_cond_name (X), FILE); \
@@ -1308,7 +1343,7 @@ VAX operand formatting codes:
else if (CODE == 'M' && GET_CODE (X) == CONST_INT) \
fprintf (FILE, "$%d", ~((1 << INTVAL (x)) - 1)); \
else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
+ fprintf (FILE, "%s%s", REGISTER_PREFIX, reg_names[REGNO (X)]); \
else if (GET_CODE (X) == MEM) \
output_address (XEXP (X, 0)); \
else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
diff --git a/gnu/usr.bin/binutils/Makefile.bsd-wrapper b/gnu/usr.bin/binutils/Makefile.bsd-wrapper
index 73444a7857e..1223ec7954a 100644
--- a/gnu/usr.bin/binutils/Makefile.bsd-wrapper
+++ b/gnu/usr.bin/binutils/Makefile.bsd-wrapper
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.80 2013/03/10 21:06:23 miod Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.81 2013/07/05 21:09:21 miod Exp $
.include <bsd.own.mk>
@@ -26,7 +26,7 @@ MAN= binutils/doc/addr2line.1 binutils/doc/objcopy.1 \
binutils/doc/objdump.1 binutils/doc/readelf.1 \
c++filt.1
-.if !defined(TARGET_ARCH)
+.if !defined(TARGET_ARCH) && !defined(BOOTSTRAP)
CONF_SUBDIRS+= gdb
SUBDIRS+= gdb
INST_SUBDIRS+= gdb
diff --git a/gnu/usr.bin/binutils/bfd/config.bfd b/gnu/usr.bin/binutils/bfd/config.bfd
index 9136dfe3343..76a415fc2cd 100644
--- a/gnu/usr.bin/binutils/bfd/config.bfd
+++ b/gnu/usr.bin/binutils/bfd/config.bfd
@@ -1278,8 +1278,8 @@ case "${targ}" in
;;
vax-*-openbsd*)
- targ_defvec=vaxnetbsd_vec
- targ_underscore=yes
+ targ_defvec=bfd_elf32_vax_vec
+ targ_selvecs=vaxnetbsd_vec
;;
vax-*-linux-gnu*)
diff --git a/gnu/usr.bin/binutils/bfd/elf32-vax.c b/gnu/usr.bin/binutils/bfd/elf32-vax.c
index 1aca042c61c..c509ccc2e4e 100644
--- a/gnu/usr.bin/binutils/bfd/elf32-vax.c
+++ b/gnu/usr.bin/binutils/bfd/elf32-vax.c
@@ -1,6 +1,6 @@
/* VAX series support for 32-bit ELF
- Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004 Free Software Foundation, Inc.
Contributed by Matt Thomas <matt@3am-software.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -578,7 +578,7 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
asection *srelgot;
asection *sreloc;
- if (info->relocateable)
+ if (info->relocatable)
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
@@ -821,14 +821,14 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_VAX_GNU_VTINHERIT:
- if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_VAX_GNU_VTENTRY:
- if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return FALSE;
break;
@@ -892,20 +892,21 @@ elf_vax_gc_sweep_hook (abfd, info, sec, relocs)
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
bfd *dynobj;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
-
dynobj = elf_hash_table (info)->dynobj;
if (dynobj == NULL)
return TRUE;
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
{
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+
switch (ELF32_R_TYPE (rel->r_info))
{
case R_VAX_GOT32:
@@ -1005,7 +1006,7 @@ elf_vax_adjust_dynamic_symbol (info, h)
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
{
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
}
@@ -1149,7 +1150,7 @@ elf_vax_size_dynamic_sections (output_bfd, info)
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (!info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -1283,7 +1284,12 @@ elf_vax_size_dynamic_sections (output_bfd, info)
}
/* Allocate memory for the section contents. */
- s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+ /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
+ Unused entries should be reclaimed before the section's contents
+ are written out, but at the moment this does not happen. Thus in
+ order to prevent writing out garbage, we initialise the section's
+ contents to zero. */
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return FALSE;
}
@@ -1296,7 +1302,7 @@ elf_vax_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
if (!info->shared)
{
@@ -1338,7 +1344,6 @@ elf_vax_size_dynamic_sections (output_bfd, info)
in regular objects. We allocated space for them in the check_relocs
routine, but we won't fill them in in the relocate_section routine. */
-/*ARGSUSED*/
static bfd_boolean
elf_vax_discard_copies (h, ignore)
struct elf_vax_link_hash_entry *h;
@@ -1366,7 +1371,6 @@ elf_vax_discard_copies (h, ignore)
creating a shared object or executable, space in the .got and .rela.got
will be reserved for the symbol. */
-/*ARGSUSED*/
static bfd_boolean
elf_vax_instantiate_got_entries (h, infoptr)
struct elf_link_hash_entry *h;
@@ -1401,7 +1405,7 @@ elf_vax_instantiate_got_entries (h, infoptr)
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
{
- if (!bfd_elf32_link_record_dynamic_symbol (info, h))
+ if (!bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
}
@@ -1440,7 +1444,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocateable)
+ if (info->relocatable)
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
@@ -1483,19 +1487,21 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (h->root.type == bfd_link_hash_defined
+ bfd_boolean unresolved_reloc;
+ bfd_boolean warned;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
+
+ if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- if ((r_type == R_VAX_PLT32
+ && ((r_type == R_VAX_PLT32
&& h->plt.offset != (bfd_vma) -1
&& elf_hash_table (info)->dynamic_sections_created)
|| (r_type == R_VAX_GOT32
@@ -1524,34 +1530,11 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_VAX_32
|| r_type == R_VAX_PC8
|| r_type == R_VAX_PC16
- || r_type == R_VAX_PC32)))
- {
- /* In these cases, we don't need the relocation
- value. We check specially because in some
- obscure cases sec->output_section will be NULL. */
- relocation = 0;
- }
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
+ || r_type == R_VAX_PC32))))
+ /* In these cases, we don't need the relocation
+ value. We check specially because in some
+ obscure cases sec->output_section will be NULL. */
relocation = 0;
- else if (info->shared
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
- {
- if (!(info->callbacks->undefined_symbol
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return FALSE;
- relocation = 0;
- }
}
switch (r_type)
@@ -1758,16 +1741,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
{
long indx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
@@ -2164,7 +2138,7 @@ elf_vax_finish_dynamic_sections (output_bfd, info)
_bfd_elf_create_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_create \
elf_vax_link_hash_table_create
-#define bfd_elf32_bfd_final_link _bfd_elf32_gc_common_final_link
+#define bfd_elf32_bfd_final_link bfd_elf_gc_common_final_link
#define elf_backend_check_relocs elf_vax_check_relocs
#define elf_backend_adjust_dynamic_symbol \
diff --git a/gnu/usr.bin/binutils/configure b/gnu/usr.bin/binutils/configure
index bd8b14f17ee..6ea3c9f2e47 100644
--- a/gnu/usr.bin/binutils/configure
+++ b/gnu/usr.bin/binutils/configure
@@ -1490,7 +1490,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
;;
vax-*-openbsd*)
- noconfigdirs="$noconfigdirs ld gas gprof ${libgcj}"
+ noconfigdirs="$noconfigdirs ${libgcj}"
;;
vax-*-vms)
noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss ${libgcj}"
diff --git a/gnu/usr.bin/binutils/configure.in b/gnu/usr.bin/binutils/configure.in
index 804921b4e4f..d1217815388 100644
--- a/gnu/usr.bin/binutils/configure.in
+++ b/gnu/usr.bin/binutils/configure.in
@@ -723,7 +723,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
;;
vax-*-openbsd*)
- noconfigdirs="$noconfigdirs ld gas gprof ${libgcj}"
+ noconfigdirs="$noconfigdirs ${libgcj}"
;;
vax-*-vms)
noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss ${libgcj}"
diff --git a/gnu/usr.bin/binutils/gas/configure b/gnu/usr.bin/binutils/gas/configure
index 2c2755edc07..b57f2d5d400 100644
--- a/gnu/usr.bin/binutils/gas/configure
+++ b/gnu/usr.bin/binutils/gas/configure
@@ -4568,7 +4568,7 @@ echo "$as_me: error: Solaris must be configured little endian" >&2;}
v850e-*-*) fmt=elf ;;
v850ea-*-*) fmt=elf ;;
- vax-*-netbsdelf*) fmt=elf em=nbsd ;;
+ vax-*-netbsdelf* | vax-*-openbsd*) fmt=elf em=nbsd ;;
vax-*-netbsd*) fmt=aout em=nbsd ;;
vax-*-bsd* | vax-*-ultrix*) fmt=aout ;;
vax-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;;
diff --git a/gnu/usr.bin/binutils/gas/configure.in b/gnu/usr.bin/binutils/gas/configure.in
index 690406f41e7..f0ec2411f5d 100644
--- a/gnu/usr.bin/binutils/gas/configure.in
+++ b/gnu/usr.bin/binutils/gas/configure.in
@@ -526,7 +526,7 @@ changequote([,])dnl
v850e-*-*) fmt=elf ;;
v850ea-*-*) fmt=elf ;;
- vax-*-netbsdelf*) fmt=elf em=nbsd ;;
+ vax-*-netbsdelf* | vax-*-openbsd*) fmt=elf em=nbsd ;;
vax-*-netbsd*) fmt=aout em=nbsd ;;
vax-*-bsd* | vax-*-ultrix*) fmt=aout ;;
vax-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;;
diff --git a/gnu/usr.bin/binutils/gdb/configure.tgt b/gnu/usr.bin/binutils/gdb/configure.tgt
index a6e3d931526..788727843d9 100644
--- a/gnu/usr.bin/binutils/gdb/configure.tgt
+++ b/gnu/usr.bin/binutils/gdb/configure.tgt
@@ -231,7 +231,6 @@ esac
case "${target}" in
*-*-linux*) gdb_osabi=GDB_OSABI_LINUX ;;
*-*-nto*) gdb_osabi=GDB_OSABI_QNXNTO ;;
-vax-*-openbsd*) ;;
*-*-openbsd*) gdb_osabi=GDB_OSABI_OPENBSD_ELF ;;
*-*-solaris*) gdb_osabi=GDB_OSABI_SOLARIS ;;
*-*-*-gnu*) ;; # prevent non-GNU kernels to match the Hurd rule below
diff --git a/gnu/usr.bin/binutils/ld/Makefile.am b/gnu/usr.bin/binutils/ld/Makefile.am
index 4a2382dc56b..a6088cbbb05 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.am
+++ b/gnu/usr.bin/binutils/ld/Makefile.am
@@ -184,6 +184,7 @@ ALL_EMULATIONS = \
eelf32ppcsim.o \
eelf32ppcwindiss.o \
eelf32vax.o \
+ eelf32vax_obsd.o \
eelf32xstormy16.o \
eelf32xtensa.o \
eelf_i386.o \
@@ -620,6 +621,10 @@ eelf32am33lin.c: $(srcdir)/emulparams/elf32am33lin.sh \
eelf32vax.c: $(srcdir)/emulparams/elf32vax.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32vax "$(tdir_elf32vax)"
+eelf32vax_obsd.c: $(srcdir)/emulparams/elf32vax_obsd.sh \
+ $(srcdir)/emulparams/elf32vax.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32vax_obsd "$(tdir_elf32vax_obsd)"
eelf32xtensa.c: $(srcdir)/emulparams/elf32xtensa.sh \
$(srcdir)/emulparams/xtensa-config.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/xtensaelf.em \
diff --git a/gnu/usr.bin/binutils/ld/Makefile.in b/gnu/usr.bin/binutils/ld/Makefile.in
index f968e52a5c5..8eb899f49a2 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.in
+++ b/gnu/usr.bin/binutils/ld/Makefile.in
@@ -298,6 +298,7 @@ ALL_EMULATIONS = \
eelf32ppcsim.o \
eelf32ppcwindiss.o \
eelf32vax.o \
+ eelf32vax_obsd.o \
eelf32xstormy16.o \
eelf32xtensa.o \
eelf_i386.o \
@@ -1346,6 +1347,10 @@ eelf32am33lin.c: $(srcdir)/emulparams/elf32am33lin.sh \
eelf32vax.c: $(srcdir)/emulparams/elf32vax.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32vax "$(tdir_elf32vax)"
+eelf32vax_obsd.c: $(srcdir)/emulparams/elf32vax_obsd.sh \
+ $(srcdir)/emulparams/elf32vax.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32vax_obsd "$(tdir_elf32vax_obsd)"
eelf32xtensa.c: $(srcdir)/emulparams/elf32xtensa.sh \
$(srcdir)/emulparams/xtensa-config.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/xtensaelf.em \
diff --git a/gnu/usr.bin/binutils/ld/configure.tgt b/gnu/usr.bin/binutils/ld/configure.tgt
index 7660c137235..9ea009abf46 100644
--- a/gnu/usr.bin/binutils/ld/configure.tgt
+++ b/gnu/usr.bin/binutils/ld/configure.tgt
@@ -417,6 +417,8 @@ vax-*-netbsdelf*) targ_emul=elf32vax
vax-*-netbsdaout* | vax-*-netbsd*)
targ_emul=vaxnbsd
targ_extra_emuls=elf32vax ;;
+vax-*-openbsd*) targ_emul=elf32vax_obsd
+ targ_extra_emuls=vaxnbsd ;;
vax-*-linux-gnu*) targ_emul=elf32vax ;;
mips*-*-pe) targ_emul=mipspe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32vax_obsd.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32vax_obsd.sh
new file mode 100644
index 00000000000..996426edad5
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32vax_obsd.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/elf32vax.sh
+. ${srcdir}/emulparams/elf_obsd.sh