public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/97290] Segmentation fault in lto-wrapper
Date: Wed, 07 Oct 2020 06:53:12 +0000	[thread overview]
Message-ID: <bug-97290-4-g5b2xACpvk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97290-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97290

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master with g:190c04ba36d9c6c3dce41f12012aa97c6d7f22f5

commit 190c04ba36d9c6c3dce41f12012aa97c6d7f22f5
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Oct 5 18:03:08 2020 +0200

    lto: fix LTO debug sections copying.

    readelf -S prints:

    There are 81999 section headers, starting at offset 0x1f488060:

    Section Headers:
      [Nr] Name              Type            Address          Off    Size   ES
Flg Lk Inf Al
      [ 0]                   NULL            0000000000000000 000000 01404f 00 
   81998   0  0
      [ 1] .group            GROUP           0000000000000000 000040 000008 04 
   81995 105027  4
    ...
      [81995] .symtab           SYMTAB          0000000000000000 d5d9298 2db310
18     81997 105026  8
      [81996] .symtab_shndx     SYMTAB SECTION INDICES 0000000000000000 d8b45a8
079dd8 04     81995   0  4
      [81997] .strtab           STRTAB          0000000000000000 d92e380 80460c
00      0   0  1
    ...

    Looking at the documentation:
    Table 7–15 ELF sh_link and sh_info Interpretation

    sh_type - sh_link
    SHT_SYMTAB - The section header index of the associated string table.
    SHT_SYMTAB_SHNDX - The section header index of the associated symbol table.

    As seen, sh_link of a SHT_SYMTAB always points to a .strtab and readelf
    confirms that.

    So we need to use reverse mapping taken from
      [81996] .symtab_shndx     SYMTAB SECTION INDICES 0000000000000000 d8b45a8
079dd8 04     81995   0  4

    where sh_link points to 81995.

    libiberty/ChangeLog:

            PR lto/97290
            * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
            Use sh_link of a .symtab_shndx section.

  parent reply	other threads:[~2020-10-07  6:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 11:38 [Bug lto/97290] New: " markus.rothe at rite dot cc
2020-10-05 11:42 ` [Bug lto/97290] " marxin at gcc dot gnu.org
2020-10-05 11:43 ` markus.rothe at rite dot cc
2020-10-05 11:44 ` marxin at gcc dot gnu.org
2020-10-05 12:07 ` marxin at gcc dot gnu.org
2020-10-05 12:49 ` markus.rothe at rite dot cc
2020-10-05 13:17 ` marxin at gcc dot gnu.org
2020-10-05 15:13 ` marxin at gcc dot gnu.org
2020-10-07  6:53 ` marxin at gcc dot gnu.org [this message]
2020-10-07 12:05 ` marxin at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97290-4-g5b2xACpvk@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).