diff --git a/lib/libc/glibc/io/fstat-2.32.c b/lib/libc/glibc/io/fstat-2.32.c new file mode 100644 index 0000000000..6ce077dc4a --- /dev/null +++ b/lib/libc/glibc/io/fstat-2.32.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstat +#undef __fstat +int +attribute_hidden +__fstat (int fd, struct stat *buf) +{ + return __fxstat (_STAT_VER, fd, buf); +} + +weak_hidden_alias (__fstat, fstat) diff --git a/lib/libc/glibc/io/fstat64-2.32.c b/lib/libc/glibc/io/fstat64-2.32.c new file mode 100644 index 0000000000..c4dd3acd60 --- /dev/null +++ b/lib/libc/glibc/io/fstat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstat64 +int +attribute_hidden +fstat64 (int fd, struct stat64 *buf) +{ + return __fxstat64 (_STAT_VER, fd, buf); +} diff --git a/lib/libc/glibc/io/fstatat-2.32.c b/lib/libc/glibc/io/fstatat-2.32.c new file mode 100644 index 0000000000..edc773487a --- /dev/null +++ b/lib/libc/glibc/io/fstatat-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2005-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstatat +int +attribute_hidden +fstatat (int fd, const char *file, struct stat *buf, int flag) +{ + return __fxstatat (_STAT_VER, fd, file, buf, flag); +} diff --git a/lib/libc/glibc/io/fstatat64-2.32.c b/lib/libc/glibc/io/fstatat64-2.32.c new file mode 100644 index 0000000000..b57133bd90 --- /dev/null +++ b/lib/libc/glibc/io/fstatat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2005-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef fstatat64 +int +attribute_hidden +fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) +{ + return __fxstatat64 (_STAT_VER, fd, file, buf, flag); +} diff --git a/lib/libc/glibc/io/lstat-2.32.c b/lib/libc/glibc/io/lstat-2.32.c new file mode 100644 index 0000000000..7134741106 --- /dev/null +++ b/lib/libc/glibc/io/lstat-2.32.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef lstat +#undef __lstat +int +attribute_hidden +__lstat (const char *file, struct stat *buf) +{ + return __lxstat (_STAT_VER, file, buf); +} + +weak_hidden_alias (__lstat, lstat) diff --git a/lib/libc/glibc/io/lstat64-2.32.c b/lib/libc/glibc/io/lstat64-2.32.c new file mode 100644 index 0000000000..a890da71a8 --- /dev/null +++ b/lib/libc/glibc/io/lstat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef lstat64 +int +attribute_hidden +lstat64 (const char *file, struct stat64 *buf) +{ + return __lxstat64 (_STAT_VER, file, buf); +} diff --git a/lib/libc/glibc/io/mknod-2.32.c b/lib/libc/glibc/io/mknod-2.32.c new file mode 100644 index 0000000000..ac96829230 --- /dev/null +++ b/lib/libc/glibc/io/mknod-2.32.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1995-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + + +#include +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +int +attribute_hidden +__mknod (const char *path, mode_t mode, dev_t dev) +{ + return __xmknod (_MKNOD_VER, path, mode, &dev); +} + +weak_hidden_alias (__mknod, mknod) diff --git a/lib/libc/glibc/io/mknodat-2.32.c b/lib/libc/glibc/io/mknodat-2.32.c new file mode 100644 index 0000000000..65c9f1aa9c --- /dev/null +++ b/lib/libc/glibc/io/mknodat-2.32.c @@ -0,0 +1,53 @@ +/* Copyright (C) 1995-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + + +#include +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +int +attribute_hidden +mknodat (int fd, const char *path, mode_t mode, dev_t dev) +{ + return __xmknodat (_MKNOD_VER, fd, path, mode, &dev); +} diff --git a/lib/libc/glibc/io/stat-2.32.c b/lib/libc/glibc/io/stat-2.32.c new file mode 100644 index 0000000000..8c3cd877c8 --- /dev/null +++ b/lib/libc/glibc/io/stat-2.32.c @@ -0,0 +1,54 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef stat +int +attribute_hidden +__stat (const char *file, struct stat *buf) +{ + return __xstat (_STAT_VER, file, buf); +} + +weak_hidden_alias (__stat, stat) diff --git a/lib/libc/glibc/io/stat64-2.32.c b/lib/libc/glibc/io/stat64-2.32.c new file mode 100644 index 0000000000..8b6b662f3a --- /dev/null +++ b/lib/libc/glibc/io/stat64-2.32.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . The real work is done by the `x' + function which is passed a version number argument. We arrange in the + makefile that when not inlined this function is always statically + linked; that way a dynamically-linked executable always encodes the + version number corresponding to the data structures it uses, so the `x' + functions in the shared library can adapt without needing to recompile + all callers. */ + +#undef stat64 +int +attribute_hidden +stat64 (const char *file, struct stat64 *buf) +{ + return __xstat64 (_STAT_VER, file, buf); +} diff --git a/src/glibc.zig b/src/glibc.zig index 00d76f32fb..d4b6174021 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -172,6 +172,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr const target = comp.root_mod.resolved_target.result; const target_ver = target.os.version_range.linux.glibc; + const nonshared_stat = target_ver.order(.{ .major = 2, .minor = 32, .patch = 0 }) != .gt; const start_old_init_fini = target_ver.order(.{ .major = 2, .minor = 33, .patch = 0 }) != .gt; // In all cases in this function, we add the C compiler flags to @@ -276,54 +277,72 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr }, .libc_nonshared_a => { const s = path.sep_str; - const linux_prefix = lib_libc_glibc ++ - "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux" ++ s; - const Flavor = enum { nonshared, shared }; const Dep = struct { path: []const u8, - flavor: Flavor = .shared, - exclude: bool = false, + include: bool = true, }; const deps = [_]Dep{ + .{ .path = lib_libc_glibc ++ "stdlib" ++ s ++ "atexit.c" }, + .{ .path = lib_libc_glibc ++ "stdlib" ++ s ++ "at_quick_exit.c" }, + .{ .path = lib_libc_glibc ++ "sysdeps" ++ s ++ "pthread" ++ s ++ "pthread_atfork.c" }, + .{ .path = lib_libc_glibc ++ "debug" ++ s ++ "stack_chk_fail_local.c" }, + + // libc_nonshared.a redirected stat functions to xstat until glibc 2.33, + // when they were finally versioned like other symbols. .{ - .path = lib_libc_glibc ++ "stdlib" ++ s ++ "atexit.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "stat-2.32.c", + .include = nonshared_stat, }, .{ - .path = lib_libc_glibc ++ "stdlib" ++ s ++ "at_quick_exit.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "fstat-2.32.c", + .include = nonshared_stat, }, .{ - .path = lib_libc_glibc ++ "sysdeps" ++ s ++ "pthread" ++ s ++ "pthread_atfork.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "lstat-2.32.c", + .include = nonshared_stat, }, .{ - .path = lib_libc_glibc ++ "debug" ++ s ++ "stack_chk_fail_local.c", - .flavor = .nonshared, + .path = lib_libc_glibc ++ "io" ++ s ++ "stat64-2.32.c", + .include = nonshared_stat, }, - .{ .path = lib_libc_glibc ++ "csu" ++ s ++ "errno.c" }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "fstat64-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "lstat64-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "fstatat-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "fstatat64-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "mknodat-2.32.c", + .include = nonshared_stat, + }, + .{ + .path = lib_libc_glibc ++ "io" ++ s ++ "mknod-2.32.c", + .include = nonshared_stat, + }, + + // __libc_start_main used to require statically linked init/fini callbacks + // until glibc 2.34 when they were assimilated into the shared library. .{ .path = lib_libc_glibc ++ "csu" ++ s ++ "elf-init-2.33.c", - .exclude = !start_old_init_fini, + .include = start_old_init_fini, }, - .{ .path = linux_prefix ++ "stat.c" }, - .{ .path = linux_prefix ++ "fstat.c" }, - .{ .path = linux_prefix ++ "lstat.c" }, - .{ .path = linux_prefix ++ "stat64.c" }, - .{ .path = linux_prefix ++ "fstat64.c" }, - .{ .path = linux_prefix ++ "lstat64.c" }, - .{ .path = linux_prefix ++ "fstatat.c" }, - .{ .path = linux_prefix ++ "fstatat64.c" }, - .{ .path = linux_prefix ++ "mknodat.c" }, - .{ .path = lib_libc_glibc ++ "io" ++ s ++ "mknod.c" }, - .{ .path = linux_prefix ++ "stat_t64_cp.c" }, }; var files_buf: [deps.len]Compilation.CSourceFile = undefined; var files_index: usize = 0; for (deps) |dep| { - if (dep.exclude) continue; + if (!dep.include) continue; var args = std.ArrayList([]const u8).init(arena); try args.appendSlice(&[_][]const u8{ @@ -347,13 +366,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr try args.append("-DCAN_USE_REGISTER_ASM_EBP"); } - const shared_def = switch (dep.flavor) { - .nonshared => "-DLIBC_NONSHARED=1", - // glibc passes `-DSHARED` for these. However, empirically if - // we do that here we will see undefined symbols such as `__GI_memcpy`. - // So we pass the same thing as for nonshared. - .shared => "-DLIBC_NONSHARED=1", - }; try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-include", @@ -363,7 +375,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DPIC", - shared_def, + "-DLIBC_NONSHARED=1", "-DTOP_NAMESPACE=glibc", }); files_buf[files_index] = .{