Skip to content

Commit 1a4a943

Browse files
committed
Avoid implicitly linking with -lrt and -latomic when using -nodefaultlibs or -nostdlib
1 parent 7a583dd commit 1a4a943

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

tools/gcc-wrapper/main.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,12 +1637,13 @@ int main(int argc, char* argv[], char* envp[]) {
16371637
args[offset++] = (char*) GCC_OPT_LIBDIR;
16381638
args[offset++] = sysroot_library_directory;
16391639

1640-
if (wants_librt) {
1641-
args[offset++] = (char*) GCC_OPT_L_RT;
1642-
}
1643-
16441640
#if defined(OBGGCC)
1645-
if (require_atomic_library) {
1641+
if (wants_librt && !nodefaultlibs) {
1642+
args[offset++] = (char*) GCC_OPT_L_RT;
1643+
}
1644+
1645+
/* TODO: apply this patch instead: https://gitlab.alpinelinux.org/alpine/aports/-/blob/4d8f399a49555dae872efd56251c066d21f428a0/main/gcc/0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch */
1646+
if (require_atomic_library && !nodefaultlibs) {
16461647
args[offset++] = (char*) GCC_OPT_L_ATOMIC;
16471648
}
16481649
#endif

0 commit comments

Comments
 (0)