diff --git a/libc/startup/linux/aarch64/start.cpp b/libc/startup/linux/aarch64/start.cpp --- a/libc/startup/linux/aarch64/start.cpp +++ b/libc/startup/linux/aarch64/start.cpp @@ -23,9 +23,6 @@ #include extern "C" int main(int, char **, char **); -// The BFD linker requires a reference to __dso_handle to trigger creating -// a symbol for it when -nostdlib is used.. -extern "C" void *__dso_handle = nullptr; // Source documentation: // https://github.com/ARM-software/abi-aa/tree/main/sysvabi64 diff --git a/libc/startup/linux/riscv64/start.cpp b/libc/startup/linux/riscv64/start.cpp --- a/libc/startup/linux/riscv64/start.cpp +++ b/libc/startup/linux/riscv64/start.cpp @@ -21,9 +21,6 @@ #include extern "C" int main(int, char **, char **); -// The BFD linker requires a reference to __dso_handle to trigger creating -// a symbol for it when -nostdlib is used.. -extern "C" void *__dso_handle = nullptr; namespace __llvm_libc { diff --git a/libc/startup/linux/x86_64/start.cpp b/libc/startup/linux/x86_64/start.cpp --- a/libc/startup/linux/x86_64/start.cpp +++ b/libc/startup/linux/x86_64/start.cpp @@ -22,9 +22,6 @@ #include extern "C" int main(int, char **, char **); -// The BFD linker requires a reference to __dso_handle to trigger creating -// a symbol for it when -nostdlib is used.. -extern "C" void *__dso_handle = nullptr; namespace __llvm_libc { diff --git a/libc/test/IntegrationTest/test.cpp b/libc/test/IntegrationTest/test.cpp --- a/libc/test/IntegrationTest/test.cpp +++ b/libc/test/IntegrationTest/test.cpp @@ -34,4 +34,7 @@ return malloc(s); } +// Integration tests are linked with -nostdlib. BFD linker expects +// __dso_handle when -nostdlib is used. +void *__dso_handle = nullptr; } // extern "C"