title: ARM equivalent of "--exclude-libs ALL"
body: <p>Is there an <a href="http://linux.die.net/man/1/ld" rel="nofollow"><code>ld(1)</code></a> option that provides the equivalent of <code>--exclude-libs ALL</code> on ARM platforms?</p>
  
  <p>I'm trying to reduce the size of a shared object on Android, but <code>--exclude-libs ALL</code> is only available on x86.</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: here's the reason I ask. Sorry about this extra detail. I was trying to keep the question short. My shared object does <em>not</em> export any Crypto++ symbols, yet 88 are showing up <em>with</em> and <em>without</em> <code>--exclude-libs ALL</code>.</p>
  
  <p>Here are the envars of interest:</p>
  
  <pre><code>$ echo $CXX
  arm-linux-androideabi-g++
  $ echo $ANDROID_STL_INC
  /opt/android-ndk-r9/sources/cxx-stl/stlport/stlport/
  $ echo $ANDROID_SYSROOT
  /opt/android-ndk-r9/platforms/android-9/arch-arm
  </code></pre>
  
  <p>First, build my shared object <em>without</em> <code>--exclude-libs ALL</code>:</p>
  
  <pre><code>$ $CXX -fPIC -Os -I/usr/local/cryptopp-android-9/include -I$ANDROID_STL_INC
      --sysroot=$ANDROID_SYSROOT com_deltoid_androidprng_PRNG.cpp
      -o libprng.so -shared
  </code></pre>
  
  <p>And then count the number of Crypto++ exports:</p>
  
  <pre><code>$ arm-linux-androideabi-nm --defined-only libprng.so | grep -i cryptopp | wc -l
        88
  </code></pre>
  
  <p>Second, same experiment <em>with</em> <code>--exclude-libs ALL</code>:</p>
  
  <pre><code>$ $CXX -fPIC -Os -I/usr/local/cryptopp-android-9/include -I$ANDROID_STL_INC
      --sysroot=$ANDROID_SYSROOT com_deltoid_androidprng_PRNG.cpp
      -o libprng.so -shared -Wl,--exclude-libs,ALL
  </code></pre>
  
  <p>And then count the number of Crypto++ exports:</p>
  
  <pre><code>$ arm-linux-androideabi-nm --defined-only libprng.so | grep -i cryptopp | wc -l
        88
  </code></pre>
  
  <p>In both cases, 88 Crypto++ symbols are being exported. The source file is below, an it does not export any Crypto++ symbols.</p>
  
  <hr>
  
  <pre><code>#include &lt;string.h&gt;
  #include &lt;jni.h&gt;
  
  #include &lt;cryptopp/osrng.h&gt;
  using CryptoPP::AutoSeededRandomPool;
  
  #include "com_deltoid_androidprng_PRNG.h"
  
  static AutoSeededRandomPool&amp; GetPRNG()
  {
      static AutoSeededRandomPool prng;
  
      return prng;
  }
  
  static int IncorporateSensors()
  {
      return 0;
  }
  
  /*
   * Class:     com_deltoid_androidprng_PRNG
   * Method:    CryptoPP_Reseed
   * Signature: ([B)I
   */
  jint JNICALL Java_com_deltoid_androidprng_PRNG_CryptoPP_1Reseed
    (JNIEnv* env, jclass, jbyteArray seed)
  {
      int ret, consumed = 0;
  
      try
      {
          AutoSeededRandomPool&amp; prng = GetPRNG();
  
          if(env)
          {   
              jbyte* bytes = env-&gt;GetByteArrayElements(seed, 0);
              jint length = env-&gt;GetArrayLength(seed);
  
              if(bytes)
              {
                  if(length &gt;= 0)
                  {
                      prng.IncorporateEntropy((const byte*)bytes, (size_t)length);
                      consumed += length;
                  }
  
                  env-&gt;ReleaseByteArrayElements(seed, bytes, JNI_ABORT);
              }                   
          }        
      }
      catch(const CryptoPP::Exception&amp; ex)
      {
      }
  
      return consumed;
  }
  
  /*
   * Class:     com_deltoid_androidprng_PRNG
   * Method:    CryptoPP_GetBytes
   * Signature: ([B)I
   */
  JNIEXPORT jint JNICALL Java_com_deltoid_androidprng_PRNG_CryptoPP_1GetBytes
    (JNIEnv *, jclass, jbyteArray)
  {    
  }
  </code></pre>