Skip to content

readelf complains that .note.rustc is malformed #27372

Closed
@saschmit

Description

@saschmit

After building rustc 1.1.0, if I run readelf --section-headers --note over the shared libraries produced, I see output like the following:

$ readelf --section-headers --note x86_64-unknown-linux-gnu/stage2/lib/libarena-e9599659.so
There are 30 section headers, starting at offset 0xef98:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .note.gnu.build-i NOTE             0000000000000200  00000200
       0000000000000024  0000000000000000   A       0     0     4
  [ 2] .gnu.hash         GNU_HASH         0000000000000228  00000228
       0000000000000118  0000000000000000   A       3     0     8
  [ 3] .dynsym           DYNSYM           0000000000000340  00000340
       00000000000003d8  0000000000000018   A       4     2     8
  [ 4] .dynstr           STRTAB           0000000000000718  00000718
       0000000000000687  0000000000000000   A       0     0     1
  [ 5] .gnu.version      VERSYM           0000000000000da0  00000da0
       0000000000000052  0000000000000002   A       3     0     2
  [ 6] .gnu.version_r    VERNEED          0000000000000df8  00000df8
       0000000000000040  0000000000000000   A       4     2     8
  [ 7] .rela.dyn         RELA             0000000000000e38  00000e38
       0000000000000150  0000000000000018   A       3     0     8
  [ 8] .rela.plt         RELA             0000000000000f88  00000f88
       0000000000000150  0000000000000018  AI       3    10     8
  [ 9] .init             PROGBITS         00000000000010d8  000010d8
       000000000000001a  0000000000000000  AX       0     0     4
  [10] .plt              PROGBITS         0000000000001100  00001100
       00000000000000f0  0000000000000010  AX       0     0     16
  [11] .text             PROGBITS         00000000000011f0  000011f0
       00000000000010ac  0000000000000000  AX       0     0     16
  [12] .fini             PROGBITS         000000000000229c  0000229c
       0000000000000009  0000000000000000  AX       0     0     4
  [13] .eh_frame_hdr     PROGBITS         00000000000022a8  000022a8
       00000000000000b4  0000000000000000   A       0     0     4
  [14] .eh_frame         PROGBITS         0000000000002360  00002360
       000000000000033c  0000000000000000   A       0     0     8
  [15] .gcc_except_table PROGBITS         000000000000269c  0000269c
       000000000000028c  0000000000000000   A       0     0     4
  [16] .init_array       INIT_ARRAY       0000000000202db0  00002db0
       0000000000000008  0000000000000000  WA       0     0     8
  [17] .fini_array       FINI_ARRAY       0000000000202db8  00002db8
       0000000000000008  0000000000000000  WA       0     0     8
  [18] .jcr              PROGBITS         0000000000202dc0  00002dc0
       0000000000000008  0000000000000000  WA       0     0     8
  [19] .data.rel.ro      PROGBITS         0000000000202dc8  00002dc8
       0000000000000008  0000000000000000  WA       0     0     8
  [20] .dynamic          DYNAMIC          0000000000202dd0  00002dd0
       00000000000001e0  0000000000000010  WA       4     0     8
  [21] .got              PROGBITS         0000000000202fb0  00002fb0
       0000000000000050  0000000000000008  WA       0     0     8
  [22] .got.plt          PROGBITS         0000000000203000  00003000
       0000000000000088  0000000000000008  WA       0     0     8
  [23] .data             PROGBITS         0000000000203088  00003088
       0000000000000008  0000000000000000  WA       0     0     8
  [24] .note.rustc       NOTE             0000000000203090  00003090
       000000000000ab12  0000000000000000  WA       0     0     16
  [25] .bss              NOBITS           000000000020dba4  0000dba2
       0000000000000004  0000000000000000  WA       0     0     4
  [26] .comment          PROGBITS         0000000000000000  0000dba2
       000000000000002c  0000000000000001  MS       0     0     1
  [27] .shstrtab         STRTAB           0000000000000000  0000dbce
       0000000000000115  0000000000000000           0     0     1
  [28] .symtab           SYMTAB           0000000000000000  0000dce8
       0000000000000978  0000000000000018          29    62     8
  [29] .strtab           STRTAB           0000000000000000  0000e660
       0000000000000938  0000000000000000           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)

Displaying notes found at file offset 0x00000200 with length 0x00000024:
  Owner                 Data size   Description
  GNU                  0x00000014   NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 16a45cac5814e1be056835720bcbd14710fab8eb

Displaying notes found at file offset 0x00003090 with length 0x0000ab12:
  Owner                 Data size   Description
readelf: Warning: note with invalid namesz and/or descsz found at offset 0x0
readelf: Warning:  type: 0x6007bded, namesize: 0x74737572, descsize: 0x02000000

Based on the section list, it appears that the malformed section is .note.rustc

Built using the x86_64 bootstrap rustc:

$ ./x86_64-unknown-linux-gnu/stage0/bin/rustc --version --verbose
rustc 1.1.0-dev (857ef6e27 2015-04-27) (built 2015-04-27)
binary: rustc
commit-hash: 857ef6e272e5634cb9f3e6ee50eb6bc2a2e71651
commit-date: 2015-04-27
build-date: 2015-04-27
host: x86_64-unknown-linux-gnu
release: 1.1.0-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-linuxOperating system: Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions