and _bfd_elfcore_strndup.
(struct elf_backend_data): Add elf_backend_grok_prstatus
and elf_backend_grok_psinfo.
* elf.c (_bfd_elfcore_make_pseudosection): New function.
(elfcore_grok_prstatus): Use it.
(elfcore_make_note_pseudosection): Likewise.
(elfcore_strndup): Rename to...
(_bfd_elfcore_strndup): Here, and make global.
(elfcore_grok_psinfo): Use _bfd_elfcore_strndup.
(elfcore_grok_note): Call elf_backend_grok_prstatus
and elf_backend_grok_psinfo if available.
* elf32-mips.c (_bfd_elf32_mips_grok_prstatus): New function.
(_bfd_elf32_mips_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Define.
* elfxx-target.h (elf_backend_grok_prstatus): Default to NULL.
(elf_backend_grok_psinfo): Likewise.
(elfNN_bed): Include elf_backend_grok_prstatus and
elf_backend_grok_psinfo.
+2001-06-29 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf-bfd.h: Add prototypes for _bfd_elfcore_make_pseudosection
+ and _bfd_elfcore_strndup.
+ (struct elf_backend_data): Add elf_backend_grok_prstatus
+ and elf_backend_grok_psinfo.
+ * elf.c (_bfd_elfcore_make_pseudosection): New function.
+ (elfcore_grok_prstatus): Use it.
+ (elfcore_make_note_pseudosection): Likewise.
+ (elfcore_strndup): Rename to...
+ (_bfd_elfcore_strndup): Here, and make global.
+ (elfcore_grok_psinfo): Use _bfd_elfcore_strndup.
+ (elfcore_grok_note): Call elf_backend_grok_prstatus
+ and elf_backend_grok_psinfo if available.
+ * elf32-mips.c (_bfd_elf32_mips_grok_prstatus): New function.
+ (_bfd_elf32_mips_grok_psinfo): New function.
+ (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Define.
+ * elfxx-target.h (elf_backend_grok_prstatus): Default to NULL.
+ (elf_backend_grok_psinfo): Likewise.
+ (elfNN_bed): Include elf_backend_grok_prstatus and
+ elf_backend_grok_psinfo.
+
2001-06-29 H.J. Lu <hjl@gnu.org>
* elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Check if
2001-06-20 Catherine Moore <clm@redhat.com>
- * elf-bfd.h (struct elf_backend_data):
- elf_backend_emit_relocs: New field: Function for emitting
- relocs.
- elf_backend_count_relocs: New field: Function for determining
- the number of relocs to be emitted.
- * elfxx-target.h: Provide default (NULL) values for
- elf_backend_emit_relocs and elf_backend_count_relocs.
- * elflink.h (elf_link_size_reloc_section): Make the hash table
- big enough to hold the relocs counted by either reloc_count or
- o->reloc_count.
- (elf_bfd_final_link) emit_relocs: New boolean, set if relocs
- should be emitted, either because of a command line option
- stored in the info structure or because the target provides a
- special reloc emitting function.
- If the target provides a reloc counting function use it,
- unless performing a relocatable link or emitting all relocs.
- Also set the SEC_RELOC flag on any output section which will
- contain relocs.
- (elf_link_input_bfd): emit_relocs: New boolean, set if relocs
- should be emitted, either because of a command line option
- stored in the info structure or because the target provides a
- special reloc emitting function.
- If the target provides a reloc emitting function, use it,
- unless performing a relocatable link or emitting all relocs.
+ * elf-bfd.h (struct elf_backend_data):
+ elf_backend_emit_relocs: New field: Function for emitting
+ relocs.
+ elf_backend_count_relocs: New field: Function for determining
+ the number of relocs to be emitted.
+ * elfxx-target.h: Provide default (NULL) values for
+ elf_backend_emit_relocs and elf_backend_count_relocs.
+ * elflink.h (elf_link_size_reloc_section): Make the hash table
+ big enough to hold the relocs counted by either reloc_count or
+ o->reloc_count.
+ (elf_bfd_final_link) emit_relocs: New boolean, set if relocs
+ should be emitted, either because of a command line option
+ stored in the info structure or because the target provides a
+ special reloc emitting function.
+ If the target provides a reloc counting function use it,
+ unless performing a relocatable link or emitting all relocs.
+ Also set the SEC_RELOC flag on any output section which will
+ contain relocs.
+ (elf_link_input_bfd): emit_relocs: New boolean, set if relocs
+ should be emitted, either because of a command line option
+ stored in the info structure or because the target provides a
+ special reloc emitting function.
+ If the target provides a reloc emitting function, use it,
+ unless performing a relocatable link or emitting all relocs.
2001-06-20 H.J. Lu <hjl@gnu.org>
function. Move flagword result into parameter list. Remove
comment about setting bfd_error_handler to intercept failure
results.
- * coffgen.c (make_a_section_from_file): Examine result of
+ * coffgen.c (make_a_section_from_file): Examine result of
calling bfd_coff_styp_to_sec_flags and pass a failure back to
caller.
- * ecoff.h (styp_flags_to_sec_flags): Change to a boolean
+ * ecoff.h (styp_flags_to_sec_flags): Change to a boolean
function. Move flagword result into parameter list.
- * libcoff.h: Regenerate.
- * libecoff.h: Regenerate.
+ * libcoff.h: Regenerate.
+ * libecoff.h: Regenerate.
2001-06-13 Nick Clifton <nickc@cambridge.redhat.com>
2001-06-12 Catherine Moore <clm@redhat.com>
- * elflink.h (elf_gc_propagate_vtable_entries): Replace FILE_ALIGN
- with the file_align entry from elf_backend_data.
- (elf_gc_smash_unused_vtentry_relocs): Likewise.
- (elf_gc_record_vtentry): Likewise.
+ * elflink.h (elf_gc_propagate_vtable_entries): Replace FILE_ALIGN
+ with the file_align entry from elf_backend_data.
+ (elf_gc_smash_unused_vtentry_relocs): Likewise.
+ (elf_gc_record_vtentry): Likewise.
2001-06-10 Alan Modra <amodra@bigpond.net.au>
2001-06-06 Christian Groessler <cpg@aladdin.de>
- * coff-z8k.c: Fix formatting.
+ * coff-z8k.c: Fix formatting.
Fix howtos: howto->size was always 1.
2001-06-05 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
2001-05-24 Tom Rix <trix@redhat.com>
- * Makefile.am coff-pmac bfd now defined in coff-rs6000.c
+ * Makefile.am coff-pmac bfd now defined in coff-rs6000.c
xcoff-target.h not used to define rs6000 or ppc bfd.
* Makefile.in same
* elf-bfd.h (NUM_SHDR_ENTRIES): New macro: compute the number
of entries in a structured section.
- * elf.c: Use new macro.
- * elf32-i386.c: Use new macro.
- * elf32-mips.c: Use new macro.
- * elf64-alpha.c: Use new macro.
- * elf64-sparc.c: Use new macro.
- * elfcode.h: Use new macro.
- * elflink.h: Use new macro.
+ * elf.c: Use new macro.
+ * elf32-i386.c: Use new macro.
+ * elf32-mips.c: Use new macro.
+ * elf64-alpha.c: Use new macro.
+ * elf64-sparc.c: Use new macro.
+ * elfcode.h: Use new macro.
+ * elflink.h: Use new macro.
2001-05-23 Nick Clifton <nickc@cambridge.redhat.com>
2001-05-04 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-arm.h (elf32_arm_final_link_relocate): Set
- EF_ARM_HASENTRY if the start address is set.
+ EF_ARM_HASENTRY if the start address is set.
2001-05-03 Nick Clifton <nickc@cambridge.redhat.com>
2001-05-02 Johan Rydberg <jrydberg@opencores.org>
- * elf32-openrisc.c (openrisc_elf_howto_table): Do not complain
+ * elf32-openrisc.c (openrisc_elf_howto_table): Do not complain
about overflow in R_OPENRISC_LO_16_IN_INSN and
R_OPENRISC_HI_16_IN_INSN.Index: bfd/elf32-openrisc.c
2001-03-23 Nick Clifton <nickc@redhat.com>
* Makefile.am (BUILD_CFILES): New variable: List of C source
- files created in build directory.
- (BUILD_HFILES): New variable: List of header files created in
- build directory.
- (POTFILES): Delete.
- (po/POTFILES.in): Replace rule with empty entry.
- (po/SRC-POTFILES.in): New rule: Create a list of source files
- in the source directory.
- (po/BLD-POTFILES.in): New rule: Create a list of source files
- in the build directory.
- (MOSTLYCLEAN): Do not delete source files created in build
- directory.
- * Makefile.in: Regenerate.
- * configure.in: Insert SRC-POTFILES.in and BLD-POTFILES.in
- into po/Makefile.
- * configure: Regenerate.
-
- * po/Make-in: Replace occurrences of POTFILES with SRC-POTFILES
- and BLD_POTFILES.
+ files created in build directory.
+ (BUILD_HFILES): New variable: List of header files created in
+ build directory.
+ (POTFILES): Delete.
+ (po/POTFILES.in): Replace rule with empty entry.
+ (po/SRC-POTFILES.in): New rule: Create a list of source files
+ in the source directory.
+ (po/BLD-POTFILES.in): New rule: Create a list of source files
+ in the build directory.
+ (MOSTLYCLEAN): Do not delete source files created in build
+ directory.
+ * Makefile.in: Regenerate.
+ * configure.in: Insert SRC-POTFILES.in and BLD-POTFILES.in
+ into po/Makefile.
+ * configure: Regenerate.
+
+ * po/Make-in: Replace occurrences of POTFILES with SRC-POTFILES
+ and BLD_POTFILES.
Add .. to the search path when building bfd.pot.
- Delete POTFILES when performing distclean.
- Add comment describing why distclean is broken in maintainer mode.
+ Delete POTFILES when performing distclean.
+ Add comment describing why distclean is broken in maintainer mode.
* po/POTFILES.in: Delete.
* po/SRC-POTFILES.in: New file.
* po/BLD-POTFILES.in: New file.
- * po/bfd.pot: Regenerate.
+ * po/bfd.pot: Regenerate.
2001-03-22 Hans-Peter Nilsson <hp@axis.com>
of offset in BLX(1) instruction.
* coff-arm.c (coff_arm_relocate_section): Clear bit zero of
offset in BLX(1) instruction.
- Fix formatting.
+ Fix formatting.
2001-03-06 Nick Clifton <nickc@redhat.com>
* coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Tidy
up, replacing multiple if statements with a switch.
- (handle_COMDAT): New function.
+ (handle_COMDAT): New function.
2001-02-26 H.J. Lu <hjl@gnu.org>
unsigned int (*elf_backend_count_relocs)
PARAMS ((asection *, Elf_Internal_Rela *));
+ /* This function, if defined, is called when an NT_PRSTATUS note is found
+ in a core file. */
+ boolean (*elf_backend_grok_prstatus) PARAMS ((bfd *, Elf_Internal_Note *));
+
+ /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
+ note is found in a core file. */
+ boolean (*elf_backend_grok_psinfo) PARAMS ((bfd *, Elf_Internal_Note *));
+
/* The swapping table to use when dealing with ECOFF information.
Used for the MIPS ELF .mdebug section. */
const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
unsigned long _bfd_elf_link_renumber_dynsyms PARAMS ((bfd *,
struct bfd_link_info *));
+boolean _bfd_elfcore_make_pseudosection PARAMS ((bfd *, char *, int, int));
+char *_bfd_elfcore_strndup PARAMS ((bfd *, char *, int));
+
elf_linker_section_t *_bfd_elf_create_linker_section
PARAMS ((bfd *abfd,
struct bfd_link_info *info,
return true;
}
+/* Create a pseudosection containing SIZE bytes at FILEPOS. This
+ actually creates up to two pseudosections:
+ - For the single-threaded case, a section named NAME, unless
+ such a section already exists.
+ - For the multi-threaded case, a section named "NAME/PID", where
+ PID is elfcore_make_pid (abfd).
+ Both pseudosections have identical contents. */
+boolean
+_bfd_elfcore_make_pseudosection (abfd, name, size, filepos)
+ bfd *abfd;
+ char *name;
+ int size;
+ int filepos;
+{
+ char buf[100];
+ char *threaded_name;
+ asection *sect;
+
+ /* Build the section name. */
+
+ sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
+ threaded_name = bfd_alloc (abfd, strlen (buf) + 1);
+ if (threaded_name == NULL)
+ return false;
+ strcpy (threaded_name, buf);
+
+ sect = bfd_make_section (abfd, threaded_name);
+ if (sect == NULL)
+ return false;
+ sect->_raw_size = size;
+ sect->filepos = filepos;
+ sect->flags = SEC_HAS_CONTENTS;
+ sect->alignment_power = 2;
+
+ if (! elfcore_maybe_make_sect (abfd, name, sect))
+ return false;
+
+ return true;
+}
+
/* prstatus_t exists on:
solaris 2.5+
linux 2.[01] + glibc
bfd *abfd;
Elf_Internal_Note *note;
{
- char buf[100];
- char *name;
- asection *sect;
int raw_size;
int offset;
return true;
}
- /* Make a ".reg/999" section. */
-
- sprintf (buf, ".reg/%d", elfcore_make_pid (abfd));
- name = bfd_alloc (abfd, strlen (buf) + 1);
- if (name == NULL)
- return false;
- strcpy (name, buf);
-
- sect = bfd_make_section (abfd, name);
- if (sect == NULL)
- return false;
-
- sect->_raw_size = raw_size;
- sect->filepos = note->descpos + offset;
-
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- if (! elfcore_maybe_make_sect (abfd, ".reg", sect))
+ /* Make a ".reg/999" section and a ".reg" section. */
+ if (! _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset));
return false;
return true;
}
#endif /* defined (HAVE_PRSTATUS_T) */
-/* Create a pseudosection containing the exact contents of NOTE. This
- actually creates up to two pseudosections:
- - For the single-threaded case, a section named NAME, unless
- such a section already exists.
- - For the multi-threaded case, a section named "NAME/PID", where
- PID is elfcore_make_pid (abfd).
- Both pseudosections have identical contents: the contents of NOTE. */
-
+/* Create a pseudosection containing the exact contents of NOTE. */
static boolean
elfcore_make_note_pseudosection (abfd, name, note)
bfd *abfd;
char *name;
Elf_Internal_Note *note;
{
- char buf[100];
- char *threaded_name;
- asection *sect;
-
- /* Build the section name. */
-
- sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
- threaded_name = bfd_alloc (abfd, strlen (buf) + 1);
- if (threaded_name == NULL)
- return false;
- strcpy (threaded_name, buf);
-
- sect = bfd_make_section (abfd, threaded_name);
- if (sect == NULL)
- return false;
- sect->_raw_size = note->descsz;
- sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- if (! elfcore_maybe_make_sect (abfd, name, sect))
- return false;
-
- return true;
+ return _bfd_elfcore_make_pseudosection (abfd, name, note->descsz, note->descpos);
}
/* There isn't a consistent prfpregset_t across platforms,
#endif
#endif
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-
/* return a malloc'ed copy of a string at START which is at
most MAX bytes long, possibly without a terminating '\0'.
the copy will always have a terminating '\0'. */
-static char*
-elfcore_strndup (abfd, start, max)
+char*
+_bfd_elfcore_strndup (abfd, start, max)
bfd *abfd;
char *start;
int max;
return dup;
}
+#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
+
static boolean
elfcore_grok_psinfo (abfd, note)
bfd *abfd;
memcpy (&psinfo, note->descdata, sizeof (psinfo));
elf_tdata (abfd)->core_program
- = elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
+ = _bfd_elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
elf_tdata (abfd)->core_command
- = elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
+ = _bfd_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))
memcpy (&psinfo, note->descdata, sizeof (psinfo));
elf_tdata (abfd)->core_program
- = elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
+ = _bfd_elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
elf_tdata (abfd)->core_command
- = elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
+ = _bfd_elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
}
#endif
bfd *abfd;
Elf_Internal_Note *note;
{
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
switch (note->type)
{
default:
return true;
-#if defined (HAVE_PRSTATUS_T)
case NT_PRSTATUS:
+ if (bed->elf_backend_grok_prstatus)
+ if ((*bed->elf_backend_grok_prstatus) (abfd, note))
+ return true;
+#if defined (HAVE_PRSTATUS_T)
return elfcore_grok_prstatus (abfd, note);
+#else
+ return true;
#endif
#if defined (HAVE_PSTATUS_T)
else
return true;
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
case NT_PRPSINFO:
case NT_PSINFO:
+ if (bed->elf_backend_grok_psinfo)
+ if ((*bed->elf_backend_grok_psinfo) (abfd, note))
+ return true;
+#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
return elfcore_grok_psinfo (abfd, note);
+#else
+ return true;
#endif
}
}
return true;
}
\f
+/* Support for core dump NOTE sections */
+static boolean
+_bfd_elf32_mips_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 256: /* Linux/MIPS */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 180;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ if (! _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset))
+ return false;
+
+ return true;
+}
+
+static boolean _bfd_elf32_mips_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 128: /* Linux/MIPS elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+\f
/* This is almost identical to bfd_generic_get_... except that some
MIPS relocations need to be handled specially. Sigh. */
_bfd_mips_elf_copy_indirect_symbol
#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
+#define elf_backend_grok_prstatus _bfd_elf32_mips_grok_prstatus
+#define elf_backend_grok_psinfo _bfd_elf32_mips_grok_psinfo
#define bfd_elf32_bfd_is_local_label_name \
mips_elf_is_local_label_name
#ifndef elf_backend_count_relocs
#define elf_backend_count_relocs NULL
#endif
+#ifndef elf_backend_grok_prstatus
+#define elf_backend_grok_prstatus NULL
+#endif
+#ifndef elf_backend_grok_psinfo
+#define elf_backend_grok_psinfo NULL
+#endif
/* Previously, backends could only use SHT_REL or SHT_RELA relocation
sections, but not both. They defined USE_REL to indicate SHT_REL
elf_backend_hide_symbol,
elf_backend_emit_relocs,
elf_backend_count_relocs,
+ elf_backend_grok_prstatus,
+ elf_backend_grok_psinfo,
elf_backend_ecoff_debug_swap,
ELF_MACHINE_ALT1,
ELF_MACHINE_ALT2,