Hi tech@

http://www.openbsd.org/faq/ports/guide.html still suggests that file(1)
can be used to determine whether a file was stripped or not:

> Install the application with make fake. Libraries should never be
> stripped. Executables are stripped by default; this is governed by
> ${INSTALL_STRIP}. ${INSTALL_PROGRAM} honors this automatically and is
> preferable to unconditional stripping (e.g., by an install-strip
> target or by running strip from the Makefile). You can use file(1) to
> determine if a binary is stripped or not.

This is no longer true after the recent file(1) rewrite.

$ ls -alh camcell*
-rwxr-xr-x  1 mulander  mulander   127K Nov 10 20:43 camcell
-rwxr-xr-x  1 mulander  mulander  47.3K Nov 10 21:04 camcell_stripped
$ file camcell*                
camcell:          ELF 64-bit LSB shared object, x86-64, version 1
camcell_stripped: ELF 64-bit LSB shared object, x86-64, version 1

I first wanted to write a patch for the docs to point to objdump(1)
with --syms flag but saw it stating:

>       --syms
>           Print the symbol table entries of the file.  This is similar
>           to the information provided by the nm program.

So I tried nm(1) but unfortunately even though a stripped binary on
Linux reports with nm(1):

mulander@inferno:~$ nm camcell_openbsd_stripped 
nm: camcell_openbsd_stripped: no symbols

On OpenBSD it still provides a lot of debugging symbols from shared
libs (as expected).

Hence I rewrote the docs to use objdump(1) with the --syms flag which
reports if the provided input binary was stripped of symbols like
initially intended.

Regards,
Adam Wolk

Index: guide.html
===================================================================
RCS file: /cvs/www/faq/ports/guide.html,v
retrieving revision 1.38
diff -u -p -r1.38 guide.html
--- guide.html  30 Jul 2015 10:56:41 -0000      1.38
+++ guide.html  10 Nov 2015 20:11:44 -0000
@@ -464,7 +464,8 @@ this is governed by <tt>${INSTALL_STRIP}
 <tt>${INSTALL_PROGRAM}</tt> honors this automatically and is preferable to
 unconditional stripping (e.g., by an <tt>install-strip</tt> target or by
 running <tt>strip</tt> from the <tt>Makefile</tt>).
-You can use file(1) to determine if a binary is stripped or not.
+You can use objdump(1) --syms to determine if a binary is stripped or not.
+Stripped files have no symbols in the <tt>SYMBOL TABLE</tt>.
 
 <br><br><li>
 <b>Check port for security holes again</b>. This is

Reply via email to