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]

[RFA] Clean up solaris 32/64 bit stuff from elf.c


OK, I would like to check in the following changes, 
which use autoconf variables to replace #ifdef _sparcv9
in bfd.

2000-08-29  Michael Snyder  <msnyder@seadog.cygnus.com>

        * elf.c: Eliminate references to __sparcv9 macro; replace with
        autoconf variables HAVE_PSINFO32_T etc.
        * configure.in: Auto-configure HAVE_PSINFO_32_T,
HAVE_PRPSINFO32_T,
        HAVE_PSTATUS32_T, HAVE_PRSTATUS32_T, HAVE_PRSTATUS32_T_PR_WHO.
        * config.in: Ditto.
        * acinclude.m4 (BFD_HAVE_SYS_PROCFS_TYPE) define _SYSCALL32 so
it can
        detect the above typedefs.  (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER):
Ditto.
        * aclocal.m4: Ditto.
        * configure: Regenerate.
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/bfd/acinclude.m4,v
retrieving revision 1.3
diff -p -r1.3 acinclude.m4
*** acinclude.m4	1999/08/08 16:01:13	1.3
--- acinclude.m4	2000/08/30 00:26:48
*************** dnl Check for existence of a type $1 in 
*** 74,80 ****
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
  [AC_MSG_CHECKING([for $1 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
!    [AC_TRY_COMPILE([#include <sys/procfs.h>],
        [$1 avar],
        bfd_cv_have_sys_procfs_type_$1=yes,
        bfd_cv_have_sys_procfs_type_$1=no
--- 74,82 ----
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
  [AC_MSG_CHECKING([for $1 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
!    [AC_TRY_COMPILE([
! #define _SYSCALL32
! #include <sys/procfs.h>],
        [$1 avar],
        bfd_cv_have_sys_procfs_type_$1=yes,
        bfd_cv_have_sys_procfs_type_$1=no
*************** dnl Check for existence of member $2 in 
*** 92,98 ****
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
  [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
!    [AC_TRY_COMPILE([#include <sys/procfs.h>],
        [$1 avar; void* aref = (void*) &avar.$2],
        bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
        bfd_cv_have_sys_procfs_type_member_$1_$2=no
--- 94,102 ----
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
  [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
!    [AC_TRY_COMPILE([
! #define _SYSCALL32
! #include <sys/procfs.h>],
        [$1 avar; void* aref = (void*) &avar.$2],
        bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
        bfd_cv_have_sys_procfs_type_member_$1_$2=no
Index: aclocal.m4
===================================================================
RCS file: /cvs/src/src/bfd/aclocal.m4,v
retrieving revision 1.8
diff -p -r1.8 aclocal.m4
*** aclocal.m4	2000/07/24 17:22:16	1.8
--- aclocal.m4	2000/08/30 00:26:48
***************
*** 1,3 ****
--- 1,4 ----
+ 
  dnl aclocal.m4 generated automatically by aclocal 1.4
  
  dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
*************** dnl Check for existence of a type $1 in 
*** 86,92 ****
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
  [AC_MSG_CHECKING([for $1 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
!    [AC_TRY_COMPILE([#include <sys/procfs.h>],
        [$1 avar],
        bfd_cv_have_sys_procfs_type_$1=yes,
        bfd_cv_have_sys_procfs_type_$1=no
--- 87,95 ----
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
  [AC_MSG_CHECKING([for $1 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
!    [AC_TRY_COMPILE([
! #define _SYSCALL32
! #include <sys/procfs.h>],
        [$1 avar],
        bfd_cv_have_sys_procfs_type_$1=yes,
        bfd_cv_have_sys_procfs_type_$1=no
*************** dnl Check for existence of member $2 in 
*** 104,110 ****
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
  [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
!    [AC_TRY_COMPILE([#include <sys/procfs.h>],
        [$1 avar; void* aref = (void*) &avar.$2],
        bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
        bfd_cv_have_sys_procfs_type_member_$1_$2=no
--- 107,115 ----
  AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
  [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
   AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
!    [AC_TRY_COMPILE([
! #define _SYSCALL32
! #include <sys/procfs.h>],
        [$1 avar; void* aref = (void*) &avar.$2],
        bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
        bfd_cv_have_sys_procfs_type_member_$1_$2=no
Index: config.in
===================================================================
RCS file: /cvs/src/src/bfd/config.in,v
retrieving revision 1.3
diff -p -r1.3 config.in
*** config.in	2000/01/10 18:50:16	1.3
--- config.in	2000/08/30 00:26:48
***************
*** 211,227 ****
--- 211,242 ----
  /* Define if <sys/procfs.h> has prstatus_t. */
  #undef HAVE_PRSTATUS_T
  
+ /* Define if <sys/procfs.h> has prstatus32_t. */
+ #undef HAVE_PRSTATUS32_T
+ 
  /* Define if <sys/procfs.h> has prstatus_t.pr_who. */
  #undef HAVE_PRSTATUS_T_PR_WHO
  
+ /* Define if <sys/procfs.h> has prstatus32_t.pr_who. */
+ #undef HAVE_PRSTATUS32_T_PR_WHO
+ 
  /* Define if <sys/procfs.h> has pstatus_t. */
  #undef HAVE_PSTATUS_T
  
+ /* Define if <sys/procfs.h> has pstatus32_t. */
+ #undef HAVE_PSTATUS32_T
+ 
  /* Define if <sys/procfs.h> has prpsinfo_t. */
  #undef HAVE_PRPSINFO_T
  
+ /* Define if <sys/procfs.h> has prpsinfo32_t. */
+ #undef HAVE_PRPSINFO32_T
+ 
  /* Define if <sys/procfs.h> has psinfo_t. */
  #undef HAVE_PSINFO_T
+ 
+ /* Define if <sys/procfs.h> has psinfo32_t. */
+ #undef HAVE_PSINFO32_T
  
  /* Define if <sys/procfs.h> has lwpstatus_t. */
  #undef HAVE_LWPSTATUS_T
Index: configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.29
diff -p -r1.29 configure.in
*** configure.in	2000/07/28 21:10:20	1.29
--- configure.in	2000/08/30 00:26:48
*************** changequote([,])dnl
*** 339,348 ****
--- 339,353 ----
    AC_CHECK_HEADERS(sys/procfs.h)
    if test "$ac_cv_header_sys_procfs_h" = yes; then
      BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t)
+     BFD_HAVE_SYS_PROCFS_TYPE(prstatus32_t)
      BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus_t, pr_who)
+     BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus32_t, pr_who)
      BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
+     BFD_HAVE_SYS_PROCFS_TYPE(pstatus32_t)
      BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
+     BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo32_t)
      BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
+     BFD_HAVE_SYS_PROCFS_TYPE(psinfo32_t)
      BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
      BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
      BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_reg)
Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.48
diff -p -r1.48 elf.c
*** elf.c	2000/08/22 19:33:16	1.48
--- elf.c	2000/08/30 00:26:48
*************** SECTION
*** 31,40 ****
  	haven't bothered yet.
   */
  
! #ifdef __sparcv9
! #define _SYSCALL32	/* For Sparc64-cross-32 */
! #endif
! 
  #include "bfd.h"
  #include "sysdep.h"
  #include "bfdlink.h"
--- 31,38 ----
  	haven't bothered yet.
   */
  
! /* For sparc64-cross-sparc32.  */
! #define _SYSCALL32
  #include "bfd.h"
  #include "sysdep.h"
  #include "bfdlink.h"
*************** bfd_elf_print_symbol (abfd, filep, symbo
*** 802,808 ****
  
  	if (name == NULL)
  	  {
! 	    name = symbol->name;  
  	    bfd_print_symbol_vandf ((PTR) file, symbol);
  	  }
  
--- 800,806 ----
  
  	if (name == NULL)
  	  {
! 	    name = symbol->name;
  	    bfd_print_symbol_vandf ((PTR) file, symbol);
  	  }
  
*************** _bfd_elf_link_hash_copy_indirect (dir, i
*** 981,987 ****
  }
  
  void
! _bfd_elf_link_hash_hide_symbol(info, h)
       struct bfd_link_info *info ATTRIBUTE_UNUSED;
       struct elf_link_hash_entry *h;
  {
--- 979,985 ----
  }
  
  void
! _bfd_elf_link_hash_hide_symbol (info, h)
       struct bfd_link_info *info ATTRIBUTE_UNUSED;
       struct elf_link_hash_entry *h;
  {
*************** elfcore_grok_prstatus (abfd, note)
*** 5300,5311 ****
--- 5298,5311 ----
    char* name;
    asection* sect;
    int raw_size;
+   int offset;
  
    if (note->descsz == sizeof (prstatus_t))
      {
        prstatus_t prstat;
  
        raw_size = sizeof (prstat.pr_reg);
+       offset   = offsetof (prstatus_t, pr_reg);
        memcpy (&prstat, note->descdata, sizeof (prstat));
  
        elf_tdata (abfd)->core_signal = prstat.pr_cursig;
*************** elfcore_grok_prstatus (abfd, note)
*** 5321,5333 ****
        elf_tdata (abfd)->core_lwpid = prstat.pr_who;
  #endif
      }
! #if defined (__sparcv9)
    else if (note->descsz == sizeof (prstatus32_t))
      {
        /* 64-bit host, 32-bit corefile */
        prstatus32_t prstat;
  
        raw_size = sizeof (prstat.pr_reg);
        memcpy (&prstat, note->descdata, sizeof (prstat));
  
        elf_tdata (abfd)->core_signal = prstat.pr_cursig;
--- 5321,5334 ----
        elf_tdata (abfd)->core_lwpid = prstat.pr_who;
  #endif
      }
! #if defined (HAVE_PRSTATUS32_T)
    else if (note->descsz == sizeof (prstatus32_t))
      {
        /* 64-bit host, 32-bit corefile */
        prstatus32_t prstat;
  
        raw_size = sizeof (prstat.pr_reg);
+       offset   = offsetof (prstatus32_t, pr_reg);
        memcpy (&prstat, note->descdata, sizeof (prstat));
  
        elf_tdata (abfd)->core_signal = prstat.pr_cursig;
*************** elfcore_grok_prstatus (abfd, note)
*** 5339,5349 ****
  	 pr_who doesn't exist on:
  	 linux 2.[01]
  	 */
! #if defined (HAVE_PRSTATUS_T_PR_WHO)
        elf_tdata (abfd)->core_lwpid = prstat.pr_who;
  #endif
      }
! #endif /* __sparcv9 */
    else
      {
        /* Fail - we don't know how to handle any other
--- 5340,5350 ----
  	 pr_who doesn't exist on:
  	 linux 2.[01]
  	 */
! #if defined (HAVE_PRSTATUS32_T_PR_WHO)
        elf_tdata (abfd)->core_lwpid = prstat.pr_who;
  #endif
      }
! #endif /* HAVE_PRSTATUS32_T */
    else
      {
        /* Fail - we don't know how to handle any other
*************** elfcore_grok_prstatus (abfd, note)
*** 5363,5380 ****
    if (sect == NULL)
      return false;
  
!   if (note->descsz == sizeof (prstatus_t))
!     {
!       sect->_raw_size = raw_size;
!       sect->filepos = note->descpos + offsetof (prstatus_t, pr_reg);
!     }
! #if defined (__sparcv9)
!   else if (note->descsz == sizeof (prstatus32_t))
!     {
!       sect->_raw_size = raw_size;
!       sect->filepos = note->descpos + offsetof (prstatus32_t, pr_reg);
!     }
! #endif
  
    sect->flags = SEC_HAS_CONTENTS;
    sect->alignment_power = 2;
--- 5364,5371 ----
    if (sect == NULL)
      return false;
  
!   sect->_raw_size = raw_size;
!   sect->filepos = note->descpos + offset;
  
    sect->flags = SEC_HAS_CONTENTS;
    sect->alignment_power = 2;
*************** elfcore_grok_prxfpreg (abfd, note)
*** 5454,5467 ****
  
  #if defined (HAVE_PRPSINFO_T)
  typedef prpsinfo_t   elfcore_psinfo_t;
! #if defined (__sparcv9)	/* Sparc64 cross Sparc32 */
  typedef prpsinfo32_t elfcore_psinfo32_t;
  #endif
  #endif
  
  #if defined (HAVE_PSINFO_T)
  typedef psinfo_t   elfcore_psinfo_t;
! #if defined (__sparcv9)	/* Sparc64 cross Sparc32 */
  typedef psinfo32_t elfcore_psinfo32_t;
  #endif
  #endif
--- 5445,5458 ----
  
  #if defined (HAVE_PRPSINFO_T)
  typedef prpsinfo_t   elfcore_psinfo_t;
! #if defined (HAVE_PRPSINFO32_T)		/* Sparc64 cross Sparc32 */
  typedef prpsinfo32_t elfcore_psinfo32_t;
  #endif
  #endif
  
  #if defined (HAVE_PSINFO_T)
  typedef psinfo_t   elfcore_psinfo_t;
! #if defined (HAVE_PSINFO32_T)		/* Sparc64 cross Sparc32 */
  typedef psinfo32_t elfcore_psinfo32_t;
  #endif
  #endif
*************** elfcore_grok_psinfo (abfd, note)
*** 5507,5513 ****
      {
        elfcore_psinfo_t psinfo;
  
!       memcpy (&psinfo, note->descdata, note->descsz);
  
        elf_tdata (abfd)->core_program
  	= elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
--- 5498,5504 ----
      {
        elfcore_psinfo_t psinfo;
  
!       memcpy (&psinfo, note->descdata, sizeof (psinfo));
  
        elf_tdata (abfd)->core_program
  	= elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
*************** elfcore_grok_psinfo (abfd, note)
*** 5515,5527 ****
        elf_tdata (abfd)->core_command
  	= elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
      }
! #if defined (__sparcv9)
    else if (note->descsz == sizeof (elfcore_psinfo32_t))
      {
        /* 64-bit host, 32-bit corefile */
        elfcore_psinfo32_t psinfo;
  
!       memcpy (&psinfo, note->descdata, note->descsz);
  
        elf_tdata (abfd)->core_program
  	= elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
--- 5506,5518 ----
        elf_tdata (abfd)->core_command
  	= elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
      }
! #if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
    else if (note->descsz == sizeof (elfcore_psinfo32_t))
      {
        /* 64-bit host, 32-bit corefile */
        elfcore_psinfo32_t psinfo;
  
!       memcpy (&psinfo, note->descdata, sizeof (psinfo));
  
        elf_tdata (abfd)->core_program
  	= elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
*************** elfcore_grok_pstatus (abfd, note)
*** 5569,5575 ****
  
        elf_tdata (abfd)->core_pid = pstat.pr_pid;
      }
! #if defined (__sparcv9)
    else if (note->descsz == sizeof (pstatus32_t))
      {
        /* 64-bit host, 32-bit corefile */
--- 5560,5566 ----
  
        elf_tdata (abfd)->core_pid = pstat.pr_pid;
      }
! #if defined (HAVE_PSTATUS32_T)
    else if (note->descsz == sizeof (pstatus32_t))
      {
        /* 64-bit host, 32-bit corefile */

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