This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR bootstrap/38992: [LTO] Bootstrap failed on RHEL5/ia32 and RHEL5/ia64


On Tue, Jan 27, 2009 at 18:49, H.J. Lu <hongjiu.lu@intel.com> wrote:

>
>        PR bootstrap/38992
>        * configure.ac: Add AC_CHECK_GELF.
>
>        * config.in: Regenerated.
>        * configure: Likewise.

This is OK.

> @@ -589,10 +589,33 @@ lto_elf_file_close (lto_file *file)
>   /* Write the ELF section header string table.  */
>   if (elf_file->shstrtab_stream)
>     {
> +      size_t strtab;
> +      GElf_Ehdr *ehdr_p, ehdr_buf;
>       lto_file *old_file = lto_set_current_out_file (file);
>
>       lto_elf_begin_section_with_type (".shstrtab", SHT_STRTAB);
> -      elfx_update_shstrndx (elf_file->elf, elf_ndxscn (elf_file->scn));
> +      ehdr_p = gelf_getehdr (elf_file->elf, &ehdr_buf);
> +      if (ehdr_p == NULL)
> +       fatal_error ("gelf_getehdr() failed: %s.", elf_errmsg(-1));
> +      strtab = elf_ndxscn (elf_file->scn);
> +      if (strtab < SHN_LORESERVE)
> +       ehdr_p->e_shstrndx = strtab;
> +      else
> +       {
> +         GElf_Shdr *shdr_p, shdr_buf;
> +         Elf_Scn *scn_p = elf_getscn (elf_file->elf, 0);
> +         if (scn_p == NULL)
> +           fatal_error ("elf_getscn() failed: %s.", elf_errmsg(-1));
> +         shdr_p = gelf_getshdr (scn_p, &shdr_buf);
> +         if (shdr_p == NULL)
> +           fatal_error ("gelf_getshdr() failed: %s.", elf_errmsg(-1));
> +         shdr_p->sh_link = strtab;
> +         if (gelf_update_shdr (scn_p, shdr_p) == 0)
> +           fatal_error ("gelf_update_shdr() failed: %s.", elf_errmsg(-1));
> +         ehdr_p->e_shstrndx = SHN_XINDEX;
> +       }
> +      if (gelf_update_ehdr (elf_file->elf, ehdr_p) == 0)
> +       fatal_error ("gelf_update_ehdr() failed: %s.", elf_errmsg(-1));
>       lto_write_stream (elf_file->shstrtab_stream);
>       lto_elf_end_section ();

Looks fine to me, but I would rather have Ollie look over this first.  Ollie?


Thanks.  Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]