diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 202a8db..d846f63 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,29 @@ +2012-10-30 Yao Qi + H.J. Lu + + * configure.in: Set CORE_HEADER to hosts/x86-64linux.h for + 'i[3-7]86-*-linux-*' if x86_64-*linux is enabled. + * configure: Regenerated. + + * elf64-x86-64.c (elf_x86_64_write_core_note): Replace type + 'prpsinfo_t' and 'prstatus_t' with 'prpsinfo64_t' and + 'prstatus64_t' respectively. + + * hosts/x86-64linux.h (a8_uint64_t): New. + (user_regsx32_struct): Renamed to ... + (user_regs64_struct): This. Replace uint64_t with a8_uint64_t. + (elf_gregx32_t): Renamed to ... + (elf_greg64_t): This. Replace uint64_t with a8_uint64_t. + (ELF_NGREGX32): Removed. + (ELF_NGREG64): New. + (elf_gregx32_t): Removed. + (elf_greg64_t): New. + (struct prstatus64_timeval): New. + (elf_prstatusx32): Replace elf_gregsetx32_t with elf_gregset64_t. + (elf_prstatus64): New. + (elf_prpsinfo64): New. + (prstatus64_t, prpsinfo64_t): New typedef. + 2012-10-29 Sean Keys * elf32-xgate.c(elf_xgate_howto_table): Fix src and dest mask for diff --git a/bfd/configure b/bfd/configure index fdf5356..427e5c1 100755 --- a/bfd/configure +++ b/bfd/configure @@ -13927,6 +13927,10 @@ if test "${target}" = "${host}"; then i[3-7]86-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386linux.h"' + case "$enable_targets" in + *x86_64-*linux*) + CORE_HEADER='"hosts/x86-64linux.h"' + esac ;; i[3-7]86-*-isc*) COREFILE=trad-core.lo ;; i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;; diff --git a/bfd/configure.in b/bfd/configure.in index 530bbcb..9a31c04 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -331,6 +331,10 @@ changequote(,)dnl changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386linux.h"' + case "$enable_targets" in + *x86_64-*linux*) + CORE_HEADER='"hosts/x86-64linux.h"' + esac ;; changequote(,)dnl i[3-7]86-*-isc*) COREFILE=trad-core.lo ;; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index ca9a45c..d58384f 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -449,7 +449,7 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, } else { - prpsinfo_t data; + prpsinfo64_t data; memset (&data, 0, sizeof (data)); strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); @@ -490,7 +490,7 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, } else { - prstatus_t prstat; + prstatus64_t prstat; memset (&prstat, 0, sizeof (prstat)); prstat.pr_pid = pid; prstat.pr_cursig = cursig; diff --git a/bfd/hosts/x86-64linux.h b/bfd/hosts/x86-64linux.h index 4ffc3f2..78be09a 100644 --- a/bfd/hosts/x86-64linux.h +++ b/bfd/hosts/x86-64linux.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006, 2011 +/* Copyright (C) 2006, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -40,6 +40,9 @@ typedef unsigned int uint32_t; typedef unsigned long long int uint64_t; #endif +/* Unsigned 64-bit integer aligned to 8 bytes. */ +typedef uint64_t __attribute__ ((__aligned__ (8))) a8_uint64_t; + #undef HAVE_PRPSINFO32_T #define HAVE_PRPSINFO32_T #undef HAVE_PRPSINFO32_T_PR_PID @@ -71,40 +74,40 @@ struct user_regs32_struct int32_t xss; }; -struct user_regsx32_struct +struct user_regs64_struct { - uint64_t r15; - uint64_t r14; - uint64_t r13; - uint64_t r12; - uint64_t rbp; - uint64_t rbx; - uint64_t r11; - uint64_t r10; - uint64_t r9; - uint64_t r8; - uint64_t rax; - uint64_t rcx; - uint64_t rdx; - uint64_t rsi; - uint64_t rdi; - uint64_t orig_rax; - uint64_t rip; - uint64_t cs; - uint64_t eflags; - uint64_t rsp; - uint64_t ss; - uint64_t fs_base; - uint64_t gs_base; - uint64_t ds; - uint64_t es; - uint64_t fs; - uint64_t gs; + a8_uint64_t r15; + a8_uint64_t r14; + a8_uint64_t r13; + a8_uint64_t r12; + a8_uint64_t rbp; + a8_uint64_t rbx; + a8_uint64_t r11; + a8_uint64_t r10; + a8_uint64_t r9; + a8_uint64_t r8; + a8_uint64_t rax; + a8_uint64_t rcx; + a8_uint64_t rdx; + a8_uint64_t rsi; + a8_uint64_t rdi; + a8_uint64_t orig_rax; + a8_uint64_t rip; + a8_uint64_t cs; + a8_uint64_t eflags; + a8_uint64_t rsp; + a8_uint64_t ss; + a8_uint64_t fs_base; + a8_uint64_t gs_base; + a8_uint64_t ds; + a8_uint64_t es; + a8_uint64_t fs; + a8_uint64_t gs; }; /* Type for a general-purpose register. */ typedef uint32_t elf_greg32_t; -typedef uint64_t elf_gregx32_t; +typedef a8_uint64_t elf_greg64_t; /* And the whole bunch of them. We could have used `struct user_regs_struct' directly in the typedef, but tradition says that @@ -112,8 +115,8 @@ typedef uint64_t elf_gregx32_t; semantics, so leave it that way. */ #define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t)) typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32]; -#define ELF_NGREGX32 (sizeof (struct user_regsx32_struct) / sizeof(elf_gregx32_t)) -typedef elf_gregx32_t elf_gregsetx32_t[ELF_NGREGX32]; +#define ELF_NGREG64 (sizeof (struct user_regs64_struct) / sizeof(elf_greg64_t)) +typedef elf_greg64_t elf_gregset64_t[ELF_NGREG64]; /* Definitions to generate Intel SVR4-like core files. These mostly have the same names as the SVR4 types with "elf_" tacked on the @@ -128,6 +131,12 @@ struct prstatus32_timeval int tv_usec; }; +struct prstatus64_timeval + { + a8_uint64_t tv_sec; + a8_uint64_t tv_usec; + }; + struct elf_prstatus32 { struct elf_siginfo pr_info; /* Info associated with signal. */ @@ -160,7 +169,25 @@ struct elf_prstatusx32 struct prstatus32_timeval pr_stime; /* System time. */ struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ - elf_gregsetx32_t pr_reg; /* GP registers. */ + elf_gregset64_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + +struct elf_prstatus64 + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + a8_uint64_t pr_sigpend; /* Set of pending signals. */ + a8_uint64_t pr_sighold; /* Set of held signals. */ + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct prstatus64_timeval pr_utime; /* User time. */ + struct prstatus64_timeval pr_stime; /* System time. */ + struct prstatus64_timeval pr_cutime; /* Cumulative user time. */ + struct prstatus64_timeval pr_cstime; /* Cumulative system time. */ + elf_gregset64_t pr_reg; /* GP registers. */ int pr_fpvalid; /* True if math copro being used. */ }; @@ -179,6 +206,20 @@ struct elf_prpsinfo32 char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ }; +struct elf_prpsinfo64 + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + a8_uint64_t pr_flag; /* Flags. */ + unsigned int pr_uid; + unsigned int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; /* The rest of this file provides the types for emulation of the Solaris interfaces that should be implemented by @@ -187,4 +228,6 @@ struct elf_prpsinfo32 /* Process status and info. In the end we do provide typedefs for them. */ typedef struct elf_prstatus32 prstatus32_t; typedef struct elf_prstatusx32 prstatusx32_t; +typedef struct elf_prstatus64 prstatus64_t; typedef struct elf_prpsinfo32 prpsinfo32_t; +typedef struct elf_prpsinfo64 prpsinfo64_t;