zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit cddc77dd97fa222fc72e4b3955eabb18c36c8617 (tree)
parent 1e634a384ccc0ae57e0343369f7adb0b1b4b9875
Author: Jay Weisskopf <jay@jayschwa.net>
Date:   Fri,  8 Mar 2019 00:06:41 -0500

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.

Diffstat:
MCMakeLists.txt | 1-
Dlibc/glibc/csu/init.c | 23-----------------------
Msrc/link.cpp | 25-------------------------
3 files changed, 0 insertions(+), 49 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -835,7 +835,6 @@ set(ZIG_LIBC_FILES "glibc/csu/abi-note.S" "glibc/csu/abi-tag.h" "glibc/csu/elf-init.c" - "glibc/csu/init.c" "glibc/debug/stack_chk_fail_local.c" "glibc/elf/elf.h" "glibc/include/alloca.h" diff --git a/libc/glibc/csu/init.c b/libc/glibc/csu/init.c @@ -1,23 +0,0 @@ -/* Special startup support. - Copyright (C) 1997-2019 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. - - 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 - <http://www.gnu.org/licenses/>. */ - -/* Vestigial libio version number. Some code in libio checks whether - this symbol exists in the executable, but nothing looks at its - value anymore; the value it was historically set to has been - preserved out of an abundance of caution. */ -const int _IO_stdin_used = 0x20001; diff --git a/src/link.cpp b/src/link.cpp @@ -426,38 +426,13 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { c_file->args.append("-g"); c_file->args.append("-Wa,--noexecstack"); return build_libc_object(parent, "abi-note", c_file); - } else if (strcmp(file, "init.o") == 0) { - CFile *c_file = allocate<CFile>(1); - c_file->source_path = path_from_libc(parent, "glibc" OS_SEP "csu" OS_SEP "init.c"); - c_file->args.append("-I"); - c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "csu")); - glibc_add_include_dirs(parent, c_file); - c_file->args.append("-std=gnu11"); - c_file->args.append("-fgnu89-inline"); - c_file->args.append("-g"); - c_file->args.append("-O2"); - c_file->args.append("-fmerge-all-constants"); - c_file->args.append("-fno-stack-protector"); - c_file->args.append("-fmath-errno"); - c_file->args.append("-DSTACK_PROTECTOR_LEVEL=0"); - c_file->args.append("-ftls-model=initial-exec"); - c_file->args.append("-D_LIBC_REENTRANT"); - c_file->args.append("-include"); - c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-modules.h")); - c_file->args.append("-DMODULE_NAME=libc"); - c_file->args.append("-include"); - c_file->args.append(path_from_libc(parent, "glibc" OS_SEP "include" OS_SEP "libc-symbols.h")); - c_file->args.append("-DTOP_NAMESPACE=glibc"); - return build_libc_object(parent, "init", c_file); } else if (strcmp(file, "Scrt1.o") == 0) { const char *start_os = get_libc_crt_file(parent, "start.os"); const char *abi_note_o = get_libc_crt_file(parent, "abi-note.o"); - const char *init_o = get_libc_crt_file(parent, "init.o"); CodeGen *child_gen = create_child_codegen(parent, nullptr, OutTypeObj, nullptr); codegen_set_out_name(child_gen, buf_create_from_str("Scrt1")); codegen_add_object(child_gen, buf_create_from_str(start_os)); codegen_add_object(child_gen, buf_create_from_str(abi_note_o)); - codegen_add_object(child_gen, buf_create_from_str(init_o)); codegen_build_and_link(child_gen); return buf_ptr(&child_gen->output_file_path); } else if (strcmp(file, "libc_nonshared.a") == 0) {