[Bug 225890] [mips] GNU 'strip' corrupts static libraries

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Feb 14 13:48:06 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225890

            Bug ID: 225890
           Summary: [mips] GNU 'strip' corrupts static libraries
           Product: Base System
           Version: 11.1-STABLE
          Hardware: amd64
               URL: http://bpaste.net/show/8y6wgjoHTK5tpa6qOfwN/
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: kpect at protonmail.com
                CC: Jungleboogie0 at gmail.com, bapt at FreeBSD.org,
                    daniel.engberg.lists at pyret.net, dim at FreeBSD.org,
                    emaste at freebsd.org, garga at FreeBSD.org,
                    gnn at FreeBSD.org, kpect at protonmail.com,
                    lidl at FreeBSD.org, na at rtfm.net, pi at FreeBSD.org,
                    sbruno at FreeBSD.org, sson at freebsd.org,
                    theraven at FreeBSD.org

+++ This bug was initially created as a clone of Bug #191587 +++

the issue is similar to Bug #191587, 'strip' removes not requested sections

$ echo 'int fun(int x){return x+42;}' > misc.c && cc -c misc.c && ar -rc misc.a
misc.o && cp misc.a misc2.a
$ strip -R .comment misc.a
$ ranlib misc.a
ranlib: warning: can't find .strtab section
$ readelf -e misc.a

File: misc.a(misc.o)
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            FreeBSD
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           Advanced Micro Devices x86-64
  Version:                           0x1
  Entry point address:               0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          192 (bytes into file)
  Flags:                             0
  Size of this header:               64 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           64 (bytes)
  Number of section headers:         6
  Section header string table index: 5

There are no program headers in this file.
There are 6 section headers, starting at offset 0xc0:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .text             PROGBITS         0000000000000000  00000040
       0000000000000011  0000000000000000  AX       0     0     16
  [ 2] .note.GNU-stack   PROGBITS         0000000000000000  00000051
       0000000000000000  0000000000000000           0     0     1
  [ 3] .eh_frame         X86_64_UNWIND    0000000000000000  00000058
       0000000000000038  0000000000000000   A       0     0     8
  [ 4] .rela.eh_frame    RELA             0000000000000000  00000090
       0000000000000000  0000000000000018   I       0     3     8
  [ 5] .shstrtab         STRTAB           0000000000000000  00000090
       0000000000000030  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)
$ readelf --string-dump .strtab misc.a

File: misc.a(misc.o)

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list