+2015-04-01 H.J. Lu <hjl.tools@gmail.com>
+
+ * Makefile.am (x86_64_SRCS): Add x32_corenote.c.
+ * linux-core-note.c (PR_REG): New.
+ (PRPSINFO_UID_T): Likewise.
+ (ALIGN_PRPSINFO_UID_T): Likewise.
+ (TYPE_PRPSINFO_UID_T): Likewise.
+ (PRPSINFO_GID_T): Likewise.
+ (ALIGN_PRPSINFO_GID_T): Likewise.
+ (TYPE_PRPSINFO_GID_T): Likewise.
+ (pr_reg): Replace ULONG with PR_REG.
+ (pr_uid): Replace UID_T with PRPSINFO_UID_T.
+ (uid): Likewise.
+ (pr_gid): Replace GID_T with PRPSINFO_GID_T.
+ (gid): Likewise.
+ * x32_corenote.c: New file.
+ * x86_64_corenote.c (BITS): New. Support x32.
+ (BACKEND): Support x32.
+ (ULONG): Likewise.
+ (ALIGN_ULONG): Likewise.
+ (TYPE_ULONG): Likewise.
+ (PRPSINFO_UID_T): New.
+ (ALIGN_PRPSINFO_UID_T): Likewise.
+ (TYPE_PRPSINFO_UID_T): Likewise.
+ (PRPSINFO_GID_T): Likewise.
+ (ALIGN_PRPSINFO_GID_T): Likewise.
+ (TYPE_PRPSINFO_GID_T): Likewise.
+ (PR_REG): Likewise.
+ (ALIGN_PR_REG): Likewise.
+ * x86_64_init.c (x32_core_note): New.
+ (x86_64_init): Set eh->core_note to x32_core_note for x32.
+
2015-03-23 Mark Wielaard <mjw@redhat.com>
* aarch64_symbol.c (aarch64_check_special_symbol): Accept
x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \
x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c \
- x86_64_initreg.c
+ x86_64_initreg.c x32_corenote.c
cpu_x86_64 = ../libcpu/libcpu_x86_64.a
libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
/* Common core note type descriptions for Linux.
Copyright (C) 2007-2010 Red Hat, Inc.
+ Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
#define INT int32_t
#define ALIGN_INT 4
#define TYPE_INT ELF_T_SWORD
+#ifndef PR_REG
+# define PR_REG ULONG
+#endif
#ifndef ALIGN_PR_REG
# define ALIGN_PR_REG ALIGN_ULONG
#endif
+#ifndef PRPSINFO_UID_T
+# define PRPSINFO_UID_T UID_T
+# define ALIGN_PRPSINFO_UID_T ALIGN_UID_T
+# define TYPE_PRPSINFO_UID_T TYPE_UID_T
+#endif
+#ifndef PRPSINFO_GID_T
+# define PRPSINFO_GID_T GID_T
+# define ALIGN_PRPSINFO_GID_T ALIGN_GID_T
+# define TYPE_PRPSINFO_GID_T TYPE_GID_T
+#endif
#define FIELD(type, name) type name __attribute__ ((aligned (ALIGN_##type)))
struct EBLHOOK(timeval) pr_cstime;
struct
{
- FIELD (ULONG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (ULONG)]);
+ FIELD (PR_REG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (PR_REG)]);
}
#ifdef ALIGN_PR_REG
__attribute__ ((aligned (ALIGN_PR_REG)))
FIELD (CHAR, pr_zomb);
FIELD (CHAR, pr_nice);
FIELD (ULONG, pr_flag);
- FIELD (UID_T, pr_uid);
- FIELD (GID_T, pr_gid);
+ FIELD (PRPSINFO_UID_T, pr_uid);
+ FIELD (PRPSINFO_GID_T, pr_gid);
FIELD (PID_T, pr_pid);
FIELD (PID_T, pr_ppid);
FIELD (PID_T, pr_pgrp);
FIELD (state, CHAR, zomb, 'd'),
FIELD (state, CHAR, nice, 'd'),
FIELD (state, ULONG, flag, 'x'),
- FIELD (identity, UID_T, uid, 'd'),
- FIELD (identity, GID_T, gid, 'd'),
+ FIELD (identity, PRPSINFO_UID_T, uid, 'd'),
+ FIELD (identity, PRPSINFO_GID_T, gid, 'd'),
FIELD (identity, PID_T, pid, 'd'),
FIELD (identity, PID_T, ppid, 'd'),
FIELD (identity, PID_T, pgrp, 'd'),
--- /dev/null
+#define BITS 32
+#include "x86_64_corenote.c"
/* x86-64 specific core note handling.
Copyright (C) 2005, 2007, 2008 Red Hat, Inc.
+ Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
#include <stdio.h>
#include <sys/time.h>
-#define BACKEND x86_64_
+#ifndef BITS
+# define BITS 64
+# define BACKEND x86_64_
+#else
+# define BITS 32
+# define BACKEND x32_
+#endif
#include "libebl_CPU.h"
};
#define PRSTATUS_REGS_SIZE (27 * 8)
-#define ULONG uint64_t
+#if BITS == 32
+# define ULONG uint32_t
+# define ALIGN_ULONG 4
+# define TYPE_ULONG ELF_T_WORD
+# define PRPSINFO_UID_T uint16_t
+# define ALIGN_PRPSINFO_UID_T 2
+# define TYPE_PRPSINFO_UID_T ELF_T_HALF
+# define PRPSINFO_GID_T uint16_t
+# define ALIGN_PRPSINFO_GID_T 2
+# define TYPE_PRPSINFO_GID_T ELF_T_HALF
+#else
+# define ULONG uint64_t
+# define ALIGN_ULONG 8
+# define TYPE_ULONG ELF_T_XWORD
+# define PRPSINFO_UID_T uint32_t
+# define ALIGN_PRPSINFO_UID_T 4
+# define TYPE_PRPSINFO_UID_T TYPE_UID_T
+# define PRPSINFO_GID_T uint32_t
+# define ALIGN_PRPSINFO_GID_T 4
+# define TYPE_PRPSINFO_GID_T TYPE_GID_T
+#endif
+#define PR_REG uint64_t
+#define ALIGN_PR_REG 8
#define PID_T int32_t
#define UID_T uint32_t
#define GID_T uint32_t
-#define ALIGN_ULONG 8
#define ALIGN_PID_T 4
#define ALIGN_UID_T 4
#define ALIGN_GID_T 4
-#define TYPE_ULONG ELF_T_XWORD
#define TYPE_PID_T ELF_T_SWORD
#define TYPE_UID_T ELF_T_SWORD
#define TYPE_GID_T ELF_T_SWORD
/* Initialization of x86-64 specific backend library.
Copyright (C) 2002-2009, 2013 Red Hat, Inc.
+ Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
/* This defines the common reloc hooks based on x86_64_reloc.def. */
#include "common-reloc.c"
+extern __typeof (EBLHOOK (core_note)) x32_core_note attribute_hidden;
+
const char *
x86_64_init (elf, machine, eh, ehlen)
Elf *elf __attribute__ ((unused));
eh->name = "AMD x86-64";
x86_64_init_reloc (eh);
HOOK (eh, reloc_simple_type);
- HOOK (eh, core_note);
+ if (eh->class == ELFCLASS32)
+ eh->core_note = x32_core_note;
+ else
+ HOOK (eh, core_note);
HOOK (eh, return_value_location);
HOOK (eh, register_info);
HOOK (eh, syscall_abi);