title: Swift: how to fully strip internal/inline symbols?
body: <p>I need to write some license checking code in Swift. I know Swift is not optimal for that kind of code in the first place, as it is harder to obfuscate. But if the code that needs to know whether the app is registered is written in Swift, this is still better than putting the license checking code in a separate framework that can be swapped out.</p>
  
  <p>To make attacking that code harder, I'm trying to obfuscate the code by at least removing the symbols related to it.</p>
  
  <p>For this, I have some inlined methods with internal visibility as follows:</p>
  
  <pre><code>@inline(__always) static func checkLicense() { /* license checking code */ }
  </code></pre>
  
  <p>Given that the method should always be inlined, there should be no need to include the method's name in the binary's symbol table. (I know that <code>inline</code> annotations often only are hints to the compiler, but I have reason to believe that they do work in this case.)</p>
  
  <p>In line with that, <code>nm MyApp.app/Contents/MacOS/MyApp</code> does not contain references to <code>checkLicense</code>.
  However, the output of <code>strings MyApp.app/Contents/MacOS/MyApp</code> still contains references to <code>checkLicense</code>, and I'm afraid that an attacker could use that information to more easily attack the license checking code.</p>
  
  <p>Here are my questions:</p>
  
  <ol>
  <li>Will these strings help an attacker, or are they useless without the corresponding symbol info (which would be exposed by <code>nm</code>)?</li>
  <li>Would the strip settings listed below (in particular, stripping all symbols) cause a problem when shipping my code - e.g. when trying to symbolicate stack traces? I do keep the dSYMs of the shipped binaries.</li>
  <li>Would setting "Perform Single-Object Prelink" to Yes help in obfuscating the code? The only effect I can see is that the dSYMs size shrinks from ~8 MB to ~6 MB.</li>
  </ol>
  
  <p>I am currently using the following build options:</p>
  
  <ul>
  <li>Deployment Postprocessing = Yes</li>
  <li>Strip Linked Product = Yes</li>
  <li>Use Separate Strip = Yes</li>
  <li>Strip Style = All Symbols</li>
  <li>Other Linker Flags = "-Xlinker -x"</li>
  <li>Perform Single-Object Prelink = No (see above)</li>
  </ul>