Skip to content
  • Jo-Philipp Wich's avatar
    build: rework library bundling · 72d751cb
    Jo-Philipp Wich authored
    
    
    Rework the bundle-libraries.sh implementation to use a more robust approach
    for executing host binaries through the shipped ELF loader and libraries.
    
    The previous approach relied on symlinks pointing to a wrapper script which
    caused various issues, especially with multicall binaries as the original
    argv[0] name was not preserved through the ld.so invocation. Another down-
    side was the fact that the actual binaries got moved into another directory
    which caused executables to fail looking up resources with paths relative
    to the executable location.
    
    The new library wrapper implements the following improvements:
    
     - Instead of symlinks pointing to a common wrapper, each ELF executable
       is now replaced by a unqiue shell script which retains the original
       program name getting called
    
     - Instead of letting ld.so invoke the ELF executable directly, launch
       the final ELF binary through a helper program which fixes up the argv[0]
       argument for the target program
    
     - Support sharing a common location for the bundled libraries instead of
       having one copy in each directory containing wrapped binaries
    
    Finally modify the SDK build to wrap the staging_dir and toolchain binaries
    which allows to use the SDK on systems with a different glibc version.
    
    Signed-off-by: default avatarJo-Philipp Wich <jo@mein.io>
    72d751cb