Skip to content
Snippets Groups Projects
  • Avi Kivity's avatar
    c9e61d4a
    build: link libstdc++, libgcc_s only once · c9e61d4a
    Avi Kivity authored
    Currently we statically link to libstdc++ and libgcc_s, and also dynamically
    link to the same libraries (since the payload requires them).  This causes
    some symbols to be available from both the static and dynamic version.
    
    With the resolution order change introduced by 82513d41, we can
    resolve the same symbol to different addresses at different times.  This
    violates the One Definition Rule, and in fact breaks std::string's
    destructor.
    
    Fix by only linking in the libraries statically.  We use ld's --whole-archive
    flag to bring in all symbols, including those that may be used by the payload
    but not by the kernel.
    
    Some symbols now become duplicates; we drop our version.
    c9e61d4a
    History
    build: link libstdc++, libgcc_s only once
    Avi Kivity authored
    Currently we statically link to libstdc++ and libgcc_s, and also dynamically
    link to the same libraries (since the payload requires them).  This causes
    some symbols to be available from both the static and dynamic version.
    
    With the resolution order change introduced by 82513d41, we can
    resolve the same symbol to different addresses at different times.  This
    violates the One Definition Rule, and in fact breaks std::string's
    destructor.
    
    Fix by only linking in the libraries statically.  We use ld's --whole-archive
    flag to bring in all symbols, including those that may be used by the payload
    but not by the kernel.
    
    Some symbols now become duplicates; we drop our version.