Skip to content
  • Thomas Haller's avatar
    build: explicitly whitelist symbols in NetworkManager binary · b171fbc9
    Thomas Haller authored
    - this allows the linker to drop unused symbols via link-time optimization
      or with --gc-sections:
    
        git clean -fdx
        ./autogen.sh --enable-ld-gc --enable-ifcfg-rh --enable-ifupdown \
            --enable-ifnet --enable-ibft --enable-teamdctl --enable-wifi \
            --with-modem-manager-1 --with-ofono --with-more-asserts \
            --with-more-logging
        make -j20
        strip ./src/NetworkManager
    
      gives 2822840 vs. 2625960 bytes (-7%).
    
    - this also gives more control over the symbols that are used by the
      plugins. Yes, it means if you modify a plugin to use a new symbols,
      you have to extend NetworkManager.ver file.
      You can run the script to create the version file:
    
        $ ./tools/create-exports-NetworkManager.sh update
    
      but be sure that your current configuration enables all plugins
      and debugging options to actually use all symbols that are in use.
    
    - If you compile with certain plugins enabled, you could theoretically
      re-compile NetworkManager to expose less symbols. Try:
    
        $ ./tools/create-exports-NetworkManager.sh build
    
    - note that we have `make check` tests to ensure that all used
      symbols of the plugins can be found. So, it should not be possible
      to accidentally forget to expose a symbol.
    b171fbc9