How to REALLY strip a binary in MacOs

后端 未结 4 1964
野性不改
野性不改 2021-01-02 08:26

MacOs 10.6, if I have a file \"unwanted.c\" which contains:

class secret_thing {
public:
secret_thing() {}
void revealing_method_name() {}
};

main()
{
    s         


        
4条回答
  •  猫巷女王i
    2021-01-02 09:02

    Using the following compile line I successfully strip the symbols from the executable:

    $ g++ -Xlinker -unexported_symbol -Xlinker "*" -o executable file.cpp
    $ strip executable
    

    Given the latest sample file, this results in:

    $ nm executable
                     U __ZTVN10__cxxabiv117__class_type_infoE
                     U __ZTVN10__cxxabiv120__si_class_type_infoE
                     U __ZdlPv
                     U __Znwm
                     U ___cxa_pure_virtual
                     U ___gxx_personality_v0
    0000000100000000 A __mh_execute_header
                     U _exit
                     U dyld_stub_binder
    

提交回复
热议问题