Bug 196038 - elftoolchain strip(1) -N strips everything from .o file
Summary: elftoolchain strip(1) -N strips everything from .o file
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Blocks: 195561
  Show dependency treegraph
Reported: 2014-12-16 21:32 UTC by Ed Maste
Modified: 2014-12-17 14:47 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2014-12-16 21:32:14 UTC
Binutils "strip -N <symbol> foo.o" strips only <symbol> from the output. Elftoolchain strip strips everything.

% cat foo.c
add1(int a)
        return a + 1;

add2(int a)
        return a + 2;

% cc -g -o foo.o -c foo.c

% strip -N add1 -o foo.bu.o foo.o
% file foo.bu.o
foo.bu.o: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), not stripped
% nm foo.bu.o                  
0000000000000020 T add2

% elftcstrip -N add1 -o foo.elftc.o foo.o
% file foo.elftc.o                                                        
foo.bu.o: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), stripped
% nm foo.elftc.o
nm: foo.elftc.o: no symbols
Comment 1 Ed Maste freebsd_committer 2014-12-16 22:49:17 UTC
Comment 2 commit-hook freebsd_committer 2014-12-17 14:46:53 UTC
A commit references this bug:

Author: emaste
Date: Wed Dec 17 14:46:22 UTC 2014
New revision: 275862
URL: https://svnweb.freebsd.org/changeset/base/275862

  Do not strip all when stripping an explicit symbol

  When requested to strip specific symbols (-N flag) the default should be
  to strip nothing (other than the requested symbols). This is consistent
  with binutils strip(1).

  PR:		196038
  Reviewed by:	imp
  Sponsored by:	The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D1327