This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

K&R fixes for HPUX


The enclosed patch allows building binutils with the HPUX bundled
compilers (both 32 and 64-bit).  I have also tested it with builds
and testsuite runs using gcc 3.2.

Please install if ok.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2002-08-20  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* readelf.c (parse_args): Change debug_dump_opt to static.

	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Add PARAMS to
	argument declaration.

	* config/tc-hppa.c (pa_dwarf2_directive_file): Add wrapper for function
	dwarf2_directive_file.

	* gmon_io.c (gmon_io_read_64, gmon_io_write_64): Define only if
	BFD_HOST_U_64_BIT is defined.
	(gmon_io_read_vma, gmon_io_write_vma): Add ifdefs.

	* ldlang.c (offsetof): Define if not defined.

Index: ./binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.171
diff -u -3 -p -r1.171 readelf.c
--- ./binutils/readelf.c	17 Aug 2002 09:59:34 -0000	1.171
+++ ./binutils/readelf.c	20 Aug 2002 18:03:31 -0000
@@ -2517,7 +2517,7 @@ parse_args (argc, argv)
 	    do_debugging = 1;
 	  else
 	    {
-	      const char *debug_dump_opt[]
+	      static const char *debug_dump_opt[]
 		= { "line", "info", "abbrev", "pubnames", "ranges",
 		    "macro", "frames", "frames-interp", "str", "loc", NULL };
 	      unsigned int index;
Index: ./bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.11
diff -u -3 -p -r1.11 elf-eh-frame.c
--- ./bfd/elf-eh-frame.c	15 May 2002 00:18:56 -0000	1.11
+++ ./bfd/elf-eh-frame.c	20 Aug 2002 18:03:31 -0000
@@ -287,7 +287,7 @@ _bfd_elf_discard_section_eh_frame (abfd,
      bfd *abfd;
      struct bfd_link_info *info;
      asection *sec, *ehdrsec;
-     boolean (*reloc_symbol_deleted_p) (bfd_vma, PTR);
+     boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR));
      struct elf_reloc_cookie *cookie;
 {
   bfd_byte *ehbuf = NULL, *buf;
Index: ./gas/config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.97
diff -u -3 -p -r1.97 tc-hppa.c
--- ./gas/config/tc-hppa.c	6 Jun 2002 06:50:12 -0000	1.97
+++ ./gas/config/tc-hppa.c	20 Aug 2002 18:03:53 -0000
@@ -592,6 +592,7 @@ static int pa_parse_ftest_gfx_completer 
 #ifdef OBJ_ELF
 static void hppa_elf_mark_end_of_function PARAMS ((void));
 static void pa_build_unwind_subspace PARAMS ((struct call_info *));
+static void pa_dwarf2_directive_file PARAMS ((int));
 static void pa_vtable_entry PARAMS ((int));
 static void pa_vtable_inherit  PARAMS ((int));
 #endif
@@ -668,7 +669,7 @@ const pseudo_typeS md_pseudo_table[] =
   {"exit", pa_exit, 0},
   {"export", pa_export, 0},
 #ifdef OBJ_ELF
-  {"file", dwarf2_directive_file, 0 },
+  {"file", pa_dwarf2_directive_file, 0 },
 #endif
   {"fill", pa_fill, 0},
   {"float", pa_float_cons, 'f'},
@@ -8664,6 +8665,13 @@ elf_hppa_final_processing ()
 	S_GET_VALUE (call_info_pointer->end_symbol)
 	- S_GET_VALUE (call_info_pointer->start_symbol) + 4;
     }
+}
+
+static void
+pa_dwarf2_directive_file (dummy)
+     int dummy;
+{
+  dwarf2_directive_file (dummy);
 }
 
 static void
Index: ./gprof/gmon_io.c
===================================================================
RCS file: /cvs/src/src/gprof/gmon_io.c,v
retrieving revision 1.14
diff -u -3 -p -r1.14 gmon_io.c
--- ./gprof/gmon_io.c	1 Feb 2002 08:24:16 -0000	1.14
+++ ./gprof/gmon_io.c	20 Aug 2002 18:03:53 -0000
@@ -34,8 +34,10 @@
 #include "hist.h"
 #include "libiberty.h"
 
+#ifdef BFD_HOST_U_64_BIT
 static int gmon_io_read_64 PARAMS ((FILE *, BFD_HOST_U_64_BIT *));
 static int gmon_io_write_64 PARAMS ((FILE *, BFD_HOST_U_64_BIT));
+#endif
 static int gmon_read_raw_arc
   PARAMS ((FILE *, bfd_vma *, bfd_vma *, unsigned long *));
 static int gmon_write_raw_arc
@@ -57,6 +59,7 @@ gmon_io_read_32 (ifp, valp)
   return 0;
 }
 
+#ifdef BFD_HOST_U_64_BIT
 static int
 gmon_io_read_64 (ifp, valp)
      FILE *ifp;
@@ -69,6 +72,7 @@ gmon_io_read_64 (ifp, valp)
   *valp = bfd_get_64 (core_bfd, buf);
   return 0;
 }
+#endif
 
 int
 gmon_io_read_vma (ifp, valp)
@@ -76,7 +80,9 @@ gmon_io_read_vma (ifp, valp)
      bfd_vma *valp;
 {
   unsigned int val32;
+#ifdef BFD_HOST_U_64_BIT
   BFD_HOST_U_64_BIT val64;
+#endif
 
   switch (bfd_arch_bits_per_address (core_bfd))
     {
@@ -86,11 +92,13 @@ gmon_io_read_vma (ifp, valp)
       *valp = val32;
       break;
 
+#ifdef BFD_HOST_U_64_BIT
     case 64:
       if (gmon_io_read_64 (ifp, &val64))
 	return 1;
       *valp = val64;
       break;
+#endif
 
     default:
       fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
@@ -124,6 +132,7 @@ gmon_io_write_32 (ofp, val)
   return 0;
 }
 
+#ifdef BFD_HOST_U_64_BIT
 static int
 gmon_io_write_64 (ofp, val)
      FILE *ofp;	
@@ -136,6 +145,7 @@ gmon_io_write_64 (ofp, val)
     return 1;
   return 0;
 }
+#endif
 
 int
 gmon_io_write_vma (ofp, val)
@@ -150,10 +160,12 @@ gmon_io_write_vma (ofp, val)
 	return 1;
       break;
 
+#ifdef BFD_HOST_U_64_BIT
     case 64:
       if (gmon_io_write_64 (ofp, (BFD_HOST_U_64_BIT) val))
 	return 1;
       break;
+#endif
 
     default:
       fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
@@ -194,7 +206,9 @@ gmon_read_raw_arc (ifp, fpc, spc, cnt)
      bfd_vma *spc;
      unsigned long *cnt;
 {
+#ifdef BFD_HOST_U_64_BIT
   BFD_HOST_U_64_BIT cnt64;
+#endif
   unsigned int cnt32;
 
   if (gmon_io_read_vma (ifp, fpc)
@@ -209,11 +223,13 @@ gmon_read_raw_arc (ifp, fpc, spc, cnt)
       *cnt = cnt32;
       break;
 
+#ifdef BFD_HOST_U_64_BIT
     case 64:
       if (gmon_io_read_64 (ifp, &cnt64))
 	return 1;
       *cnt = cnt64;
       break;
+#endif
 
     default:
       fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
@@ -242,10 +258,12 @@ gmon_write_raw_arc (ofp, fpc, spc, cnt)
 	return 1;
       break;
 
+#ifdef BFD_HOST_U_64_BIT
     case 64:
       if (gmon_io_write_64 (ofp, (BFD_HOST_U_64_BIT) cnt))
 	return 1;
       break;
+#endif
 
     default:
       fprintf (stderr, _("%s: bits per address has unexpected value of %u\n"),
Index: ./ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.96
diff -u -3 -p -r1.96 ldlang.c
--- ./ld/ldlang.c	13 Aug 2002 02:08:25 -0000	1.96
+++ ./ld/ldlang.c	20 Aug 2002 18:04:00 -0000
@@ -40,6 +40,10 @@ Software Foundation, 59 Temple Place - S
 #include "fnmatch.h"
 #include "demangle.h"
 
+#ifndef offsetof
+#define offsetof(TYPE,MEMBER) ((size_t)&(((TYPE*)0)->MEMBER))
+#endif
+
 /* FORWARDS */
 static lang_statement_union_type *new_statement
   PARAMS ((enum statement_enum, size_t, lang_statement_list_type *));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]