From: Nick Clifton Date: Fri, 28 May 1999 13:24:33 +0000 (+0000) Subject: Initialise EI_OSABI and EI_ABIVERSION fields of e_ident array. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6c51ed4dfc35cad59f92b1e364511385858401a;p=binutils-gdb.git Initialise EI_OSABI and EI_ABIVERSION fields of e_ident array. Add ability for backends to process program and section headers after they have been created. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 09dac05d659..621fa91a2a3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +1999-05-28 Nick Clifton + + * elf-bfd.h (struct elf_backend_data): Add new field: + elf_backend_post_process_headers. + + * elfxx-target.h (elf_backend_post_process_headers): Define to + NULL if not already defined. + (elfNN_bed): Initialise elf_backend_post_process_headers field. + + * elf.c (prep_headers): Set the EI_OSABI and EI_ABIVERSION fields + to zero. + (_bfd_elf_compute_section_file_positions): Call + elf_backend_post_process_headers if defined. + 1999-05-28 Ian Lance Taylor * configure.in: Check whether getuid and getgid exist. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 82ffe2add97..218780dae28 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -515,6 +515,12 @@ struct elf_backend_data PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, const Elf_Internal_Rela *relocs)); + /* This function, if defined, is called after the ELF headers have + been created. This allows for things like the OS and ABI versions + to be changed. */ + void (*elf_backend_post_process_headers) + PARAMS ((bfd *, struct bfd_link_info *)); + /* 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; diff --git a/bfd/elf.c b/bfd/elf.c index 36a4b6bd1e7..135e55392ac 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -2011,6 +2011,10 @@ _bfd_elf_compute_section_file_positions (abfd, link_info) if (! prep_headers (abfd)) return false; + /* Post process the headers if necessary. */ + if (bed->elf_backend_post_process_headers) + (*bed->elf_backend_post_process_headers) (abfd, link_info); + failed = false; bfd_map_over_sections (abfd, elf_fake_sections, &failed); if (failed) @@ -3042,6 +3046,9 @@ prep_headers (abfd) bfd_big_endian (abfd) ? ELFDATA2MSB : ELFDATA2LSB; i_ehdrp->e_ident[EI_VERSION] = bed->s->ev_current; + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_SYSV; + i_ehdrp->e_ident[EI_ABIVERSION] = 0; + for (count = EI_PAD; count < EI_NIDENT; count++) i_ehdrp->e_ident[count] = 0; diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 9acabd1e607..dc116ef3a9a 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -290,6 +290,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef elf_backend_plt_header_size #define elf_backend_plt_header_size 0 #endif +#ifndef elf_backend_post_process_headers +#define elf_backend_post_process_headers NULL +#endif #ifndef ELF_MACHINE_ALT1 #define ELF_MACHINE_ALT1 0 @@ -344,6 +347,7 @@ static CONST struct elf_backend_data elfNN_bed = elf_backend_modify_segment_map, elf_backend_gc_mark_hook, elf_backend_gc_sweep_hook, + elf_backend_post_process_headers, elf_backend_ecoff_debug_swap, ELF_MACHINE_ALT1, ELF_MACHINE_ALT2,