authorgravatar for jay@jayschwa.netJay Petacat <jay@jayschwa.net> 2019-03-08 00:06:41-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-08 08:46:06-05:00
logcddc77dd97fa222fc72e4b3955eabb18c36c8617
tree0a1f2e2267e9642bc6ba92f72dc992ba094747cf
parent1e634a384ccc0ae57e0343369f7adb0b1b4b9875

Remove glibc compat shim with restrictive license

Unlike the other glibc source code checked into the repo, `csu/init.c` did not have a license clause that allowed linking without restrictions. `_IO_stdin_used` is the only symbol in the file and appears to be a 20 year old compatibility shim for the glibc 2.0 ABI. Obsolete in 2.1.

3 files changed, 0 insertions(+), 49 deletions(-)

CMakeLists.txt-1
......@@ -835,7 +835,6 @@ set(ZIG_LIBC_FILES
835835 "glibc/csu/abi-note.S"
836836 "glibc/csu/abi-tag.h"
837837 "glibc/csu/elf-init.c"
838 "glibc/csu/init.c"
839838 "glibc/debug/stack_chk_fail_local.c"
840839 "glibc/elf/elf.h"
841840 "glibc/include/alloca.h"
libc/glibc/csu/init.c deleted-23
......@@ -1,23 +0,0 @@
1/* Special startup support.
2 Copyright (C) 1997-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19/* Vestigial libio version number. Some code in libio checks whether
20 this symbol exists in the executable, but nothing looks at its
21 value anymore; the value it was historically set to has been
22 preserved out of an abundance of caution. */
23const int _IO_stdin_used = 0x20001;
src/link.cpp-25
......@@ -426,38 +426,13 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
426426 c_file->args.append("-g");
427427 c_file->args.append("-Wa,--noexecstack");
428428 return build_libc_object(parent, "abi-note", c_file);
429 } else if (strcmp(file, "init.o") == 0) {
430 CFile *c_file = allocate<CFile>(1);
431 c_file->source_path = path_from_libc(parent, "glibc" OS_SEP "csu" OS_SEP "init.c");
432 c_file->args.append("-I");
433 c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "csu"));
434 glibc_add_include_dirs(parent, c_file);
435 c_file->args.append("-std=gnu11");
436 c_file->args.append("-fgnu89-inline");
437 c_file->args.append("-g");
438 c_file->args.append("-O2");
439 c_file->args.append("-fmerge-all-constants");
440 c_file->args.append("-fno-stack-protector");
441 c_file->args.append("-fmath-errno");
442 c_file->args.append("-DSTACK_PROTECTOR_LEVEL=0");
443 c_file->args.append("-ftls-model=initial-exec");
444 c_file->args.append("-D_LIBC_REENTRANT");
445 c_file->args.append("-include");
446 c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-modules.h"));
447 c_file->args.append("-DMODULE_NAME=libc");
448 c_file->args.append("-include");
449 c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-symbols.h"));
450 c_file->args.append("-DTOP_NAMESPACE=glibc");
451 return build_libc_object(parent, "init", c_file);
452429 } else if (strcmp(file, "Scrt1.o") == 0) {
453430 const char *start_os = get_libc_crt_file(parent, "start.os");
454431 const char *abi_note_o = get_libc_crt_file(parent, "abi-note.o");
455 const char *init_o = get_libc_crt_file(parent, "init.o");
456432 CodeGen *child_gen = create_child_codegen(parent, nullptr, OutTypeObj, nullptr);
457433 codegen_set_out_name(child_gen, buf_create_from_str("Scrt1"));
458434 codegen_add_object(child_gen, buf_create_from_str(start_os));
459435 codegen_add_object(child_gen, buf_create_from_str(abi_note_o));
460 codegen_add_object(child_gen, buf_create_from_str(init_o));
461436 codegen_build_and_link(child_gen);
462437 return buf_ptr(&child_gen->output_file_path);
463438 } else if (strcmp(file, "libc_nonshared.a") == 0) {