mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
Preserve machine dependent section header flags when reading ELF object file.
* elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags field. * elf.c (_bfd_elf_make_section_from_shdr): Call the elf_backend_section_flags function. * elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion code. (elf64_ia64_section_flags): New function containing flag conversion code. (elf_backend_section_flags): Define to elf64_ia64_section_flags. * elfxx-target.h (elf_backend_section_flags): Define. (elfNN_bed): Initialize elf_backend_section_flags field.
This commit is contained in:
@ -1,3 +1,17 @@
|
|||||||
|
2000-10-05 Jim Wilson <wilson@cygnus.com>
|
||||||
|
|
||||||
|
* elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags
|
||||||
|
field.
|
||||||
|
* elf.c (_bfd_elf_make_section_from_shdr): Call the
|
||||||
|
elf_backend_section_flags function.
|
||||||
|
* elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion
|
||||||
|
code.
|
||||||
|
(elf64_ia64_section_flags): New function containing flag conversion
|
||||||
|
code.
|
||||||
|
(elf_backend_section_flags): Define to elf64_ia64_section_flags.
|
||||||
|
* elfxx-target.h (elf_backend_section_flags): Define.
|
||||||
|
(elfNN_bed): Initialize elf_backend_section_flags field.
|
||||||
|
|
||||||
2000-10-02 Alan Modra <alan@linuxcare.com.au>
|
2000-10-02 Alan Modra <alan@linuxcare.com.au>
|
||||||
|
|
||||||
* elf32-hppa.c (elf32_hppa_check_relocs): Correct call to
|
* elf32-hppa.c (elf32_hppa_check_relocs): Correct call to
|
||||||
|
@ -391,6 +391,11 @@ struct elf_backend_data
|
|||||||
Elf32_Internal_Shdr *,
|
Elf32_Internal_Shdr *,
|
||||||
char *));
|
char *));
|
||||||
|
|
||||||
|
/* A function to convert machine dependent section header flags to
|
||||||
|
BFD internal section header flags. */
|
||||||
|
boolean (*elf_backend_section_flags) PARAMS ((flagword *,
|
||||||
|
Elf32_Internal_Shdr *));
|
||||||
|
|
||||||
/* A function to handle unusual program segment types when creating BFD
|
/* A function to handle unusual program segment types when creating BFD
|
||||||
sections from ELF program segments. */
|
sections from ELF program segments. */
|
||||||
boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
|
boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
|
||||||
|
@ -345,6 +345,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
|
|||||||
{
|
{
|
||||||
asection *newsect;
|
asection *newsect;
|
||||||
flagword flags;
|
flagword flags;
|
||||||
|
struct elf_backend_data *bed;
|
||||||
|
|
||||||
if (hdr->bfd_section != NULL)
|
if (hdr->bfd_section != NULL)
|
||||||
{
|
{
|
||||||
@ -410,6 +411,11 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
|
|||||||
if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
|
if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
|
||||||
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
||||||
|
|
||||||
|
bed = get_elf_backend_data (abfd);
|
||||||
|
if (bed->elf_backend_section_flags)
|
||||||
|
if (! bed->elf_backend_section_flags (&flags, hdr))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (! bfd_set_section_flags (abfd, newsect, flags))
|
if (! bfd_set_section_flags (abfd, newsect, flags))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -946,8 +946,21 @@ elf64_ia64_section_from_shdr (abfd, hdr, name)
|
|||||||
return false;
|
return false;
|
||||||
newsect = hdr->bfd_section;
|
newsect = hdr->bfd_section;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert IA-64 specific section flags to bfd internal section flags. */
|
||||||
|
|
||||||
|
/* ??? There is no bfd internal flag equivalent to the SHF_IA_64_NORECOV
|
||||||
|
flag. */
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
elf64_ia64_section_flags (flags, hdr)
|
||||||
|
flagword *flags;
|
||||||
|
Elf64_Internal_Shdr *hdr;
|
||||||
|
{
|
||||||
if (hdr->sh_flags & SHF_IA_64_SHORT)
|
if (hdr->sh_flags & SHF_IA_64_SHORT)
|
||||||
newsect->flags |= SEC_SMALL_DATA;
|
*flags |= SEC_SMALL_DATA;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -4064,6 +4077,8 @@ elf64_ia64_print_private_bfd_data (abfd, ptr)
|
|||||||
|
|
||||||
#define elf_backend_section_from_shdr \
|
#define elf_backend_section_from_shdr \
|
||||||
elf64_ia64_section_from_shdr
|
elf64_ia64_section_from_shdr
|
||||||
|
#define elf_backend_section_flags \
|
||||||
|
elf64_ia64_section_flags
|
||||||
#define elf_backend_fake_sections \
|
#define elf_backend_fake_sections \
|
||||||
elf64_ia64_fake_sections
|
elf64_ia64_fake_sections
|
||||||
#define elf_backend_add_symbol_hook \
|
#define elf_backend_add_symbol_hook \
|
||||||
|
@ -237,6 +237,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#ifndef elf_backend_section_from_shdr
|
#ifndef elf_backend_section_from_shdr
|
||||||
#define elf_backend_section_from_shdr 0
|
#define elf_backend_section_from_shdr 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef elf_backend_section_flags
|
||||||
|
#define elf_backend_section_flags 0
|
||||||
|
#endif
|
||||||
#ifndef elf_backend_section_from_phdr
|
#ifndef elf_backend_section_from_phdr
|
||||||
#define elf_backend_section_from_phdr 0
|
#define elf_backend_section_from_phdr 0
|
||||||
#endif
|
#endif
|
||||||
@ -368,6 +371,7 @@ static CONST struct elf_backend_data elfNN_bed =
|
|||||||
elf_backend_get_symbol_type,
|
elf_backend_get_symbol_type,
|
||||||
elf_backend_section_processing,
|
elf_backend_section_processing,
|
||||||
elf_backend_section_from_shdr,
|
elf_backend_section_from_shdr,
|
||||||
|
elf_backend_section_flags,
|
||||||
elf_backend_section_from_phdr,
|
elf_backend_section_from_phdr,
|
||||||
elf_backend_fake_sections,
|
elf_backend_fake_sections,
|
||||||
elf_backend_section_from_bfd_section,
|
elf_backend_section_from_bfd_section,
|
||||||
|
Reference in New Issue
Block a user