title: How to strip all local symbol names from executable using Clang in macOS?
body: <blockquote>
    <p>How to strip all local symbol names from executable in macOS?</p>
  </blockquote>
  
  <p>I want to remove all local symbols from my executable, so that <code>nm</code> cannot display any function names defined by the executable etc.</p>
  
  <p>I cannot use the linker <code>-s</code> switch:</p>
  
  <pre><code>$ gcc -fno-stack-protector myprog.c -Wl,-no_pie -Wl,-s -o myprog
  ld: warning: option -s is obsolete and being ignored
  </code></pre>
  
  <p>Using <code>strip -x</code> to remove all local symbols doesn't remove the symbols.</p>
  
  <p>How can I remove all local symbols, so that functions names like <code>_decrypt_username</code> doesn't show up?</p>
  
  <pre><code>$ nm crackme0x0 -extern-only
                   U ___stdinp
                   U ___strncpy_chk
  0000000100000000 A __mh_execute_header
  0000000100001750 T _crash
  0000000100001710 T _decrypt_username
                   U _exit
                   U _fgets
                   U _free
  00000001000018b0 T _get_vault_contents
                   U _getpass
  0000000100002190 D _invalid_password_str
                   U _isxdigit
  0000000100001af0 T _main
                   U _malloc
                   U _printf
                   U _rand
  00000001000013b0 T _rot13
  00000001000021aa D _secret_stored_for_user_str
                   U _sleep
                   U _srand
                   U _strcmp
                   U _strdup
                   U _strlen
                   U _strncmp
                   U _strtol
                   U _time
  00000001000020a0 D _user_vaults
  0000000100001a40 T _validate_password
  0000000100001570 T _xor_with_fixed_key
  0000000100001500 T _xor_with_sliding_byte_key
                   U dyld_stub_binder
  </code></pre>