Index: gcc/gcc/c-common.c diff -u gcc/gcc/c-common.c:1.1.1.1 gcc/gcc/c-common.c:1.2 --- gcc/gcc/c-common.c:1.1.1.1 Fri Oct 5 11:30:20 2001 +++ gcc/gcc/c-common.c Mon May 13 18:04:45 2002 @@ -3417,9 +3417,13 @@ built_in_decls[BUILT_IN_PUTS] = builtin_function ("__builtin_puts", puts_ftype, BUILT_IN_PUTS, BUILT_IN_NORMAL, "puts"); + /* XXX fredette@netbsd.org - the kernel printf conflicts + with this. it's easiest to just turn this off for now. */ +#if 0 builtin_function_2 ("__builtin_printf", "printf", printf_ftype, printf_ftype, BUILT_IN_PRINTF, BUILT_IN_FRONTEND, 1, 0, 0); +#endif builtin_function_2 ("__builtin_fprintf", "fprintf", fprintf_ftype, fprintf_ftype, BUILT_IN_FPRINTF, BUILT_IN_FRONTEND, 1, 0, 0); Index: gcc/gcc/c-decl.c diff -u gcc/gcc/c-decl.c:1.1.1.1 gcc/gcc/c-decl.c:1.2 --- gcc/gcc/c-decl.c:1.1.1.1 Fri Oct 5 11:30:20 2001 +++ gcc/gcc/c-decl.c Mon May 13 18:05:32 2002 @@ -2459,7 +2459,13 @@ else if (oldlocal != 0) warning ("declaration of `%s' shadows previous local", id); else if (IDENTIFIER_GLOBAL_VALUE (name) != 0 - && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node) + && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node + /* No shadow warnings for built-in functions that + haven't otherwise been declared yet. */ + && ! (TREE_CODE (IDENTIFIER_GLOBAL_VALUE (name)) + == FUNCTION_DECL + && DECL_BUILT_IN (IDENTIFIER_GLOBAL_VALUE (name)) + && C_DECL_ANTICIPATED (IDENTIFIER_GLOBAL_VALUE (name)))) warning ("declaration of `%s' shadows global declaration", id); } Index: gcc/gcc/c-format.c diff -u gcc/gcc/c-format.c:1.1.1.1 gcc/gcc/c-format.c:1.2 --- gcc/gcc/c-format.c:1.1.1.1 Fri Oct 5 11:30:20 2001 +++ gcc/gcc/c-format.c Mon May 13 18:06:09 2002 @@ -1473,9 +1473,11 @@ if (res.number_dollar_extra_args > 0 && res.number_non_literal == 0 && res.number_other == 0 && warn_format_extra_args) status_warning (status, "unused arguments in $-style format"); +#if 0 /* XXX - fredette */ if (res.number_empty > 0 && res.number_non_literal == 0 && res.number_other == 0) status_warning (status, "zero-length format string"); +#endif if (res.number_wide > 0) status_warning (status, "format is a wide character string"); @@ -1569,7 +1571,9 @@ specially if info == NULL and add a res->number_null entry for that case, or maybe add a function pointer to be called at the end instead of hardcoding check_format_info_main. */ +#if 0 /* XXX - fredette */ status_warning (status, "null format string"); +#endif /* Skip to first argument to check, so we can see if this format has any arguments (it shouldn't). */ Index: gcc/gcc/config.gcc diff -u gcc/gcc/config.gcc:1.1.1.1 gcc/gcc/config.gcc:1.3 --- gcc/gcc/config.gcc:1.1.1.1 Fri Oct 5 11:30:20 2001 +++ gcc/gcc/config.gcc Tue Jun 18 12:41:14 2002 @@ -718,6 +718,20 @@ thread_file='posix' fi ;; +hppa*-*-netbsd*) + # in the NetBSD tree, this will be done in common code: + tm_file=pa/netbsd-elf.h + tmake_file="t-libc-ok t-netbsd" + xm_file="${xm_file} xm-netbsd.h" + xmake_file=none + # target-specific. note that we may override some common-code + # things above; if so the above can get cleaned up. + target_cpu_default="MASK_PA_11" + tm_file="${tm_file} pa/pa32-regs.h" + tmake_file=pa/t-netbsd + xm_file=pa/xm-pa.h + gas=yes gnu_ld=yes + ;; hppa*-*-openbsd*) target_cpu_default="MASK_PA_11" tmake_file=pa/t-openbsd Index: gcc/gcc/cppmacro.c diff -u gcc/gcc/cppmacro.c:1.1.1.1 gcc/gcc/cppmacro.c:1.2 --- gcc/gcc/cppmacro.c:1.1.1.1 Fri Oct 5 11:30:20 2001 +++ gcc/gcc/cppmacro.c Mon May 13 18:08:56 2002 @@ -1180,9 +1180,6 @@ if (node->flags & NODE_WARN) return 1; - if (! CPP_PEDANTIC (pfile)) - return 0; - /* Redefinition of a macro is allowed if and only if the old and new definitions are the same. (6.10.3 paragraph 2). */ macro1 = node->value.macro; Index: gcc/gcc/config/pa/milli32.S diff -u gcc/gcc/config/pa/milli32.S:1.1.1.1 gcc/gcc/config/pa/milli32.S:1.2 --- gcc/gcc/config/pa/milli32.S:1.1.1.1 Fri Oct 5 11:30:25 2001 +++ gcc/gcc/config/pa/milli32.S Tue Jun 18 12:48:29 2002 @@ -64,7 +64,7 @@ ldw 4(%r22),%r19 ; load new LTP value ldw 0(%r22),%r22 ; load address of target LSYM(1) -#ifdef LINUX +#if defined(LINUX) || defined(NETBSD) bv %r0(%r22) ; branch to the real target #else ldsid (%sr0,%r22),%r1 ; get the "space ident" selected by r22 Index: gcc/gcc/config/pa/netbsd-elf.h diff -u /dev/null gcc/gcc/config/pa/netbsd-elf.h:1.2 --- /dev/null Thu Nov 14 11:54:27 2002 +++ gcc/gcc/config/pa/netbsd-elf.h Tue Jun 18 12:49:17 2002 @@ -0,0 +1,371 @@ +/* Definitions for NetBSD PA_RISC with ELF format + Copyright 1999, 2000, 2001 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. */ + +/* XXX fredette - placement of this might need to be tuned: */ +#include + +/* XXX fredette - placement of this might need to be tuned: */ +#define OBJECT_FORMAT_ELF +#define NETBSD_ELF +#include + +/* Biggest alignment supported by the object file format of this + machine. Use this macro to limit the alignment which can be + specified using the `__attribute__ ((aligned (N)))' construct. If + not defined, the default value is `BIGGEST_ALIGNMENT'. */ +#define MAX_OFILE_ALIGNMENT (32768 * 8) + +#define bsd4_4 +#undef HAS_INIT_SECTION + +/* Switch into a generic section. + This is currently only used to support section attributes. + + We make the section read-only and executable for a function decl, + read-only for a const data decl, and writable for a non-const data decl. */ +#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ + fprintf (FILE, "\t.section\t\"%s\",\"%s\",@progbits\n", NAME, \ + (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ + (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw") + +/* XXX fredette - all of this used to be enabled before I + added LABELS_WITHOUT_COLONS to gas' config/tc-hppa.h: */ +#if 0 +/* This is how to store into the string LABEL + the symbol_ref name of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + This is suitable for output with `assemble_name'. */ + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ + sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM)) + +/* This is how to output an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. */ + +#undef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ + fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) + +/* This is how to output the definition of a user-level label named NAME, + such as the label on a static function or variable NAME. */ + +#undef ASM_OUTPUT_LABEL +#define ASM_OUTPUT_LABEL(FILE,NAME) \ + do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) + +/* This says how to output an assembler line to define a global common symbol + with size SIZE (in bytes) and alignment ALIGN (in bits). */ + +#undef ASM_OUTPUT_ALIGNED_COMMON +#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNED) \ +{ bss_section (); \ + assemble_name ((FILE), (NAME)); \ + fputs (":\t.comm ", (FILE)); \ + fprintf ((FILE), "%d\n", MAX ((SIZE), ((ALIGNED) / BITS_PER_UNIT)));} + +/* This says how to output an assembler line to define a local common symbol + with size SIZE (in bytes) and alignment ALIGN (in bits). */ + +#undef ASM_OUTPUT_ALIGNED_LOCAL +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \ +{ bss_section (); \ + fprintf ((FILE), "\t.align %d\n", ((ALIGNED) / BITS_PER_UNIT)); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ":\n\t.block %d\n", (SIZE));} +#endif /* 0 */ + +#if 0 /* eventually... */ +/* Use DWARF2 debugging info and unwind. */ +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +#endif +#define DWARF2_ASM_LINE_DEBUG_INFO 1 +#define DWARF2_UNWIND_INFO 1 + +#undef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__hppa__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -Asystem(unix) -Asystem(NetBSD) -Acpu(hppa) -Amachine(hppa) -Amachine(bigendian)" + +#undef CC1_SPEC +#define CC1_SPEC "%{pg:} %{p:} %{!mspace-regs:-mno-space-regs}" + +#undef LIB_SPEC +#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" + +#undef ASM_SPEC +#define ASM_SPEC \ + "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}" + +#undef LINK_SPEC +#define LINK_SPEC \ + "-m hppanbsd \ + %{assert*} %{R*} \ + %{shared:-shared} \ + %{!shared: \ + -dy -dc -dp \ + %{!nostdlib:%{!r*:%{!e*:-e _start}}} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \ + %{static:-static}}" + +#undef FUNCTION_OK_FOR_SIBCALL +#define FUNCTION_OK_FOR_SIBCALL(DECL) 1 + +#if 0 /* XXX - fredette */ +/* glibc's profiling functions don't need gcc to allocate counters. */ +#define NO_PROFILE_COUNTERS 1 +#endif + +/* Put plabels into the data section so we can relocate them. */ +#undef SELECT_RTX_SECTION +#define SELECT_RTX_SECTION(MODE,RTX) \ + if (flag_pic && function_label_operand (RTX, MODE)) \ + data_section (); \ + else \ + readonly_data_section (); + +/* A C expression whose value is RTL representing the location of the + incoming return address at the beginning of any function, before the + prologue. */ +#define INCOMING_RETURN_ADDR_RTX (gen_rtx_REG (word_mode, 2)) +#define DWARF_FRAME_RETURN_COLUMN (DWARF_FRAME_REGNUM (2)) + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#undef STRING_ASM_OP +#define STRING_ASM_OP ".stringz" + +/* Section output setup. */ + +#define USE_CONST_SECTION 1 + +#define TEXT_SECTION_ASM_OP "\t.text" +#define DATA_SECTION_ASM_OP "\t.data" +#define BSS_SECTION_ASM_OP "\t.section\t.bss" +#define CONST_SECTION_ASM_OP "\t.section\t.rodata" +#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" +#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" +#define INIT_SECTION_ASM_OP "\t.section\t.init" +#define FINI_SECTION_ASM_OP "\t.section\t.fini" + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_const, in_ctors, in_dtors + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CONST_SECTION_FUNCTION \ + CTORS_SECTION_FUNCTION \ + DTORS_SECTION_FUNCTION + +#undef READONLY_DATA_SECTION +#define READONLY_DATA_SECTION() const_section () + +extern void text_section (); + +#define CONST_SECTION_FUNCTION \ +void \ +const_section () \ +{ \ + if (!USE_CONST_SECTION) \ + text_section(); \ + else if (in_section != in_const) \ + { \ + fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ + in_section = in_const; \ + } \ +} + +#define CTORS_SECTION_FUNCTION \ +void \ +ctors_section () \ +{ \ + if (in_section != in_ctors) \ + { \ + fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ + in_section = in_ctors; \ + } \ +} + +#define DTORS_SECTION_FUNCTION \ +void \ +dtors_section () \ +{ \ + if (in_section != in_dtors) \ + { \ + fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ + in_section = in_dtors; \ + } \ +} + +/* A C statement (sans semicolon) to output an element in the table of + global constructors. */ +#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ + do { \ + ctors_section (); \ + fprintf (FILE, "\t.word\tP%%"); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* A C statement (sans semicolon) to output an element in the table of + global destructors. */ +#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ + do { \ + dtors_section (); \ + fprintf (FILE, "\t.word\tP%%"); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* Output at beginning of assembler file. We override the definition + from so that we can get the proper .LEVEL directive. */ +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) \ + do \ + { \ + if (write_symbols != NO_DEBUG) \ + { \ + output_file_directive (FILE, main_input_filename); \ + fputs ("\t.version\t\"01.01\"\n", FILE); \ + } \ + if (TARGET_64BIT) \ + fputs("\t.LEVEL 2.0w\n", FILE); \ + else if (TARGET_PA_20) \ + fputs("\t.LEVEL 2.0\n", FILE); \ + else if (TARGET_PA_11) \ + fputs("\t.LEVEL 1.1\n", FILE); \ + else \ + fputs("\t.LEVEL 1.0\n", FILE); \ + if (profile_flag) \ + fputs ("\t.IMPORT _mcount, CODE\n", FILE); \ + } \ + while (0) + +/* Output a definition */ +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ + do \ + { \ + fprintf ((FILE), "\t%s\t", SET_ASM_OP); \ + assemble_name (FILE, LABEL1); \ + fprintf (FILE, ","); \ + assemble_name (FILE, LABEL2); \ + fprintf (FILE, "\n"); \ + } \ + while (0) + +/* XXX fredette - these two used to be enabled before they blew up on me: */ +#if 0 +/* Define these to generate the Linux/ELF/SysV style of internal + labels all the time - i.e. to be compatible with + ASM_GENERATE_INTERNAL_LABEL in . Compare these with the + ones in pa.h and note the lack of dollar signs in these. FIXME: + shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */ + +#undef ASM_OUTPUT_ADDR_VEC_ELT +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ + if (TARGET_BIG_SWITCH) \ + fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldil LR'.L%d,%%r1\n\tbe RR'.L%d(%%sr4,%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE, VALUE); \ + else \ + fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE) + +#undef ASM_OUTPUT_ADDR_DIFF_ELT +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ + if (TARGET_BIG_SWITCH) \ + fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'.L%d(%%r19),%%r1\n\tbv %%r0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE); \ + else \ + fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE) +#endif /* 0 */ + +/* XXX fredette - all of this used to be enabled before I + added LABELS_WITHOUT_COLONS to gas' config/tc-hppa.h: */ +#if 0 +/* This is how to output the definition of a user-level label named NAME, + such as the label on a static function or variable NAME. */ + +#undef ASM_OUTPUT_LABEL +#define ASM_OUTPUT_LABEL(FILE, NAME) \ + do \ + { \ + assemble_name (FILE, NAME); \ + fputs (":\n", FILE); \ + } \ + while (0) +#endif /* 0 */ + +/* NOTE: ASM_OUTPUT_INTERNAL_LABEL() is defined for us by elfos.h, and + does what we want (i.e. uses colons). It must be compatible with + ASM_GENERATE_INTERNAL_LABEL(), so do not define it here. */ + +#undef ASM_GLOBALIZE_LABEL +#define ASM_GLOBALIZE_LABEL(FILE, NAME) \ + (fputs ("\t.globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) + +/* FIXME: Hacked from the one so that we avoid multiple + labels in a function declaration (since pa.c seems determined to do + it differently) */ + +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do \ + { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', FILE); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + } \ + while (0) + +/* NetBSD always uses gas. */ +#undef TARGET_GAS +#define TARGET_GAS 1 + +/* Definitions for PA_RISC with ELF-32 format + Copyright (C) 2000 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. */ + +/* Turn off various SOM crap we don't want. */ +#undef TARGET_ELF32 +#define TARGET_ELF32 1 + +#undef CPP_SPEC +#define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{mhppa:-D__hppa__} %{posix:-D_POSIX_SOURCE} -D_PA_RISC1_1" Index: gcc/gcc/config/pa/t-netbsd diff -u /dev/null gcc/gcc/config/pa/t-netbsd:1.2 --- /dev/null Thu Nov 14 11:54:27 2002 +++ gcc/gcc/config/pa/t-netbsd Tue Jun 18 12:48:06 2002 @@ -0,0 +1,32 @@ +LIBGCC1=libgcc1-asm.a +CROSS_LIBGCC1=libgcc1-asm.a + +#Plug millicode routines into libgcc.a We want these on both native and +#cross compiles. + +LIB1ASMFUNCS = _divI _divU _remI _remU _multiply \ + _divI_15 _divI_14 _divI_12 _divI_10 _divI_9 \ + _divI_7 _divI_6 _divI_5 _divI_3 \ + _divU_15 _divU_14 _divU_12 _divU_10 _divU_9 \ + _divU_7 _divU_6 _divU_5 _divU_3 _dyncall + +LIB1ASMSRC = pa/milli32.S + +# Don't build a shared libgcc_s.so. Our libgcc contains millicode, and +# the ABI (linker and dynamic linker really) does not allow millicode +# to be exported from shared libraries. Consequently, to successfully +# link against libgcc_s.so it is necessary to link against _both_ +# libgcc_s.so and libgcc.a. This is a pain. It's easier just to disable +# the shared libgcc. +SHLIB_LINK = + +### Compile crtbeginS.o and crtendS.o as PIC. +### XXX fredette - we're afraid of the optimizer: +CRTSTUFF_T_CFLAGS_S = -fPIC -O0 + +### Compile libgcc2.a as PIC. +### This is also used when compiling libgcc1 if libgcc1 is the asm variety. +### XXX fredette - we're afraid of the optimizer: +TARGET_LIBGCC2_CFLAGS = -fPIC -O0 -DELF=1 -DNETBSD + +ADA_CFLAGS=-mdisable-indexing Index: gcc/include/libiberty.h diff -u gcc/include/libiberty.h:1.1.1.1 gcc/include/libiberty.h:1.2 --- gcc/include/libiberty.h:1.1.1.1 Fri Oct 5 17:35:34 2001 +++ gcc/include/libiberty.h Mon May 13 18:09:58 2002 @@ -205,8 +205,10 @@ /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ +#ifndef __NetBSD__ extern int vasprintf PARAMS ((char **, const char *, va_list)) ATTRIBUTE_PRINTF(2,0); +#endif #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))