Bug 460 - g++ using gnu ld followed by /usr/ccs/bin/strip yields bad binary
Summary: g++ using gnu ld followed by /usr/ccs/bin/strip yields bad binary
Status: RESOLVED OBSOLETE
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.15
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-19 04:10 UTC by Greg Hudson
Modified: 2019-11-21 23:32 UTC (History)
1 user (show)

See Also:
Host: sparc-sun-solaris2.9
Target: sparc-sun-solaris2.9
Build: sparc-sun-solaris2.9
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Hudson 2004-10-19 04:10:50 UTC
On Solaris 9 with an up-to-date patch 112936-16 (also confirmed with 112936-12),
running:

  g++ hello.c               # Using gnu ld from binutils-2.15
  /usr/ccs/bin/strip a.out
  ./a.out

produces a bus error.  hello.c is:

  #include <stdio.h>

  int main()
  {
      printf("Hello, world.\n");
  }

The version of gcc does not appear very important; I confirmed the bug with
3.3.2 and 3.4.2.

The bug still manifests if I use gnu ld from the binutils trunk.

The bug does NOT manifest if I use the vendor ld, or gnu ld from binutils 2.14
or binutils 2.11.2.  It also does not manifest if I use strip from binutils
instead of /usr/ccs/bin/strip, or if I link with gcc instead of with g++.
Comment 1 Greg Hudson 2004-12-22 00:36:12 UTC
A binary search on the CVS repository pins the introduction of this problem on
the changes made on July 25, 2003, specifically the commit from H.J. Lu to add
special sections.  Rev 1.192 of bfd/elf.c is one of the revisions associated
with the commit.
Comment 2 Alan Modra 2004-12-22 05:02:55 UTC
Unless you can show that GNU ld is doing something wrong here, I would guess
that most people reading this will decide that /usr/ccs/bin/strip is buggy, and
ignore your bug report.
Comment 3 Greg Hudson 2004-12-22 05:08:30 UTC
Regardless of whether the bogus behavior is in Solaris strip or gnu ld, it's the
responsibility of gnu binutils to work with (at least the latest version of) the
vendor tools.  If gnu ld produced executables which did not run on Solaris due
to a bug in Solaris's dynamic loader or C libraries, it would still be important
to fix it.  Obviously, a bad interaction with "strip" is not as severe as that
would be, but it's in the same category of problem.
Comment 4 Alan Modra 2019-11-21 23:32:46 UTC
Either this is already fixed, or won't ever be fixed since it appears no one using solaris could be bothered to contibute a fix in 15 year.