| ... | @@ -426,38 +426,13 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { | ... | @@ -426,38 +426,13 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { |
| 426 | c_file->args.append("-g"); | 426 | c_file->args.append("-g"); |
| 427 | c_file->args.append("-Wa,--noexecstack"); | 427 | c_file->args.append("-Wa,--noexecstack"); |
| 428 | return build_libc_object(parent, "abi-note", c_file); | 428 | 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); | | |
| 452 | } else if (strcmp(file, "Scrt1.o") == 0) { | 429 | } else if (strcmp(file, "Scrt1.o") == 0) { |
| 453 | const char *start_os = get_libc_crt_file(parent, "start.os"); | 430 | const char *start_os = get_libc_crt_file(parent, "start.os"); |
| 454 | const char *abi_note_o = get_libc_crt_file(parent, "abi-note.o"); | 431 | 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"); | | |
| 456 | CodeGen *child_gen = create_child_codegen(parent, nullptr, OutTypeObj, nullptr); | 432 | CodeGen *child_gen = create_child_codegen(parent, nullptr, OutTypeObj, nullptr); |
| 457 | codegen_set_out_name(child_gen, buf_create_from_str("Scrt1")); | 433 | codegen_set_out_name(child_gen, buf_create_from_str("Scrt1")); |
| 458 | codegen_add_object(child_gen, buf_create_from_str(start_os)); | 434 | codegen_add_object(child_gen, buf_create_from_str(start_os)); |
| 459 | codegen_add_object(child_gen, buf_create_from_str(abi_note_o)); | 435 | codegen_add_object(child_gen, buf_create_from_str(abi_note_o)); |
| 460 | codegen_add_object(child_gen, buf_create_from_str(init_o)); | | |
| 461 | codegen_build_and_link(child_gen); | 436 | codegen_build_and_link(child_gen); |
| 462 | return buf_ptr(&child_gen->output_file_path); | 437 | return buf_ptr(&child_gen->output_file_path); |
| 463 | } else if (strcmp(file, "libc_nonshared.a") == 0) { | 438 | } else if (strcmp(file, "libc_nonshared.a") == 0) { |