Index: libcxx/utils/gen_link_script.py =================================================================== --- libcxx/utils/gen_link_script.py +++ libcxx/utils/gen_link_script.py @@ -70,7 +70,7 @@ # Generate the linker script contents and print the script and destination # information. - contents = "INPUT(%s %s)" % (linked_libcxx, ' '.join(public_libs)) + contents = "INPUT(AS_NEEDED(%s %s))" % (linked_libcxx, ' '.join(public_libs)) print("GENERATING SCRIPT: '%s' as file %s" % (contents, symlink_file)) # Remove the existing libc++ symlink and replace it with the script.