* elfcore.h (elf_core_file_p): Call bfd_section_from_phdr directly

instead of _bfd_elfcore_section_from_phdr.
	* elf-bfd.h (_bfd_elfcore_section_from_phdr): Remove.
	* elf.c (_bfd_elfcore_section_from_phdr): Remove.
	(_bfd_elfcore_make_pseudosection): Expedite tail-call.
	(elfcore_grok_prstatus): Likewise.
	(elfcore_grok_lwpstatus): Likewise.
	(bfd_get_elf_phdr_upper_bound): Likewise.
	(elfcore_make_note_pseudosection): Formatting.
	(_bfd_elfcore_strndup): Formatting.
	* elf32-mips.c (mips_elf_sym_is_global): Formatting.
	(_bfd_elf32_mips_grok_prstatus): Expedite tail-call.
This commit is contained in:
Alan Modra
2001-06-30 04:05:13 +00:00
parent bb0082d686
commit 936e320bf4
5 changed files with 38 additions and 49 deletions

View File

@@ -1,3 +1,18 @@
2001-06-30 Alan Modra <amodra@bigpond.net.au>
* elfcore.h (elf_core_file_p): Call bfd_section_from_phdr directly
instead of _bfd_elfcore_section_from_phdr.
* elf-bfd.h (_bfd_elfcore_section_from_phdr): Remove.
* elf.c (_bfd_elfcore_section_from_phdr): Remove.
(_bfd_elfcore_make_pseudosection): Expedite tail-call.
(elfcore_grok_prstatus): Likewise.
(elfcore_grok_lwpstatus): Likewise.
(bfd_get_elf_phdr_upper_bound): Likewise.
(elfcore_make_note_pseudosection): Formatting.
(_bfd_elfcore_strndup): Formatting.
* elf32-mips.c (mips_elf_sym_is_global): Formatting.
(_bfd_elf32_mips_grok_prstatus): Expedite tail-call.
2001-06-29 Daniel Jacobowitz <drow@mvista.com> 2001-06-29 Daniel Jacobowitz <drow@mvista.com>
* elf-bfd.h: Add prototypes for _bfd_elfcore_make_pseudosection * elf-bfd.h: Add prototypes for _bfd_elfcore_make_pseudosection

View File

@@ -1159,9 +1159,6 @@ boolean _bfd_elf_make_linker_section_rela
elf_linker_section_t *lsect, elf_linker_section_t *lsect,
int alignment)); int alignment));
boolean _bfd_elfcore_section_from_phdr
PARAMS ((bfd *, Elf_Internal_Phdr *, int));
extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *)); extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *)); extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *)); extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));

View File

@@ -5410,10 +5410,7 @@ _bfd_elfcore_make_pseudosection (abfd, name, size, filepos)
sect->flags = SEC_HAS_CONTENTS; sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
if (! elfcore_maybe_make_sect (abfd, name, sect)) return elfcore_maybe_make_sect (abfd, name, sect);
return false;
return true;
} }
/* prstatus_t exists on: /* prstatus_t exists on:
@@ -5484,11 +5481,8 @@ elfcore_grok_prstatus (abfd, note)
} }
/* Make a ".reg/999" section and a ".reg" section. */ /* Make a ".reg/999" section and a ".reg" section. */
if (! _bfd_elfcore_make_pseudosection (abfd, ".reg", return _bfd_elfcore_make_pseudosection (abfd, ".reg",
raw_size, note->descpos + offset)); raw_size, note->descpos + offset);
return false;
return true;
} }
#endif /* defined (HAVE_PRSTATUS_T) */ #endif /* defined (HAVE_PRSTATUS_T) */
@@ -5499,7 +5493,8 @@ elfcore_make_note_pseudosection (abfd, name, note)
char *name; char *name;
Elf_Internal_Note *note; Elf_Internal_Note *note;
{ {
return _bfd_elfcore_make_pseudosection (abfd, name, note->descsz, note->descpos); return _bfd_elfcore_make_pseudosection (abfd, name,
note->descsz, note->descpos);
} }
/* There isn't a consistent prfpregset_t across platforms, /* There isn't a consistent prfpregset_t across platforms,
@@ -5583,10 +5578,12 @@ elfcore_grok_psinfo (abfd, note)
memcpy (&psinfo, note->descdata, sizeof (psinfo)); memcpy (&psinfo, note->descdata, sizeof (psinfo));
elf_tdata (abfd)->core_program elf_tdata (abfd)->core_program
= _bfd_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 elf_tdata (abfd)->core_command
= _bfd_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) #if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
else if (note->descsz == sizeof (elfcore_psinfo32_t)) else if (note->descsz == sizeof (elfcore_psinfo32_t))
@@ -5597,10 +5594,12 @@ elfcore_grok_psinfo (abfd, note)
memcpy (&psinfo, note->descdata, sizeof (psinfo)); memcpy (&psinfo, note->descdata, sizeof (psinfo));
elf_tdata (abfd)->core_program elf_tdata (abfd)->core_program
= _bfd_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 elf_tdata (abfd)->core_command
= _bfd_elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs)); = _bfd_elfcore_strndup (abfd, psinfo.pr_psargs,
sizeof (psinfo.pr_psargs));
} }
#endif #endif
@@ -5742,10 +5741,7 @@ elfcore_grok_lwpstatus (abfd, note)
sect->flags = SEC_HAS_CONTENTS; sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
if (!elfcore_maybe_make_sect (abfd, ".reg2", sect)) return elfcore_maybe_make_sect (abfd, ".reg2", sect);
return false;
return true;
} }
#endif /* defined (HAVE_LWPSTATUS_T) */ #endif /* defined (HAVE_LWPSTATUS_T) */
@@ -5938,21 +5934,6 @@ elfcore_read_notes (abfd, offset, size)
free (buf); free (buf);
return true; return true;
} }
/* FIXME: This function is now unnecessary. Callers can just call
bfd_section_from_phdr directly. */
boolean
_bfd_elfcore_section_from_phdr (abfd, phdr, sec_num)
bfd *abfd;
Elf_Internal_Phdr* phdr;
int sec_num;
{
if (! bfd_section_from_phdr (abfd, phdr, sec_num))
return false;
return true;
}
/* Providing external access to the ELF program header table. */ /* Providing external access to the ELF program header table. */
@@ -5970,8 +5951,7 @@ bfd_get_elf_phdr_upper_bound (abfd)
return -1; return -1;
} }
return (elf_elfheader (abfd)->e_phnum return elf_elfheader (abfd)->e_phnum * sizeof (Elf_Internal_Phdr);
* sizeof (Elf_Internal_Phdr));
} }
/* Copy ABFD's program header table entries to *PHDRS. The entries /* Copy ABFD's program header table entries to *PHDRS. The entries

View File

@@ -2318,7 +2318,7 @@ mips_elf_sym_is_global (abfd, sym)
asymbol *sym; asymbol *sym;
{ {
if (SGI_COMPAT (abfd)) if (SGI_COMPAT (abfd))
return (sym->flags & BSF_SECTION_SYM) == 0 ? true : false; return (sym->flags & BSF_SECTION_SYM) == 0;
else else
return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0 return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (sym)) || bfd_is_und_section (bfd_get_section (sym))
@@ -9163,11 +9163,8 @@ _bfd_elf32_mips_grok_prstatus (abfd, note)
} }
/* Make a ".reg/999" section. */ /* Make a ".reg/999" section. */
if (! _bfd_elfcore_make_pseudosection (abfd, ".reg", return _bfd_elfcore_make_pseudosection (abfd, ".reg",
raw_size, note->descpos + offset)) raw_size, note->descpos + offset);
return false;
return true;
} }
static boolean _bfd_elf32_mips_grok_psinfo (abfd, note) static boolean _bfd_elf32_mips_grok_psinfo (abfd, note)

View File

@@ -206,7 +206,7 @@ elf_core_file_p (abfd)
/* Process each program header. */ /* Process each program header. */
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex) for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
{ {
if (!_bfd_elfcore_section_from_phdr (abfd, i_phdrp + phindex, phindex)) if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, phindex))
goto fail; goto fail;
} }