Bug 1399866 - dwz fails to process mongodb binaries
Summary: dwz fails to process mongodb binaries
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dwz
Version: 26
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-29 23:26 UTC by andrew.c.morrow
Modified: 2018-05-29 11:30 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 11:30:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description andrew.c.morrow 2016-11-29 23:26:10 UTC
Description of problem:

Attempting to run dwz version 0.12 on Ubuntu 16.04 over the binaries for MongoDB fails with an error 


Version-Release number of selected component (if applicable):
$ dwz --version
dwz version 0.12
Copyright (C) 2001-2012 Red Hat, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

$ dpkg -l | grep dwz
ii  dwz                                                  0.12-1                                     amd64        DWARF compression tool

How reproducible:
Always

Steps to Reproduce:
1. git clone https://github.com/mongodb/mongo.git
2. cd mongo
3. python ./buildscripts/scons.py --dbg=on --opt=on --variables-files= -j8 ./mongo ./mongod ./mongos
4. dwz -m .dwz/mongo-common.debug -rh ./mongo ./mongod ./mongos

Actual results:
dwz: Allocatable section in ./mongod after non-allocatable ones
dwz: Allocatable section in ./mongos after non-allocatable ones
dwz: Too few files for multifile optimization


Expected results:
Expected result is that the .dwz/mongo-common.debug file is created, but it is not. Instead, the above error messages are reported and dwz terminates (with exit code 0).

Additional info:

Comment 1 andrew.c.morrow 2016-12-31 17:36:56 UTC
Is there any additional information I can provide that would help get this issue some attention? We would very much like to make use of dwz for our RHEL distribution of MongoDB, but currently are unable to do so because of this issue.

Comment 2 Jakub Jelinek 2016-12-31 18:28:51 UTC
Perhaps readelf -Ws mongo{d,s}
would be useful.  If there are allocatable sections after non-allocatable ones, either you use a buggy linker, or bogus linker script.

Comment 3 andrew.c.morrow 2016-12-31 23:16:58 UTC
I just re-tested.

I'm using the system GCC and binutils toolchain on Ubuntu 16.04:

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

There is no linker script involved in the build (except if there are any system ones that the toolchain injects automatically):

If I build with -fuse-ld=bfd, then I get the following errors when I run dwz:
$ dwz -m mongo-common.debug -rh ./mongod ./mongo ./mongos
dwz: Section offsets in ./mongod not monotonically increasing
dwz: Section offsets in ./mongo not monotonically increasing
dwz: Section offsets in ./mongos not monotonically increasing
dwz: Too few files for multifile optimization

If I build with -fuse-ld=gold, then I get the errors reported above:

$ dwz -m mongo-common.debug -rh ./mongod ./mongo ./mongos
dwz: Allocatable section in ./mongod after non-allocatable ones
dwz: Too few files for multifile optimization

Interestingly, it seems as if the mongo and mongos binaries are no longer affected.

Both the BFD ld and gold are from binutils 2.26.1

$ ld.bfd --version
GNU ld (GNU Binutils for Ubuntu) 2.26.1
Copyright (C) 2015 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
$ ld.gold --version
GNU gold (GNU Binutils for Ubuntu 2.26.1) 1.11
Copyright (C) 2015 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

The combined readelf -Ws output for the mongo, mongos, and mongod binaries is about 7 MB gzipped. Would you like me to attach it here? If so, do you want the output for both linkers?

Comment 4 andrew.c.morrow 2016-12-31 23:23:43 UTC
Or, did you mean readelf -WS rather than readelf -Ws? If so, here is the output for gold:

$ readelf -WS mongo mongod mongos

File: mongo
There are 45 section headers, starting at offset 0xda89100:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000000000270 000270 00001c 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            000000000000028c 00028c 000020 00   A  0   0  4
  [ 3] .note.gnu.build-id NOTE            00000000000002ac 0002ac 000024 00   A  0   0  4
  [ 4] .dynsym           DYNSYM          00000000000002d0 0002d0 0d9f80 18   A  5   1  8
  [ 5] .dynstr           STRTAB          00000000000da250 0da250 24c81d 00   A  0   0  1
  [ 6] .gnu.hash         GNU_HASH        0000000000326a70 326a70 04b9a8 00   A  4   0  8
  [ 7] .gnu.version      VERSYM          0000000000372418 372418 0122a0 02   A  4   0  2
  [ 8] .gnu.version_r    VERNEED         00000000003846b8 3846b8 0002e0 00   A  5   9  4
  [ 9] .rela.dyn         RELA            0000000000384998 384998 11a078 18   A  4   0  8
  [10] .rela.plt         RELA            000000000049ea10 49ea10 0040b0 18  AI  4  12  8
  [11] .init             PROGBITS        00000000004a2ac0 4a2ac0 00001a 00  AX  0   0  4
  [12] .plt              PROGBITS        00000000004a2ae0 4a2ae0 002b30 10  AX  0   0 16
  [13] .text             PROGBITS        00000000004a5610 4a5610 c04eb9 00  AX  0   0 16
  [14] google_malloc     PROGBITS        00000000010aa4d0 10aa4d0 00185a 00  AX  0   0 16
  [15] malloc_hook       PROGBITS        00000000010abd30 10abd30 000375 00  AX  0   0 16
  [16] .fini             PROGBITS        00000000010ac0a8 10ac0a8 000009 00  AX  0   0  4
  [17] .rodata           PROGBITS        00000000010ac0c0 10ac0c0 36b634 00   A  0   0 32
  [18] .gcc_except_table PROGBITS        00000000014176f4 14176f4 04a6ce 00   A  0   0  4
  [19] .eh_frame         PROGBITS        0000000001461dc8 1461dc8 1403e4 00   A  0   0  8
  [20] .eh_frame_hdr     PROGBITS        00000000015a21ac 15a21ac 03abec 00   A  0   0  4
  [21] .tbss             NOBITS          00000000015dde80 15dce80 000180 00 WAT  0   0  8
  [22] .data.rel.ro.local PROGBITS        00000000015dde80 15dce80 03ee90 00  WA  0   0 32
  [23] .jcr              PROGBITS        000000000161cd10 161bd10 000008 00  WA  0   0  8
  [24] .fini_array       FINI_ARRAY      000000000161cd18 161bd18 000008 00  WA  0   0  8
  [25] .init_array       INIT_ARRAY      000000000161cd20 161bd20 000c58 00  WA  0   0  8
  [26] .data.rel.ro      PROGBITS        000000000161d980 161c980 03a8f0 00  WA  0   0 32
  [27] .dynamic          DYNAMIC         0000000001658270 1657270 000280 10  WA  5   0  8
  [28] .got              PROGBITS        00000000016584f0 16574f0 000558 00  WA  0   0  8
  [29] .got.plt          PROGBITS        0000000001658a48 1657a48 0015a8 00  WA  0   0  8
  [30] .data             PROGBITS        000000000165a000 1659000 0f46a0 00  WA  0   0 32
  [31] .tm_clone_table   PROGBITS        000000000174e6a0 174d6a0 000000 00  WA  0   0  8
  [32] .bss              NOBITS          000000000174e6a0 174d6a0 0494c0 00  WA  0   0 32
  [33] .comment          PROGBITS        0000000000000000 174d6a0 000035 01  MS  0   0  1
  [34] .debug_info       PROGBITS        0000000000000000 174d6d5 5b22333 00      0   0  1
  [35] .debug_abbrev     PROGBITS        0000000000000000 726fa08 1eea97 00      0   0  1
  [36] .debug_loc        PROGBITS        0000000000000000 745e49f 3637e5c 00      0   0  1
  [37] .debug_aranges    PROGBITS        0000000000000000 aa962fb 0522e0 00      0   0  1
  [38] .debug_ranges     PROGBITS        0000000000000000 aae85db db9320 00      0   0  1
  [39] .debug_line       PROGBITS        0000000000000000 b8a18fb 73edbc 00      0   0  1
  [40] .debug_str        PROGBITS        0000000000000000 bfe06b7 16c462b 01  MS  0   0  1
  [41] .note.gnu.gold-version NOTE            0000000000000000 d6a4ce4 00001c 00      0   0  4
  [42] .symtab           SYMTAB          0000000000000000 d6a4d00 1180b0 18     43 10595  8
  [43] .strtab           STRTAB          0000000000000000 d7bcdb0 2cc176 00      0   0  1
  [44] .shstrtab         STRTAB          0000000000000000 da88f26 0001da 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

File: mongod
There are 45 section headers, starting at offset 0x28a802b0:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000000000270 000270 00001c 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            000000000000028c 00028c 000020 00   A  0   0  4
  [ 3] .note.gnu.build-id NOTE            00000000000002ac 0002ac 000024 00   A  0   0  4
  [ 4] .dynsym           DYNSYM          00000000000002d0 0002d0 165750 18   A  5   1  8
  [ 5] .dynstr           STRTAB          0000000000165a20 165a20 3eeba1 00   A  0   0  1
  [ 6] .gnu.hash         GNU_HASH        00000000005545c8 5545c8 06ace4 00   A  4   0  8
  [ 7] .gnu.version      VERSYM          00000000005bf2ac 5bf2ac 01dc9c 02   A  4   0  2
  [ 8] .gnu.version_r    VERNEED         00000000005dcf48 5dcf48 000300 00   A  5   9  4
  [ 9] .rela.dyn         RELA            00000000005dd248 5dd248 1adde0 18   A  4   0  8
  [10] .rela.plt         RELA            000000000078b028 78b028 004500 18  AI  4  12  8
  [11] .init             PROGBITS        000000000078f528 78f528 00001a 00  AX  0   0  4
  [12] .plt              PROGBITS        000000000078f550 78f550 002e10 10  AX  0   0 16
  [13] .text             PROGBITS        0000000000792360 792360 17e54e9 00  AX  0   0 16
  [14] google_malloc     PROGBITS        0000000001f77850 1f77850 00185a 00  AX  0   0 16
  [15] malloc_hook       PROGBITS        0000000001f790b0 1f790b0 000375 00  AX  0   0 16
  [16] .fini             PROGBITS        0000000001f79428 1f79428 000009 00  AX  0   0  4
  [17] .rodata           PROGBITS        0000000001f79440 1f79440 77ebf4 00   A  0   0 32
  [18] .gcc_except_table PROGBITS        00000000026f8034 26f8034 0b83f6 00   A  0   0  4
  [19] .eh_frame         PROGBITS        00000000027b0430 27b0430 22d6fc 00   A  0   0  8
  [20] .eh_frame_hdr     PROGBITS        00000000029ddb2c 29ddb2c 065b3c 00   A  0   0  4
  [21] .tbss             NOBITS          0000000002a448c0 2a438c0 000588 00 WAT  0   0  8
  [22] .data.rel.ro.local PROGBITS        0000000002a448c0 2a438c0 05e310 00  WA  0   0 32
  [23] .jcr              PROGBITS        0000000002aa2bd0 2aa1bd0 000008 00  WA  0   0  8
  [24] .fini_array       FINI_ARRAY      0000000002aa2bd8 2aa1bd8 000008 00  WA  0   0  8
  [25] .init_array       INIT_ARRAY      0000000002aa2be0 2aa1be0 002238 00  WA  0   0  8
  [26] .data.rel.ro      PROGBITS        0000000002aa4e20 2aa3e20 0592d0 00  WA  0   0 32
  [27] .dynamic          DYNAMIC         0000000002afe0f0 2afd0f0 000280 10  WA  5   0  8
  [28] .got              PROGBITS        0000000002afe370 2afd370 000570 00  WA  0   0  8
  [29] .got.plt          PROGBITS        0000000002afe8e0 2afd8e0 001718 00  WA  0   0  8
  [30] .data             PROGBITS        0000000002b00000 2aff000 0f46c0 00  WA  0   0 32
  [31] .tm_clone_table   PROGBITS        0000000002bf46c0 2bf36c0 000000 00  WA  0   0  8
  [32] .bss              NOBITS          0000000002bf4700 2bf3700 06a570 00  WA  0   0 128
  [33] .comment          PROGBITS        0000000000000000 2bf36c0 000035 01  MS  0   0  1
  [34] .debug_info       PROGBITS        0000000000000000 2bf36f5 185c81e4 00      0   0  1
  [35] .debug_abbrev     PROGBITS        0000000000000000 1b1bb8d9 6e106d 00      0   0  1
  [36] .debug_loc        PROGBITS        0000000000000000 1b89c946 71fd512 00      0   0  1
  [37] .debug_aranges    PROGBITS        0000000000000000 22a99e58 0a70a0 00      0   0  1
  [38] .debug_ranges     PROGBITS        0000000000000000 22b40ef8 1b8b710 00      0   0  1
  [39] .debug_line       PROGBITS        0000000000000000 246cc608 10daaca 00      0   0  1
  [40] .debug_str        PROGBITS        0000000000000000 257a70d2 2bdc4bb 01  MS  0   0  1
  [41] .note.gnu.gold-version NOTE            0000000000000000 28383590 00001c 00      0   0  4
  [42] .symtab           SYMTAB          0000000000000000 283835b0 1ee430 18     43 23349  8
  [43] .strtab           STRTAB          0000000000000000 285719e0 50e6f2 00      0   0  1
  [44] .shstrtab         STRTAB          0000000000000000 28a800d2 0001da 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

File: mongos
There are 45 section headers, starting at offset 0xe62e608:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000000000270 000270 00001c 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            000000000000028c 00028c 000020 00   A  0   0  4
  [ 3] .note.gnu.build-id NOTE            00000000000002ac 0002ac 000024 00   A  0   0  4
  [ 4] .dynsym           DYNSYM          00000000000002d0 0002d0 0a6d28 18   A  5   1  8
  [ 5] .dynstr           STRTAB          00000000000a6ff8 0a6ff8 1dd7ad 00   A  0   0  1
  [ 6] .gnu.hash         GNU_HASH        00000000002847a8 2847a8 0331a4 00   A  4   0  8
  [ 7] .gnu.version      VERSYM          00000000002b794c 2b794c 00de6e 02   A  4   0  2
  [ 8] .gnu.version_r    VERNEED         00000000002c57bc 2c57bc 0002d0 00   A  5   9  4
  [ 9] .rela.dyn         RELA            00000000002c5a90 2c5a90 0a29a8 18   A  4   0  8
  [10] .rela.plt         RELA            0000000000368438 368438 0040c8 18  AI  4  12  8
  [11] .init             PROGBITS        000000000036c500 36c500 00001a 00  AX  0   0  4
  [12] .plt              PROGBITS        000000000036c520 36c520 002b40 10  AX  0   0 16
  [13] .text             PROGBITS        000000000036f060 36f060 b9b169 00  AX  0   0 16
  [14] google_malloc     PROGBITS        0000000000f0a1d0 f0a1d0 00185a 00  AX  0   0 16
  [15] malloc_hook       PROGBITS        0000000000f0ba30 f0ba30 000375 00  AX  0   0 16
  [16] .fini             PROGBITS        0000000000f0bda8 f0bda8 000009 00  AX  0   0  4
  [17] .rodata           PROGBITS        0000000000f0bdc0 f0bdc0 6aa983 00   A  0   0 32
  [18] .gcc_except_table PROGBITS        00000000015b6744 15b6744 060bc6 00   A  0   0  4
  [19] .eh_frame         PROGBITS        0000000001617310 1617310 1013a4 00   A  0   0  8
  [20] .eh_frame_hdr     PROGBITS        00000000017186b4 17186b4 02e544 00   A  0   0  4
  [21] .tbss             NOBITS          0000000001748760 1747760 000060 00 WAT  0   0  8
  [22] .data.rel.ro.local PROGBITS        0000000001748760 1747760 026e38 00  WA  0   0 32
  [23] .jcr              PROGBITS        000000000176f598 176e598 000008 00  WA  0   0  8
  [24] .fini_array       FINI_ARRAY      000000000176f5a0 176e5a0 000008 00  WA  0   0  8
  [25] .init_array       INIT_ARRAY      000000000176f5a8 176e5a8 001628 00  WA  0   0  8
  [26] .data.rel.ro      PROGBITS        0000000001770be0 176fbe0 01dac0 00  WA  0   0 32
  [27] .dynamic          DYNAMIC         000000000178e6a0 178d6a0 000280 10  WA  5   0  8
  [28] .got              PROGBITS        000000000178e920 178d920 000130 00  WA  0   0  8
  [29] .got.plt          PROGBITS        000000000178ea50 178da50 0015b0 00  WA  0   0  8
  [30] .data             PROGBITS        0000000001790000 178f000 0f31e0 00  WA  0   0 32
  [31] .tm_clone_table   PROGBITS        00000000018831e0 18821e0 000000 00  WA  0   0  8
  [32] .bss              NOBITS          0000000001883200 1882200 0527f0 00  WA  0   0 128
  [33] .comment          PROGBITS        0000000000000000 18821e0 000035 01  MS  0   0  1
  [34] .debug_info       PROGBITS        0000000000000000 1882215 5e7d623 00      0   0  1
  [35] .debug_abbrev     PROGBITS        0000000000000000 76ff838 30e99b 00      0   0  1
  [36] .debug_loc        PROGBITS        0000000000000000 7a0e1d3 39e5a1f 00      0   0  1
  [37] .debug_aranges    PROGBITS        0000000000000000 b3f3bf2 051fc0 00      0   0  1
  [38] .debug_ranges     PROGBITS        0000000000000000 b445bb2 d30570 00      0   0  1
  [39] .debug_line       PROGBITS        0000000000000000 c176122 8a52c4 00      0   0  1
  [40] .debug_str        PROGBITS        0000000000000000 ca1b3e6 18973c2 01  MS  0   0  1
  [41] .note.gnu.gold-version NOTE            0000000000000000 e2b27a8 00001c 00      0   0  4
  [42] .symtab           SYMTAB          0000000000000000 e2b27c8 0f9c48 18     43 14157  8
  [43] .strtab           STRTAB          0000000000000000 e3ac410 282017 00      0   0  1
  [44] .shstrtab         STRTAB          0000000000000000 e62e427 0001da 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)




And here it is for bfd:

$ readelf -WS mongo mongod mongos

File: mongo
There are 42 section headers, starting at offset 0x109e9210:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000000000270 000270 00001c 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            000000000000028c 00028c 000020 00   A  0   0  4
  [ 3] .note.gnu.build-id NOTE            00000000000002ac 0002ac 000024 00   A  0   0  4
  [ 4] .gnu.hash         GNU_HASH        00000000000002d0 0002d0 04b9a8 00   A  5   0  8
  [ 5] .dynsym           DYNSYM          000000000004bc78 04bc78 0d9fb0 18   A  6   3  8
  [ 6] .dynstr           STRTAB          0000000000125c28 125c28 24c5d2 00   A  0   0  1
  [ 7] .gnu.version      VERSYM          00000000003721fa 3721fa 0122a4 02   A  5   0  2
  [ 8] .gnu.version_r    VERNEED         00000000003844a0 3844a0 0002e0 00   A  6   9  8
  [ 9] .rela.dyn         RELA            0000000000384780 384780 11de28 18   A  5   0  8
  [10] .rela.plt         RELA            00000000004a25a8 4a25a8 000030 18  AI  5  28  8
  [11] .init             PROGBITS        00000000004a25d8 4a25d8 00001a 00  AX  0   0  4
  [12] .plt              PROGBITS        00000000004a2600 4a2600 000030 10  AX  0   0 16
  [13] .plt.got          PROGBITS        00000000004a2630 4a2630 001580 00  AX  0   0  8
  [14] .text             PROGBITS        00000000004a3bb0 4a3bb0 c03379 00  AX  0   0 16
  [15] google_malloc     PROGBITS        00000000010a6f30 10a6f30 00185a 00  AX  0   0 16
  [16] malloc_hook       PROGBITS        00000000010a8790 10a8790 000375 00  AX  0   0 16
  [17] .fini             PROGBITS        00000000010a8b08 10a8b08 000009 00  AX  0   0  4
  [18] .rodata           PROGBITS        00000000010a8b20 10a8b20 3691c8 00   A  0   0 32
  [19] .eh_frame_hdr     PROGBITS        0000000001411ce8 1411ce8 03abec 00   A  0   0  4
  [20] .eh_frame         PROGBITS        000000000144c8d8 144c8d8 13fda4 00   A  0   0  8
  [21] .gcc_except_table PROGBITS        000000000158c67c 158c67c 04a6ce 00   A  0   0  4
  [22] .tbss             NOBITS          00000000017d6f98 15d6f98 000180 00 WAT  0   0  8
  [23] .init_array       INIT_ARRAY      00000000017d6f98 15d6f98 000c58 00  WA  0   0  8
  [24] .fini_array       FINI_ARRAY      00000000017d7bf0 15d7bf0 000008 00  WA  0   0  8
  [25] .jcr              PROGBITS        00000000017d7bf8 15d7bf8 000008 00  WA  0   0  8
  [26] .data.rel.ro      PROGBITS        00000000017d7c00 15d7c00 079770 00  WA  0   0 32
  [27] .dynamic          DYNAMIC         0000000001851370 1651370 000270 10  WA  6   0  8
  [28] .got              PROGBITS        00000000018515e0 16515e0 001a10 08  WA  0   0  8
  [29] .data             PROGBITS        0000000001853000 1653000 0f46a0 00  WA  0   0 32
  [30] .bss              NOBITS          00000000019476a0 17476a0 049488 00  WA  0   0 32
  [31] .comment          PROGBITS        0000000000000000 17476a0 000034 01  MS  0   0  1
  [32] .debug_aranges    PROGBITS        0000000000000000 17476d4 0522e0 00      0   0  1
  [33] .debug_info       PROGBITS        0000000000000000 17999b4 8a51c97 00      0   0  1
  [34] .debug_abbrev     PROGBITS        0000000000000000 a1eb64b 26caef 00      0   0  1
  [35] .debug_line       PROGBITS        0000000000000000 a45813a 73edbc 00      0   0  1
  [36] .debug_str        PROGBITS        0000000000000000 ab96ef6 167f612 01  MS  0   0  1
  [37] .debug_loc        PROGBITS        0000000000000000 c216508 3637e5c 00      0   0  1
  [38] .debug_ranges     PROGBITS        0000000000000000 f84e364 db9320 00      0   0  1
  [39] .shstrtab         STRTAB          0000000000000000 109e9073 00019b 00      0   0  1
  [40] .symtab           SYMTAB          0000000000000000 10607688 118440 18     41 10634  8
  [41] .strtab           STRTAB          0000000000000000 1071fac8 2c95ab 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

File: mongod
There are 42 section headers, starting at offset 0x289ea958:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000000000270 000270 00001c 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            000000000000028c 00028c 000020 00   A  0   0  4
  [ 3] .note.gnu.build-id NOTE            00000000000002ac 0002ac 000024 00   A  0   0  4
  [ 4] .gnu.hash         GNU_HASH        00000000000002d0 0002d0 06ace4 00   A  5   0  8
  [ 5] .dynsym           DYNSYM          000000000006afb8 06afb8 165780 18   A  6   3  8
  [ 6] .dynstr           STRTAB          00000000001d0738 1d0738 3ee7da 00   A  0   0  1
  [ 7] .gnu.version      VERSYM          00000000005bef12 5bef12 01dca0 02   A  5   0  2
  [ 8] .gnu.version_r    VERNEED         00000000005dcbb8 5dcbb8 000300 00   A  6   9  8
  [ 9] .rela.dyn         RELA            00000000005dceb8 5dceb8 1b1fe0 18   A  5   0  8
  [10] .rela.plt         RELA            000000000078ee98 78ee98 000030 18  AI  5  28  8
  [11] .init             PROGBITS        000000000078eec8 78eec8 00001a 00  AX  0   0  4
  [12] .plt              PROGBITS        000000000078eef0 78eef0 000030 10  AX  0   0 16
  [13] .plt.got          PROGBITS        000000000078ef20 78ef20 0016f0 00  AX  0   0  8
  [14] .text             PROGBITS        0000000000790610 790610 17e07a9 00  AX  0   0 16
  [15] google_malloc     PROGBITS        0000000001f70dc0 1f70dc0 00185a 00  AX  0   0 16
  [16] malloc_hook       PROGBITS        0000000001f72620 1f72620 000375 00  AX  0   0 16
  [17] .fini             PROGBITS        0000000001f72998 1f72998 000009 00  AX  0   0  4
  [18] .rodata           PROGBITS        0000000001f729c0 1f729c0 779ec8 00   A  0   0 32
  [19] .eh_frame_hdr     PROGBITS        00000000026ec888 26ec888 065b3c 00   A  0   0  4
  [20] .eh_frame         PROGBITS        00000000027523c8 27523c8 22c824 00   A  0   0  8
  [21] .gcc_except_table PROGBITS        000000000297ebec 297ebec 0b83f6 00   A  0   0  4
  [22] .tbss             NOBITS          0000000002c379d8 2a379d8 000588 00 WAT  0   0  8
  [23] .init_array       INIT_ARRAY      0000000002c379d8 2a379d8 002238 00  WA  0   0  8
  [24] .fini_array       FINI_ARRAY      0000000002c39c10 2a39c10 000008 00  WA  0   0  8
  [25] .jcr              PROGBITS        0000000002c39c18 2a39c18 000008 00  WA  0   0  8
  [26] .data.rel.ro      PROGBITS        0000000002c39c20 2a39c20 0b75d0 00  WA  0   0 32
  [27] .dynamic          DYNAMIC         0000000002cf11f0 2af11f0 000270 10  WA  6   0  8
  [28] .got              PROGBITS        0000000002cf1460 2af1460 001b98 08  WA  0   0  8
  [29] .data             PROGBITS        0000000002cf3000 2af3000 0f46c0 00  WA  0   0 32
  [30] .bss              NOBITS          0000000002de7700 2be76c0 06a520 00  WA  0   0 128
  [31] .comment          PROGBITS        0000000000000000 2be76c0 000034 01  MS  0   0  1
  [32] .debug_aranges    PROGBITS        0000000000000000 2be76f4 0a70a0 00      0   0  1
  [33] .debug_info       PROGBITS        0000000000000000 2c8e794 185c81e4 00      0   0  1
  [34] .debug_abbrev     PROGBITS        0000000000000000 1b256978 6e106d 00      0   0  1
  [35] .debug_line       PROGBITS        0000000000000000 1b9379e5 10daaca 00      0   0  1
  [36] .debug_str        PROGBITS        0000000000000000 1ca124af 2b60e6e 01  MS  0   0  1
  [37] .debug_loc        PROGBITS        0000000000000000 1f57331d 71fd512 00      0   0  1
  [38] .debug_ranges     PROGBITS        0000000000000000 2677082f 1b8b710 00      0   0  1
  [39] .shstrtab         STRTAB          0000000000000000 289ea7b8 00019b 00      0   0  1
  [40] .symtab           SYMTAB          0000000000000000 282fbf40 1ee7a8 18     41 23388  8
  [41] .strtab           STRTAB          0000000000000000 284ea6e8 5000d0 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

File: mongos
There are 42 section headers, starting at offset 0x1357a4d0:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000000000270 000270 00001c 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            000000000000028c 00028c 000020 00   A  0   0  4
  [ 3] .note.gnu.build-id NOTE            00000000000002ac 0002ac 000024 00   A  0   0  4
  [ 4] .gnu.hash         GNU_HASH        00000000000002d0 0002d0 0331a4 00   A  5   0  8
  [ 5] .dynsym           DYNSYM          0000000000033478 033478 0a6d58 18   A  6   3  8
  [ 6] .dynstr           STRTAB          00000000000da1d0 0da1d0 1dd43b 00   A  0   0  1
  [ 7] .gnu.version      VERSYM          00000000002b760c 2b760c 00de72 02   A  5   0  2
  [ 8] .gnu.version_r    VERNEED         00000000002c5480 2c5480 0002d0 00   A  6   9  8
  [ 9] .rela.dyn         RELA            00000000002c5750 2c5750 0a6878 18   A  5   0  8
  [10] .rela.plt         RELA            000000000036bfc8 36bfc8 000030 18  AI  5  28  8
  [11] .init             PROGBITS        000000000036bff8 36bff8 00001a 00  AX  0   0  4
  [12] .plt              PROGBITS        000000000036c020 36c020 000030 10  AX  0   0 16
  [13] .plt.got          PROGBITS        000000000036c050 36c050 001588 00  AX  0   0  8
  [14] .text             PROGBITS        000000000036d5e0 36d5e0 b981b9 00  AX  0   0 16
  [15] google_malloc     PROGBITS        0000000000f057a0 f057a0 00185a 00  AX  0   0 16
  [16] malloc_hook       PROGBITS        0000000000f07000 f07000 000375 00  AX  0   0 16
  [17] .fini             PROGBITS        0000000000f07378 f07378 000009 00  AX  0   0  4
  [18] .rodata           PROGBITS        0000000000f073a0 f073a0 6a8643 00   A  0   0 32
  [19] .eh_frame_hdr     PROGBITS        00000000015af9e4 15af9e4 02e544 00   A  0   0  4
  [20] .eh_frame         PROGBITS        00000000015ddf28 15ddf28 100964 00   A  0   0  8
  [21] .gcc_except_table PROGBITS        00000000016de88c 16de88c 060bc6 00   A  0   0  4
  [22] .tbss             NOBITS          000000000193f808 173f808 000060 00 WAT  0   0  8
  [23] .init_array       INIT_ARRAY      000000000193f808 173f808 001628 00  WA  0   0  8
  [24] .fini_array       FINI_ARRAY      0000000001940e30 1740e30 000008 00  WA  0   0  8
  [25] .jcr              PROGBITS        0000000001940e38 1740e38 000008 00  WA  0   0  8
  [26] .data.rel.ro      PROGBITS        0000000001940e40 1740e40 044900 00  WA  0   0 32
  [27] .dynamic          DYNAMIC         0000000001985740 1785740 000270 10  WA  6   0  8
  [28] .got              PROGBITS        00000000019859b0 17859b0 001648 08  WA  0   0  8
  [29] .data             PROGBITS        0000000001987000 1787000 0f31e0 00  WA  0   0 32
  [30] .bss              NOBITS          0000000001a7a200 187a1e0 0527a8 00  WA  0   0 128
  [31] .comment          PROGBITS        0000000000000000 187a1e0 000034 01  MS  0   0  1
  [32] .debug_aranges    PROGBITS        0000000000000000 187a214 051fc0 00      0   0  1
  [33] .debug_info       PROGBITS        0000000000000000 18cc1d4 ad158e6 00      0   0  1
  [34] .debug_abbrev     PROGBITS        0000000000000000 c5e1aba 41ba15 00      0   0  1
  [35] .debug_line       PROGBITS        0000000000000000 c9fd4cf 8a52c4 00      0   0  1
  [36] .debug_str        PROGBITS        0000000000000000 d2a2793 184df8a 01  MS  0   0  1
  [37] .debug_loc        PROGBITS        0000000000000000 eaf071d 39e5a1f 00      0   0  1
  [38] .debug_ranges     PROGBITS        0000000000000000 124d613c d30570 00      0   0  1
  [39] .shstrtab         STRTAB          0000000000000000 1357a32e 00019b 00      0   0  1
  [40] .symtab           SYMTAB          0000000000000000 132066b0 0f9fc0 18     41 14196  8
  [41] .strtab           STRTAB          0000000000000000 13300670 279cbe 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Comment 5 andrew.c.morrow 2016-12-31 23:38:21 UTC
Having read the -WS output, I'm now very curious about the .tbss section.

Comment 6 Jakub Jelinek 2017-01-01 00:07:59 UTC
Well, if this is from Ubuntu toolchain, why are you filing it here?
ld.bfd has been broken for a year and half, fixed only in August last year:
https://sourceware.org/ml/binutils/2016-08/msg00120.html
Can you attach the mongod binary?  I don't see any obvious A section after non-A one, perhaps it has bogus Ehdr placement or something similar.

Comment 7 andrew.c.morrow 2017-01-01 16:46:57 UTC
(In reply to Jakub Jelinek from comment #6)
> Well, if this is from Ubuntu toolchain, why are you filing it here?

I can reproduce this issue running dwz HEAD on RHEL 7.0, using binaries built with GCC 5.4.0 and binutils 2.26, built from source.

So, it isn't an Ubuntu specific toolchain issue.


> ld.bfd has been broken for a year and half, fixed only in August last year:
> https://sourceware.org/ml/binutils/2016-08/msg00120.html

That is interesting, but if I'm reading it correctly, the ELF standard doesn't require that change - the change was applied so that dwz (or similar tools) would work, or be simpler to implement. But dwz seems to have problems with the binaries produced by both ld.bfd and ld.gold, so whatever is tripping it up isn't just an idiosyncrasy of ld.bfd.

I haven't tried ld.gold or ld.bfd from binutils 2.27 yet, but I will do so soon. It would be interesting to know how lld output behaved as well, I will try to run that experiment soon too.


> Can you attach the mongod binary?

It is 490MB with debug symbols, 175MB gzipped. Does this bugzilla instance allow large attachments?


  I don't see any obvious A section after
> non-A one, perhaps it has bogus Ehdr placement or something similar.

I applied the following diff to dwz.c so that I can see what section is tripping it up:

diff --git a/dwz.c b/dwz.c
index b3b779d..366fd5b 100644
--- a/dwz.c
+++ b/dwz.c
@@ -10138,13 +10138,15 @@ write_dso (DSO *dso, const char *file, struct stat *st)
          GElf_Off last_shoff = 0;
          int k = -1;
          bool shdr_placed = false;
-         for (j = 1; j < dso->ehdr.e_shnum; ++j)
+         for (j = 1; j < dso->ehdr.e_shnum; ++j) {
+            const char *name = strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[j].sh_name);
+
            if (dso->shdr[j].sh_offset < min_shoff && !last_shoff)
              continue;
            else if ((dso->shdr[j].sh_flags & SHF_ALLOC) != 0)
              {
-               error (0, 0, "Allocatable section in %s after non-allocatable "
-                            "ones", dso->filename);
+               error (0, 0, "Allocatable section %s in %s after non-allocatable "
+                            "ones", name, dso->filename);
                return 1;
              }
            else if (dso->shdr[j].sh_offset < last_shoff)
@@ -10159,6 +10161,7 @@ write_dso (DSO *dso, const char *file, struct stat *st)
                  k = j;
                last_shoff = dso->shdr[j].sh_offset + dso->shdr[j].sh_size;
              }
+          }
          last_shoff = min_shoff;
          for (j = k; j <= dso->ehdr.e_shnum; ++j)
            {

The result of running against the ld.gold build of mongod is now:

../dwz/dwz: Allocatable section .bss in ./mongos after non-allocatable ones

Running under the debugger and looking at some relevant variables seems to show that the sh_offset for .bss is suspicious:

(gdb) print min_shoff
$1 = 27018095
(gdb) print last_shoff
$2 = 0
(gdb) print dso->shdr[j].sh_offset
$3 = 18446744073652314806
(gdb) call strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[j].sh_name)
$6 = 0x7ffff75ed247 ".bss"

Comment 8 Mark Wielaard 2017-02-08 13:58:59 UTC
(In reply to andrew.c.morrow from comment #7)
> (In reply to Jakub Jelinek from comment #6)
> > Can you attach the mongod binary?
> 
> It is 490MB with debug symbols, 175MB gzipped. Does this bugzilla instance
> allow large attachments?

Could you post the output of [eu-]readelf -hlS? That would be helpful to see the ELF, program and section headers.

> The result of running against the ld.gold build of mongod is now:
> 
> ../dwz/dwz: Allocatable section .bss in ./mongos after non-allocatable ones
> 
> Running under the debugger and looking at some relevant variables seems to
> show that the sh_offset for .bss is suspicious:
> 
> (gdb) print min_shoff
> $1 = 27018095
> (gdb) print last_shoff
> $2 = 0
> (gdb) print dso->shdr[j].sh_offset
> $3 = 18446744073652314806
> (gdb) call strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[j].sh_name)
> $6 = 0x7ffff75ed247 ".bss"

For a NOBITS section like .bss the sh_offset member represents the "locates the conceptual placement in the file". So it should point somewhere in the file where you would normally expect to find the zero filled data (even though the section doesn't actually occupy any space in the file itself).

Comment 9 Fedora End Of Life 2017-02-28 10:41:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 10 Fedora End Of Life 2018-05-03 08:17:43 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 11 Fedora End Of Life 2018-05-29 11:30:01 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.