public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug tools/24795] New: eu-unstrip doesn't recognize MIPS_DWARF as debug section
@ 2019-07-09 21:41 vries at gcc dot gnu.org
  2019-07-09 21:54 ` [Bug tools/24795] " mark at klomp dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2019-07-09 21:41 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=24795

            Bug ID: 24795
           Summary: eu-unstrip doesn't recognize MIPS_DWARF as debug
                    section
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tools
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Consider the section header table of a hello world exec on debian 7 MIPS:
...
$ readelf -S hello
There are 42 section headers, starting at offset 0xcf4:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .interp           PROGBITS        00400154 000154 00000d 00   A  0   0 
1
  [ 2] .note.ABI-tag     NOTE            00400164 000164 000020 00   A  0   0 
4
  [ 3] .reginfo          MIPS_REGINFO    00400184 000184 000018 18   A  0   0 
4
  [ 4] .note.gnu.build-i NOTE            0040019c 00019c 000024 00   A  0   0 
4
  [ 5] .dynamic          DYNAMIC         004001c0 0001c0 0000f8 08   A  8   0 
4
  [ 6] .hash             HASH            004002b8 0002b8 000040 04   A  7   0 
4
  [ 7] .dynsym           DYNSYM          004002f8 0002f8 0000b0 10   A  8   1 
4
  [ 8] .dynstr           STRTAB          004003a8 0003a8 000085 00   A  0   0 
1
  [ 9] .gnu.version      VERSYM          0040042e 00042e 000016 02   A  7   0 
2
  [10] .gnu.version_r    VERNEED         00400444 000444 000020 00   A  8   1 
4
  [11] .rel.plt          REL             00400464 000464 000008 08   A  7  13 
4
  [12] .init             PROGBITS        0040046c 00046c 000068 00  AX  0   0 
4
  [13] .plt              PROGBITS        004004e0 0004e0 000030 00  AX  0   0
32
  [14] .text             PROGBITS        00400510 000510 000290 00  AX  0   0
16
  [15] .MIPS.stubs       PROGBITS        004007a0 0007a0 000020 00  AX  0   0 
4
  [16] .fini             PROGBITS        004007c0 0007c0 000038 00  AX  0   0 
4
  [17] .rodata           PROGBITS        00400800 000800 000020 00   A  0   0
16
  [18] .eh_frame         PROGBITS        00400820 000820 000004 00   A  0   0 
4
  [19] .ctors            PROGBITS        00410824 000824 000008 00  WA  0   0 
4
  [20] .dtors            PROGBITS        0041082c 00082c 000008 00  WA  0   0 
4
  [21] .jcr              PROGBITS        00410834 000834 000004 00  WA  0   0 
4
  [22] .data             PROGBITS        00410840 000840 000010 00  WA  0   0
16
  [23] .rld_map          PROGBITS        00410850 000850 000004 00  WA  0   0 
4
  [24] .got.plt          PROGBITS        00410854 000854 00000c 00  WA  0   0 
4
  [25] .got              PROGBITS        00410860 000860 000028 04 WAp  0   0
16
  [26] .sdata            PROGBITS        00410888 000888 000004 00 WAp  0   0 
4
  [27] .bss              NOBITS          00410890 00088c 000010 00  WA  0   0
16
  [28] .comment          PROGBITS        00000000 00088c 000039 01  MS  0   0 
1
  [29] .pdr              PROGBITS        00000000 0008c8 000060 00      0   0 
4
  [30] .debug_aranges    MIPS_DWARF      00000000 000928 000020 00      0   0 
1
  [31] .debug_info       MIPS_DWARF      00000000 000948 000088 00      0   0 
1
  [32] .debug_abbrev     MIPS_DWARF      00000000 0009d0 00003f 00      0   0 
1
  [33] .debug_line       MIPS_DWARF      00000000 000a0f 000064 00      0   0 
1
  [34] .debug_frame      MIPS_DWARF      00000000 000a74 00002c 00      0   0 
4
  [35] .debug_str        MIPS_DWARF      00000000 000aa0 000095 01  MS  0   0 
1
  [36] .debug_loc        MIPS_DWARF      00000000 000b35 00002c 00      0   0 
1
  [37] .gnu.attributes   LOOS+ffffff5    00000000 000b61 000010 00      0   0 
1
  [38] .mdebug.abi32     PROGBITS        00000000 000b71 000000 00      0   0 
1
  [39] .shstrtab         STRTAB          00000000 000b71 000181 00      0   0 
1
  [40] .symtab           SYMTAB          00000000 001384 000550 10     41  58 
4
  [41] .strtab           STRTAB          00000000 0018d4 000273 00      0   0 
1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)
...

After doing:
...
eu-strip hello -o hello.stripped -f hello.debug
...

we have:
...
$ readelf -S hello.debug | grep NOBITS
  [ 1] .interp           NOBITS          00400154 000154 00000d 00   A  0   0 
1
  [ 3] .reginfo          NOBITS          00400184 000174 000018 18   A  0   0 
4
  [ 5] .dynamic          NOBITS          004001c0 000198 0000f8 08   A  8   0 
4
  [ 6] .hash             NOBITS          004002b8 000198 000040 04   A  7   0 
4
  [ 7] .dynsym           NOBITS          004002f8 000198 0000b0 10   A  8   1 
4
  [ 8] .dynstr           NOBITS          004003a8 000198 000085 00   A  0   0 
1
  [ 9] .gnu.version      NOBITS          0040042e 000198 000016 02   A  7   0 
2
  [10] .gnu.version_r    NOBITS          00400444 000198 000020 00   A  8   1 
4
  [11] .rel.plt          NOBITS          00400464 000198 000008 08   A  7  13 
4
  [12] .init             NOBITS          0040046c 000198 000068 00  AX  0   0 
4
  [13] .plt              NOBITS          004004e0 0001a0 000030 00  AX  0   0
32
  [14] .text             NOBITS          00400510 0001a0 000290 00  AX  0   0
16
  [15] .MIPS.stubs       NOBITS          004007a0 0001a0 000020 00  AX  0   0 
4
  [16] .fini             NOBITS          004007c0 0001a0 000038 00  AX  0   0 
4
  [17] .rodata           NOBITS          00400800 0001a0 000020 00   A  0   0
16
  [18] .eh_frame         NOBITS          00400820 0001a0 000004 00   A  0   0 
4
  [19] .ctors            NOBITS          00410824 0001a0 000008 00  WA  0   0 
4
  [20] .dtors            NOBITS          0041082c 0001a0 000008 00  WA  0   0 
4
  [21] .jcr              NOBITS          00410834 0001a0 000004 00  WA  0   0 
4
  [22] .data             NOBITS          00410840 0001a0 000010 00  WA  0   0
16
  [23] .rld_map          NOBITS          00410850 0001a0 000004 00  WA  0   0 
4
  [24] .got.plt          NOBITS          00410854 0001a0 00000c 00  WA  0   0 
4
  [25] .got              NOBITS          00410860 0001a0 000028 04 WAp  0   0
16
  [26] .sdata            NOBITS          00410888 0001a0 000004 00 WAp  0   0 
4
  [27] .bss              NOBITS          00410890 0001a0 000010 00  WA  0   0
16
  [28] .comment          NOBITS          00000000 0001a0 000039 01  MS  0   0 
1
  [30] .debug_aranges    NOBITS          00000000 000200 000020 00      0   0 
1
  [31] .debug_info       NOBITS          00000000 000200 000088 00      0   0 
1
  [32] .debug_abbrev     NOBITS          00000000 000200 00003f 00      0   0 
1
  [33] .debug_line       NOBITS          00000000 000200 000064 00      0   0 
1
  [34] .debug_frame      NOBITS          00000000 000200 00002c 00      0   0 
4
  [35] .debug_str        NOBITS          00000000 000200 000095 01  MS  0   0 
1
  [36] .debug_loc        NOBITS          00000000 000200 00002c 00      0   0 
1
  [37] .gnu.attributes   NOBITS          00000000 000200 000010 00      0   0 
1
...

The .debug_* section should not be NOBITS here.

This is with an old eu-strip (0.152), but I don't manage building from git for
now, so atm I cannot say whether this is fixed on trunk or not.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/24795] eu-unstrip doesn't recognize MIPS_DWARF as debug section
  2019-07-09 21:41 [Bug tools/24795] New: eu-unstrip doesn't recognize MIPS_DWARF as debug section vries at gcc dot gnu.org
@ 2019-07-09 21:54 ` mark at klomp dot org
  2019-07-09 22:08 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2019-07-09 21:54 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=24795

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Tom de Vries from comment #0)
> Consider the section header table of a hello world exec on debian 7 MIPS:

BTW. Isn't Debian 7 really old?

> This is with an old eu-strip (0.152), but I don't manage building from git
> for now,

See the README:

 To build a git checkout do:
   autoreconf -i -f && \
   ./configure --enable-maintainer-mode && \
   make && make check

Please let us know what issues you are seeing.

> so atm I cannot say whether this is fixed on trunk or not.

It isn't. elfutils doesn't have a MIPS backend and so knows nothing about
special MIPS ELF constructs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/24795] eu-unstrip doesn't recognize MIPS_DWARF as debug section
  2019-07-09 21:41 [Bug tools/24795] New: eu-unstrip doesn't recognize MIPS_DWARF as debug section vries at gcc dot gnu.org
  2019-07-09 21:54 ` [Bug tools/24795] " mark at klomp dot org
@ 2019-07-09 22:08 ` vries at gcc dot gnu.org
  2019-07-10 10:41 ` mark at klomp dot org
  2019-07-10 10:44 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2019-07-09 22:08 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=24795

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Mark Wielaard from comment #1)
> (In reply to Tom de Vries from comment #0)
> > Consider the section header table of a hello world exec on debian 7 MIPS:
> 
> BTW. Isn't Debian 7 really old?
> 

Yep, initial release 2013.

> > This is with an old eu-strip (0.152), but I don't manage building from git
> > for now,
> 
> See the README:
> 
>  To build a git checkout do:
>    autoreconf -i -f && \
>    ./configure --enable-maintainer-mode && \
>    make && make check
> 

Ah, ok.

> Please let us know what issues you are seeing.
> 

I tried elfutils-latest.tar.bz2 instead, and ran into the use of aligned_alloc,
which is supported starting glibc v2.16, while debian 7 has glibc v2.13.

> > so atm I cannot say whether this is fixed on trunk or not.
> 
> It isn't. elfutils doesn't have a MIPS backend and so knows nothing about
> special MIPS ELF constructs.

Ah, I see indeed at https://sourceware.org/elfutils/ that mips is missing:
...
Included backends for machine specific ELF handling:
aarch64 alpha arm bpf i386 ia64 m68k ppc ppc64 s390 s390x sh sparc sparc64
tilegx x32 x86_64
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/24795] eu-unstrip doesn't recognize MIPS_DWARF as debug section
  2019-07-09 21:41 [Bug tools/24795] New: eu-unstrip doesn't recognize MIPS_DWARF as debug section vries at gcc dot gnu.org
  2019-07-09 21:54 ` [Bug tools/24795] " mark at klomp dot org
  2019-07-09 22:08 ` vries at gcc dot gnu.org
@ 2019-07-10 10:41 ` mark at klomp dot org
  2019-07-10 10:44 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2019-07-10 10:41 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=24795

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Tom de Vries from comment #2)
> I tried elfutils-latest.tar.bz2 instead, and ran into the use of
> aligned_alloc, which is supported starting glibc v2.16, while debian 7 has
> glibc v2.13.

BTW. Unrelated to the MIPS issue, but this has indeed been fixed in git:

commit 6bd060a23f43a842fbc37dd1bb8d6d7964eda36e
Author: Mark Wielaard <mark@klomp.org>
Date:   Thu Mar 7 17:31:53 2019 +0100

    libelf: Use posix_memalign instead of aligned_alloc.

    Older glibc might not have aligned_alloc (it is C11).
    Use posix_memalign instead. posix_memalign requires the alignment to
    be a multiple of sizeof (void *). So use malloc for smaller alignments.

    Signed-off-by: Mark Wielaard <mark@klomp.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tools/24795] eu-unstrip doesn't recognize MIPS_DWARF as debug section
  2019-07-09 21:41 [Bug tools/24795] New: eu-unstrip doesn't recognize MIPS_DWARF as debug section vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2019-07-10 10:41 ` mark at klomp dot org
@ 2019-07-10 10:44 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2019-07-10 10:44 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=24795

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |23902

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
See also https://sourceware.org/bugzilla/show_bug.cgi?id=23902 for a reference
to a partial MIPS backend.


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=23902
[Bug 23902] MIPS varlocs dwarf_cfi_addrframe: unknown error (missing ebl
abi_cfi hook)
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-10 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 21:41 [Bug tools/24795] New: eu-unstrip doesn't recognize MIPS_DWARF as debug section vries at gcc dot gnu.org
2019-07-09 21:54 ` [Bug tools/24795] " mark at klomp dot org
2019-07-09 22:08 ` vries at gcc dot gnu.org
2019-07-10 10:41 ` mark at klomp dot org
2019-07-10 10:44 ` mark at klomp dot org

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).