Binutils "strip -N <symbol> foo.o" strips only <symbol> from the output. Elftoolchain strip strips everything. % cat foo.c int add1(int a) { return a + 1; } int 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
https://reviews.freebsd.org/D1327
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 Log: 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 Changes: head/contrib/elftoolchain/elfcopy/main.c