Skip to content

stripped 8.out crashes #261

Closed
Closed

Description

@gopherbot

by wjosephson:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Build any go program, e.g. hello world
2. Strip it, with or with out strip -d
3. Run it and watch it commit suicide

What is the expected output? What do you see instead?
$ strip -d hello
BFD: hello: warning: Empty loadable segment detected, is this intentional ?

$ ./hello 
SIGSEGV: segmentation violation
Faulting address: 0x99000000
PC=0x3b

Segmentation fault: 11 (core dumped)


What is your $GOOS?  $GOARCH?

FreeBSD/386

Which revision are you sync'ed to?  (hg log -l 1)

changeset:   4134:3c97caf16ae0

Please provide any additional information below.

Strip probably doesn't need to work, but it shouldn't
cause the binary to shoot itself in the head.

Activity

  1. dhobsd commented on Nov 19, 2009

    @dhobsd
    Contributor

    Comment 1:

    Changed since recent changes, but still fails (same on i386, but this is an issue on
    amd64 too):
    > strip -d 6.out
    BFD: 6.out: warning: Empty loadable segment detected, is this intentional ?
    BFD: stE2SbKS: warning: allocated section `.interp' not in segment
    > ./6.out
    ELF interpreter ^?ELF^B^A^A      not found
    Abort
    Does this happen on Linux?
  2. rsc commented on Nov 19, 2009

    @rsc
    Contributor

    Comment 2:

    This is a known issue.  If you strip the binary you throw
    away the runtime symbol information that gets used for
    stack traces and some aspects of reflection.  Don't do that.  ;-)
    We plan to move that data into a rodata segment and then
    strip will not break the binary but will also not remove
    very much.

    Status changed to LongTerm.

  3. gopherbot commented on Nov 19, 2009

    @gopherbot
    ContributorAuthor

    Comment 3 by wjosephson:

    Well, yes.  I bumped into an install -s under FreeBSD.
  4. dhobsd commented on Nov 20, 2009

    @dhobsd
    Contributor

    Comment 4:

    Where do the runtime symbols get stored? Everywhere that I'm seeing right now implies
    that they're either in .hash or .gosymtab which would suggest that if those sections
    are read-only, they shouldn't get tossed by strip. But they are:
    > objdump -hrt ../gofmt/gofmt 
    ../gofmt/gofmt:     file format elf64-x86-64
    Sections:
    Idx Name          Size      VMA               LMA               File off  Algn
      0 .interp       00000015  00000000004007eb  00000000004007eb  000007eb  2**0
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      1 .got          00000000  0000000000446678  0000000000446678  00046678  2**3
                      CONTENTS, ALLOC, LOAD, DATA
      2 .got.plt      00000000  0000000000446d48  0000000000446d48  00046d48  2**3
                      CONTENTS, ALLOC, LOAD, DATA
      3 .dynsym       00000018  0000000000464a28  0000000000464a28  00064a28  2**3
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      4 .dynstr       00000004  0000000000446470  0000000000446470  00046470  2**0
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      5 .hash         00000010  0000000000492ae0  0000000000492ae0  00092ae0  2**3
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      6 .rela         00000000  00000000004472d8  00000000004472d8  000472d8  2**3
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      7 .dynamic      00000090  0000000000482e48  0000000000482e48  00082e48  2**3
                      CONTENTS, ALLOC, LOAD, DATA
      8 .text         00044f26  0000000000400800  0000000000400800  00000800  2**3
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      9 .data         00060748  0000000000446000  0000000000446000  00046000  2**3
                      CONTENTS, ALLOC, LOAD, DATA
     10 .bss          002145d0  00000000004a6748  00000000004a6748  000a6748  2**3
                      ALLOC
     11 .gosymtab     0007664f  0000000000000000  0000000000000000  000a7008  2**0
                      CONTENTS, READONLY
     12 .gopclntab    000057e6  0000000000000000  0000000000000000  0011d657  2**0
                      CONTENTS, READONLY
    SYMBOL TABLE:
    no symbols
  5. rsc commented on Apr 28, 2010

    @rsc
    Contributor

    Comment 5:

    This issue was closed by revision 000ab98.

    Status changed to Fixed.

  6. locked and limited conversation to collaborators on Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions