├── .github └── workflows │ └── build.yml ├── .gitignore ├── README.md ├── build.py ├── elf.h ├── header.h ├── helpers.h ├── ido ├── 5.3 │ ├── LICENSE.md │ ├── lib │ │ ├── libmalloc.so │ │ ├── libmalloc_old.so │ │ └── rld │ └── usr │ │ ├── bin │ │ └── cc │ │ └── lib │ │ ├── acpp │ │ ├── as0 │ │ ├── as1 │ │ ├── cfe │ │ ├── copt │ │ ├── crt1.o │ │ ├── err.english.cc │ │ ├── libc.so.1 │ │ ├── libexc.so │ │ ├── libgen.so │ │ ├── libm.so │ │ ├── ugen │ │ ├── ujoin │ │ ├── uld │ │ ├── umerge │ │ ├── uopt │ │ └── usplit └── 7.1 │ ├── lib │ ├── cpp │ ├── libc.so.1 │ ├── libmalloc.so │ └── rld │ └── usr │ ├── bin │ └── cc │ └── lib │ ├── as1 │ ├── cfe │ ├── err.english.cc │ ├── libc.so.1 │ ├── libexc.so │ ├── libm.so │ ├── ugen │ ├── umerge │ └── uopt ├── libc_impl.c ├── libc_impl.h ├── recomp.cpp └── skeleton.c /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Recompile ido and publish releases 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | os: [ubuntu-latest, macos-latest] 12 | ido: [5.3, 7.1] 13 | 14 | name: Recompiling ido ${{ matrix.ido }} for ${{ matrix.os }} 15 | steps: 16 | - uses: actions/checkout@v2 17 | 18 | - name: Install dependencies (Ubuntu) 19 | shell: bash 20 | if: matrix.os == 'ubuntu-latest' 21 | run: | 22 | sudo apt-get update 23 | sudo apt-get install -y build-essential bison file gperf libcapstone-dev python3 24 | - name: Install dependencies (MacOS) 25 | shell: bash 26 | if: matrix.os == 'macos-latest' 27 | run: | 28 | brew install capstone 29 | 30 | - name: Run the build script 31 | shell: bash 32 | run: | 33 | python3 build.py ido/${{ matrix.ido }} -O2 34 | - name: Create release archive 35 | shell: bash 36 | run: | 37 | cd build${{ matrix.ido }}/out 38 | tar -czvf ../../ido-${{ matrix.ido }}-recomp-${{ matrix.os }}.tar.gz * 39 | - name: Upload archive 40 | uses: actions/upload-artifact@v2 41 | with: 42 | name: ido-${{ matrix.ido }}-recomp-${{ matrix.os }} 43 | path: | 44 | ido-${{ matrix.ido }}-recomp-${{ matrix.os }}.tar.gz 45 | - name: Update release 46 | uses: johnwbyrd/update-release@v1.0.0 47 | if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/per-function' }} 48 | with: 49 | token: ${{ secrets.GITHUB_TOKEN }} 50 | files: ido-${{ matrix.ido }}-recomp-${{ matrix.os }}.tar.gz 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | build5.3/ 3 | build7.1/ 4 | .vscode/ 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Static recomp of IRIX programs 2 | 3 | Example for compiling `as1`: 4 | 5 | ``` 6 | 1. g++ recomp.cpp -o recomp -g -lcapstone 7 | 2. ./recomp ~/ido7.1_compiler/usr/lib/as1 > as1_c.c 8 | 3. gcc libc_impl.c as1_c.c -o as1 -g -fno-strict-aliasing -lm -no-pie -DIDO71 9 | ``` 10 | 11 | Use the same approach for `cc`, `cfe`, `uopt`, `ugen`, `as1` (and `copt` if you need that). 12 | 13 | Use `-DIDO53` instead of `-DIDO71` if the program you are trying to recompile was compiled with IDO 5.3 rather than IDO 7.1. 14 | 15 | You can add `-O2` to step 3. To compile ugen for IDO 5.3, add `-Dugen53` to step 1, which makes it more conservative due to ugen53 reads uninitialized stack memory and the result depends on that. 16 | -------------------------------------------------------------------------------- /build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse 3 | import subprocess 4 | import os 5 | import sys 6 | import re 7 | import platform 8 | import threading 9 | import shutil 10 | 11 | BINS = { 12 | "5.3": [ 13 | "/usr/bin/cc", 14 | "/usr/lib/acpp", 15 | "/usr/lib/as0", 16 | "/usr/lib/as1", 17 | "/usr/lib/cfe", 18 | "/usr/lib/copt", 19 | "/usr/lib/ugen", 20 | "/usr/lib/ujoin", 21 | "/usr/lib/uld", 22 | "/usr/lib/umerge", 23 | "/usr/lib/uopt", 24 | "/usr/lib/usplit", 25 | ], 26 | "7.1": [ 27 | "/usr/bin/cc", 28 | "/usr/lib/as1", 29 | "/usr/lib/cfe", 30 | "/usr/lib/ugen", 31 | "/usr/lib/umerge", 32 | "/usr/lib/uopt", 33 | ] 34 | } 35 | 36 | 37 | def call(args, output_file=None): 38 | print(args) 39 | p = subprocess.Popen(args, shell=True, universal_newlines=True, stdout=output_file) 40 | p.wait() 41 | if output_file: 42 | output_file.flush() 43 | 44 | def process_prog(prog, ido_path, ido_flag, build_dir, out_dir, args, recomp_path): 45 | print("Recompiling " + ido_path + prog + "...") 46 | 47 | c_file_path = os.path.join(build_dir, os.path.basename(prog) + "_c.c") 48 | out_file_path = os.path.join(out_dir, os.path.basename(prog)) 49 | if platform.system().startswith("CYGWIN_NT"): 50 | out_file_path += ".exe" 51 | 52 | if not args.onlylibc: 53 | with open(c_file_path, "w") as cFile: 54 | call(recomp_path + " " + ido_path + prog, cFile) 55 | 56 | flags = " -fno-strict-aliasing -lm" 57 | 58 | if platform.system() == "Darwin": 59 | flags += " -fno-pie" 60 | else: 61 | flags += " -g -no-pie" 62 | 63 | if args.O2: 64 | flags += " -O2" 65 | 66 | call("gcc libc_impl.c " + c_file_path + " -o " + out_file_path + flags + ido_flag) 67 | 68 | return 69 | 70 | def main(args): 71 | ido_path = args.ido_path 72 | if ido_path[len(ido_path)-1] == "/": 73 | ido_path = ido_path[:len(ido_path)-1] 74 | 75 | ido_dir = ido_path.split(os.path.sep)[-1] 76 | if "7.1" in ido_dir: 77 | print("Detected IDO version 7.1") 78 | ido_flag = " -DIDO71" 79 | ugen_flag = "" 80 | build_dir = "build7.1" 81 | bins = BINS["7.1"] 82 | elif "5.3" in ido_dir: 83 | print("Detected IDO version 5.3") 84 | ido_flag = " -DIDO53" 85 | ugen_flag = " -Dugen53" 86 | build_dir = "build5.3" 87 | bins = BINS["5.3"] 88 | else: 89 | sys.exit("Unsupported ido dir: " + ido_dir) 90 | 91 | if args.multhreading and args.O2: 92 | print("WARNING: -O2 and -multhreading used together") 93 | 94 | if not os.path.exists(build_dir): 95 | os.mkdir(build_dir) 96 | shutil.copy("header.h", build_dir) 97 | shutil.copy("libc_impl.h", build_dir) 98 | shutil.copy("helpers.h", build_dir) 99 | 100 | out_dir = os.path.join(build_dir, "out") 101 | if not os.path.exists(out_dir): 102 | os.mkdir(out_dir) 103 | 104 | std_flag = "" 105 | if platform.system() == "Darwin": 106 | std_flag = " -std=c++11" 107 | 108 | recomp_path = os.path.join(build_dir, "recomp") 109 | if platform.system().startswith("CYGWIN_NT"): 110 | recomp_path += ".exe" 111 | call("g++ recomp.cpp -o " + recomp_path + " -g -lcapstone" + std_flag + ugen_flag) 112 | 113 | threads = [] 114 | for prog in bins: 115 | if args.multhreading: 116 | t = threading.Thread(target=process_prog, args=(prog, ido_path, ido_flag, build_dir, out_dir, args, recomp_path)) 117 | threads.append(t) 118 | t.start() 119 | else: 120 | process_prog(prog, ido_path, ido_flag, build_dir, out_dir, args, recomp_path) 121 | 122 | if args.multhreading: 123 | for t in threads: 124 | t.join() 125 | 126 | shutil.copyfile(os.path.join(ido_path, "usr/lib/err.english.cc"), os.path.join(out_dir, "err.english.cc")) 127 | 128 | if __name__ == "__main__": 129 | parser = argparse.ArgumentParser(description="Static ido recompilation build utility") 130 | parser.add_argument("ido_path", help="Path to ido") 131 | parser.add_argument("-O2", help="Build binaries with -O2", action='store_true') 132 | parser.add_argument("-onlylibc", help="Builds libc_impl.c only", action='store_true') 133 | parser.add_argument("-multhreading", help="Enables multi threading (deprecated with O2)", action='store_true') 134 | rgs = parser.parse_args() 135 | main(rgs) 136 | -------------------------------------------------------------------------------- /elf.h: -------------------------------------------------------------------------------- 1 | #ifndef ELF_H 2 | #define ELF_H 3 | 4 | #include 5 | 6 | #define EI_DATA 5 7 | #define EI_NIDENT 16 8 | #define SHT_SYMTAB 2 9 | #define SHT_DYNAMIC 6 10 | #define SHT_REL 9 11 | #define SHT_DYNSYM 11 12 | #define SHT_MIPS_REGINFO 0x70000006 13 | #define STN_UNDEF 0 14 | #define STT_OBJECT 1 15 | #define STT_FUNC 2 16 | #define DT_PLTGOT 3 17 | #define DT_MIPS_LOCAL_GOTNO 0x7000000a 18 | #define DT_MIPS_SYMTABNO 0x70000011 19 | #define DT_MIPS_GOTSYM 0x70000013 20 | 21 | #define ELF32_R_SYM(info) ((info) >> 8) 22 | #define ELF32_R_TYPE(info) ((info) & 0xff) 23 | 24 | #define ELF32_ST_TYPE(info) ((info) & 0xf) 25 | 26 | #define R_MIPS_26 4 27 | #define R_MIPS_HI16 5 28 | #define R_MIPS_LO16 6 29 | 30 | #define SHN_UNDEF 0 31 | #define SHN_COMMON 0xfff2 32 | #define SHN_MIPS_ACOMMON 0xff00 33 | #define SHN_MIPS_TEXT 0xff01 34 | #define SHN_MIPS_DATA 0xff02 35 | 36 | typedef uint32_t Elf32_Addr; 37 | typedef uint32_t Elf32_Off; 38 | 39 | typedef struct { 40 | uint8_t e_ident[EI_NIDENT]; 41 | uint16_t e_type; 42 | uint16_t e_machine; 43 | uint32_t e_version; 44 | Elf32_Addr e_entry; 45 | Elf32_Off e_phoff; 46 | Elf32_Off e_shoff; 47 | uint32_t e_flags; 48 | uint16_t e_ehsize; 49 | uint16_t e_phentsize; 50 | uint16_t e_phnum; 51 | uint16_t e_shentsize; 52 | uint16_t e_shnum; 53 | uint16_t e_shstrndx; 54 | } Elf32_Ehdr; 55 | 56 | typedef struct { 57 | uint32_t sh_name; 58 | uint32_t sh_type; 59 | uint32_t sh_flags; 60 | Elf32_Addr sh_addr; 61 | Elf32_Off sh_offset; 62 | uint32_t sh_size; 63 | uint32_t sh_link; 64 | uint32_t sh_info; 65 | uint32_t sh_addralign; 66 | uint32_t sh_entsize; 67 | } Elf32_Shdr; 68 | 69 | typedef struct { 70 | uint32_t st_name; 71 | Elf32_Addr st_value; 72 | uint32_t st_size; 73 | uint8_t st_info; 74 | uint8_t st_other; 75 | uint16_t st_shndx; 76 | } Elf32_Sym; 77 | 78 | typedef struct { 79 | Elf32_Addr r_offset; 80 | uint32_t r_info; 81 | } Elf32_Rel; 82 | 83 | typedef struct 84 | { 85 | uint32_t ri_gprmask; /* General registers used. */ 86 | uint32_t ri_cprmask[4]; /* Coprocessor registers used. */ 87 | int32_t ri_gp_value; /* $gp register value. */ 88 | } Elf32_RegInfo; 89 | 90 | typedef struct 91 | { 92 | int32_t d_tag; /* Dynamic entry type */ 93 | union { 94 | uint32_t d_val; /* Integer value */ 95 | Elf32_Addr d_ptr; /* Address value */ 96 | } d_un; 97 | } Elf32_Dyn; 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /header.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "libc_impl.h" 9 | #include "helpers.h" 10 | 11 | #define RM_RN 0 12 | #define RM_RZ 1 13 | #define RM_RP 2 14 | #define RM_RM 3 15 | 16 | union FloatReg { 17 | float f[2]; 18 | uint32_t w[2]; 19 | double d; 20 | }; 21 | 22 | #define cvt_w_d(f) \ 23 | ((fcsr & RM_RZ) ? ((isnan(f) || f <= -2147483649.0 || f >= 2147483648.0) ? (fcsr |= 0x40, 2147483647) : (int)f) : (assert(0), 0)) 24 | 25 | #define cvt_w_s(f) cvt_w_d((double)f) 26 | 27 | static union FloatReg f0 = {{0, 0}}, f2 = {{0, 0}}, f4 = {{0, 0}}, f6 = {{0, 0}}, f8 = {{0, 0}}, 28 | f10 = {{0, 0}}, f12 = {{0, 0}}, f14 = {{0, 0}}, f16 = {{0, 0}}, f18 = {{0, 0}}, f20 = {{0, 0}}, 29 | f22 = {{0, 0}}, f24 = {{0, 0}}, f26 = {{0, 0}}, f28 = {{0, 0}}, f30 = {{0, 0}}; 30 | static uint32_t fcsr = 1; 31 | -------------------------------------------------------------------------------- /helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPERS_H 2 | #define HELPERS_H 3 | 4 | #include 5 | 6 | #define MEM_U32(a) (*(uint32_t *)(mem + a)) 7 | #define MEM_S32(a) (*(int32_t *)(mem + a)) 8 | #define MEM_U16(a) (*(uint16_t *)(mem + ((a) ^ 2))) 9 | #define MEM_S16(a) (*(int16_t *)(mem + ((a) ^ 2))) 10 | #define MEM_U8(a) (*(uint8_t *)(mem + ((a) ^ 3))) 11 | #define MEM_S8(a) (*(int8_t *)(mem + ((a) ^ 3))) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /ido/5.3/LICENSE.md: -------------------------------------------------------------------------------- 1 | # Silicon Graphics Freeware Legal Notice 2 | ## Copyright 1995, Silicon Graphics, Inc. -- ALL RIGHTS RESERVED 3 | 4 | You may copy, modify, use and distribute this software, (i) provided that you include the entirety of this reservation of rights notice in all such copies, and (ii) you comply with any additional or different obligations and/or use restrictions specified by any third party owner or supplier of the software in other notices that may be included with the software. 5 | 6 | **SGI DISCLAIMS ALL WARRANTIES WITH RESPECT TO THIS SOFTWARE, EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. SGI SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST REVENUES, LOST PROFITS, OR LOSS OF PROSPECTIVE ECONOMIC ADVANTAGE, RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.** 7 | 8 | **U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:** 9 | 10 | Use, duplication or disclosure by the Government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement. Unpublished - rights reserved under the Copyright Laws of United States. Contractor/manufacturer is Silicon Graphics, Inc., 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 11 | 12 | ## Product Support 13 | 14 | Freeware products are not supported by Silicon Graphics or any of its support providers. The software contained in this package is made available through the generous efforts of their authors. Although they are interested in your feedback, they are under no obligation to address bugs, enhancements, or answer questions. 15 | 16 | ---- 17 | 18 | **NOTE:** This license was copied verbatim from https://web.archive.org/web/19991008090202/http://toolbox.sgi.com/TasteOfDT/public/freeware1.0/legal_notice.html . 19 | -------------------------------------------------------------------------------- /ido/5.3/lib/libmalloc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/lib/libmalloc.so -------------------------------------------------------------------------------- /ido/5.3/lib/libmalloc_old.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/lib/libmalloc_old.so -------------------------------------------------------------------------------- /ido/5.3/lib/rld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/lib/rld -------------------------------------------------------------------------------- /ido/5.3/usr/bin/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/bin/cc -------------------------------------------------------------------------------- /ido/5.3/usr/lib/acpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/acpp -------------------------------------------------------------------------------- /ido/5.3/usr/lib/as0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/as0 -------------------------------------------------------------------------------- /ido/5.3/usr/lib/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/as1 -------------------------------------------------------------------------------- /ido/5.3/usr/lib/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/cfe -------------------------------------------------------------------------------- /ido/5.3/usr/lib/copt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/copt -------------------------------------------------------------------------------- /ido/5.3/usr/lib/crt1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/crt1.o -------------------------------------------------------------------------------- /ido/5.3/usr/lib/err.english.cc: -------------------------------------------------------------------------------- 1 | @ 2 | 358 358 358 3 | 6464 6482 6553 4 | 6553 6593 6728 5 | 6728 6746 6803 6 | 6803 6808 6808 7 | 6808 6818 6818 8 | 6818 6826 6826 9 | 6826 6847 6847 10 | 6847 6875 6922 11 | 6922 6930 6930 12 | 6930 6939 6939 13 | 6939 6948 6948 14 | 6948 6974 7120 15 | 7120 7149 7204 16 | 7210 7248 7311 17 | 7317 7350 7442 18 | 7450 7497 7627 19 | 7635 7709 7930 20 | 7938 7975 8063 21 | 8071 8113 8253 22 | 8261 8289 8289 23 | 8298 8338 8445 24 | 8460 8502 8635 25 | 8650 8690 8819 26 | 8834 8857 8965 27 | 8965 9008 9113 28 | 9119 9142 9227 29 | 9235 9282 9451 30 | 9451 9462 9462 31 | 9462 9477 9477 32 | 9477 9497 9497 33 | 9497 9545 9545 34 | 9545 9584 9584 35 | 9584 9604 9662 36 | 9662 9682 9720 37 | 9720 9749 9749 38 | 9749 9788 9788 39 | 9788 9802 9802 40 | 9802 9829 9829 41 | 9829 9861 9861 42 | 9861 9904 9904 43 | 9904 9920 9920 44 | 9920 9962 9962 45 | 9962 9988 9988 46 | 9988 10014 10014 47 | 10014 10035 10035 48 | 10035 10054 10097 49 | 10097 10115 10115 50 | 10115 10147 10147 51 | 10147 10183 10183 52 | 10183 10208 10208 53 | 10208 10236 10236 54 | 10236 10269 10269 55 | 10269 10304 10304 56 | 10304 10328 10328 57 | 10328 10351 10351 58 | 10351 10371 10371 59 | 10371 10402 10402 60 | 10402 10447 10447 61 | 10447 10497 10497 62 | 10497 10533 10533 63 | 10533 10598 10598 64 | 10606 10630 10630 65 | 10640 10671 10671 66 | 10690 10719 10719 67 | 10728 10752 10795 68 | 10795 10837 10837 69 | 10837 10876 10876 70 | 10876 10900 10900 71 | 10900 10948 10948 72 | 10960 11021 11103 73 | 11103 11128 11128 74 | 11128 11153 11153 75 | 11153 11216 11216 76 | 11216 11239 11239 77 | 11239 11303 11303 78 | 11303 11347 11347 79 | 11357 11393 11393 80 | 11393 11432 11432 81 | 11442 11494 11494 82 | 11494 11536 11536 83 | 11536 11595 11595 84 | 11595 11622 11622 85 | 11622 11684 11684 86 | 11684 11726 11726 87 | 11738 11778 11778 88 | 11782 11813 11813 89 | 11813 11850 11850 90 | 11850 11900 12087 91 | 12111 12120 12120 92 | 12120 12129 12129 93 | 12129 12158 12158 94 | 12158 12192 12192 95 | 12192 12237 12237 96 | 12237 12273 12273 97 | 12273 12326 12326 98 | 12330 12366 12366 99 | 12366 12423 12423 100 | 12427 12482 12482 101 | 12486 12560 12560 102 | 12568 12631 12631 103 | 12637 12691 12691 104 | 12691 12743 12743 105 | 12743 12785 12785 106 | 12785 12826 12826 107 | 12826 12865 12865 108 | 12865 12883 12883 109 | 12883 12946 12946 110 | 12956 12995 12995 111 | 13005 13066 13066 112 | 13077 13163 13163 113 | 13163 13211 13211 114 | 13211 13270 13270 115 | 13270 13318 13318 116 | 13318 13350 13350 117 | 13350 13387 13387 118 | 13387 13428 13428 119 | 13428 13464 13533 120 | 13533 13580 13737 121 | 13737 13776 13854 122 | 13854 13913 13913 123 | 13913 13950 13950 124 | 13950 14118 14118 125 | 14118 14150 14150 126 | 14150 14163 14194 127 | 14194 14224 14255 128 | 14255 14275 14319 129 | 14319 14353 14458 130 | 14466 14484 14530 131 | 14534 14567 14567 132 | 14567 14635 14682 133 | 14690 14742 14742 134 | 14742 14789 14789 135 | 14801 14875 14875 136 | 14886 14947 14947 137 | 14947 14992 14992 138 | 14992 15035 15085 139 | 15085 15134 15205 140 | 15214 15267 15448 141 | 15454 15496 16810 142 | 16822 16875 16960 143 | 16972 17053 17179 144 | 17191 17236 17332 145 | 17344 17491 17841 146 | 17853 17939 18304 147 | 18316 18471 18774 148 | 18786 18952 19323 149 | 19335 19364 19496 150 | 19500 19527 19598 151 | 19598 19613 19776 152 | 19797 19808 19837 153 | 19837 19862 19862 154 | 19868 19927 20026 155 | 20034 20075 20179 156 | 20187 20223 20223 157 | 20223 20290 20382 158 | 20392 20441 20589 159 | 20601 20656 20656 160 | 20656 20699 20818 161 | 20826 20860 21038 162 | 21046 21094 21191 163 | 21203 21236 21314 164 | 21326 21395 21457 165 | 21469 21502 21502 166 | 21502 21587 21731 167 | 21756 21789 21864 168 | 21875 21901 21976 169 | 22013 22059 22220 170 | 22257 22397 22561 171 | 22561 22595 22595 172 | 22603 22623 22623 173 | 22631 22667 22828 174 | 22865 22919 22994 175 | 23031 23059 23120 176 | 23132 23201 23201 177 | 23212 23274 23274 178 | 23285 23345 23345 179 | 23356 23393 23393 180 | 23399 23431 23532 181 | 23542 23587 23646 182 | 23656 23697 23745 183 | 23755 23796 23844 184 | 23854 23876 23928 185 | 23942 23971 24153 186 | 24160 24243 24243 187 | 24247 24273 24743 188 | 24755 24784 24984 189 | 24996 25034 25034 190 | 25034 25075 25273 191 | 25281 25332 25410 192 | 25420 25467 25544 193 | 25554 25583 25744 194 | 25754 25783 26061 195 | 26071 26111 26185 196 | 26194 26239 26525 197 | 26535 26568 26914 198 | 26924 26951 26998 199 | 27008 27035 27082 200 | 27093 27120 27167 201 | 27178 27206 27251 202 | 27261 27289 27334 203 | 27345 27391 27931 204 | 27938 27959 28007 205 | 28019 28037 28037 206 | 28043 28069 28069 207 | 28077 28147 28199 208 | 28207 28266 28266 209 | 28274 28306 28306 210 | 28314 28339 28339 211 | 28347 28404 28510 212 | 28518 28567 28682 213 | 28690 28728 28728 214 | 28736 28782 29023 215 | 29033 29085 29234 216 | 29246 29303 29383 217 | 29395 29432 29570 218 | 29592 29631 29644 219 | 29644 29693 29758 220 | 29767 29810 29875 221 | 29875 29911 29976 222 | 29984 30014 30014 223 | 30027 30086 30151 224 | 30157 30223 30293 225 | 30301 30369 30445 226 | 30457 30511 30568 227 | 30580 30630 30743 228 | 30755 30812 30874 229 | 30886 30959 31035 230 | 31043 31076 31175 231 | 31183 31243 31243 232 | 31251 31323 31323 233 | 31331 31433 31433 234 | 31445 31544 31686 235 | 31698 31740 31740 236 | 31740 31783 31783 237 | 31783 31824 31824 238 | 31824 31873 31996 239 | 32008 32056 32164 240 | 32176 32210 32210 241 | 32229 32271 32271 242 | 32279 32323 32569 243 | 32581 32642 32718 244 | 32739 32779 32916 245 | 32926 32953 33047 246 | 33057 33116 33315 247 | 33325 33373 33373 248 | 33373 33407 33469 249 | 33494 33527 33527 250 | 33536 33573 33573 251 | 33584 33650 33697 252 | 33705 33763 33763 253 | 33763 33797 33797 254 | 33797 33829 33906 255 | 33915 33976 33976 256 | 33985 34016 34098 257 | 34098 34133 34198 258 | 34198 34261 34261 259 | 34269 34312 34312 260 | 34324 34363 34438 261 | 34444 34530 34530 262 | 34538 34596 34626 263 | 34636 34675 34754 264 | 34764 34821 34821 265 | 34821 34867 34950 266 | 34959 35016 35135 267 | 35145 35198 35198 268 | 35208 35266 35344 269 | 35355 35382 35537 270 | 35547 35576 35629 271 | 35637 35705 35705 272 | 35713 35764 35764 273 | 35764 35784 35876 274 | 35888 35932 35950 275 | 35950 36013 36138 276 | 36150 36191 36280 277 | 36286 36314 36419 278 | 36431 36516 36516 279 | 36516 36554 36642 280 | 36642 36689 36808 281 | 36818 36881 37105 282 | 37113 37183 37204 283 | 37204 37225 37225 284 | 37225 37255 37348 285 | 37348 37388 37388 286 | 37388 37454 37454 287 | 37454 37518 37518 288 | 37518 37584 37584 289 | 37584 37717 37717 290 | 37717 37752 37752 291 | 37752 37783 37889 292 | 37901 37928 38034 293 | 38046 38115 38115 294 | 38115 38140 38187 295 | 38195 38219 38339 296 | 38351 38422 38422 297 | 38422 38486 38486 298 | 38486 38555 38555 299 | 38555 38619 38619 300 | 38619 38641 38641 301 | 38641 38758 38758 302 | 38758 38929 38929 303 | 38929 38975 39043 304 | 39055 39084 39133 305 | 39133 39175 39265 306 | 39275 39310 39494 307 | 39504 39547 39576 308 | 39587 39614 39668 309 | 39674 39697 39797 310 | 39797 39845 40094 311 | 40094 40158 40264 312 | 40264 40369 40523 313 | 40523 40593 40593 314 | 40593 40629 40876 315 | 40876 40911 40971 316 | 40977 41026 41026 317 | 41038 41077 41077 318 | 41077 41116 41116 319 | 41116 41156 41156 320 | 41156 41195 41195 321 | 41195 41237 41237 322 | 41237 41285 41285 323 | 41285 41304 41304 324 | 41304 41371 41371 325 | 41371 41429 41429 326 | 41429 41491 41491 327 | 41491 41519 41519 328 | 41519 41572 41572 329 | 41572 41642 41642 330 | 41642 41676 41676 331 | 41676 41713 41713 332 | 41713 41751 41751 333 | 41751 41792 41792 334 | 41792 41856 41856 335 | 41856 41881 41881 336 | 41881 41936 41936 337 | 41936 41977 41977 338 | 41977 42018 42018 339 | 42018 42090 42090 340 | 42090 42162 42162 341 | 42162 42205 42205 342 | 42205 42267 42267 343 | 42267 42294 42294 344 | 42294 42309 42309 345 | 42309 42338 42386 346 | 42393 42425 42522 347 | 42530 42577 42577 348 | 42577 42623 42623 349 | 42623 42643 42725 350 | 42725 42748 42748 351 | 42748 42829 42897 352 | 42901 42952 42952 353 | 42952 42978 43025 354 | 43025 43116 43116 355 | 43116 43171 43171 356 | 43171 43204 43376 357 | 43386 43453 43471 358 | 43471 43547 43780 359 | 43798 43921 44116 360 | 44120 44120 44120 361 | Out of memory: %s 362 | There is no more memory left in the system for compiling this program. 363 | Internal Error Unknown Error Message %s 364 | 1) An internal error, while attempting to print an unavailable message 365 | 2) The error message file is inaccessible or has other problems 366 | Unknown Signal %s 367 | 1) An unknown signal has been caught 368 | 2) 2 Nested signals 369 | line 370 | Warning: 371 | Fatal: 372 | Source not available 373 | Too many errors... goodbye. 374 | There is a limit of 30 errors before aborting. 375 | Error: 376 | reserved 377 | reserved 378 | Unknown Control Statement 379 | 1) The line begins with a '#' and is not of the form: 380 | # "" 381 | 2) Please compile this program with the preprocessor enabled. 382 | Unknown character %s ignored 383 | The character is not part of the source character set. 384 | 2.2.1 385 | Unknown control character \%s ignored 386 | The control character is not part of the source character set. 387 | 2.2.1 388 | Illegal character %s in exponent 389 | 1) Digits or sign expected after 'e' or 'E'. 390 | 2) Digits are expected after sign in exponent. 391 | 3.1.3.1 392 | Constant is out of range and may be truncated. 393 | The constant is too large to be accurately represented and may be 394 | truncated. The limits are in the system include file limits.h. 395 | 2.2.4.2 396 | Constant is out of range for a 32-bit data type, but accepted as written. 397 | The constant is too large to fit in a 32-bit data type, but will be 398 | accurately represented in a wider data type. The value may be truncated, 399 | depending on its context. The limits are in the system include file 400 | limits.h. 401 | 2.2.4.2 402 | Character constant size out of range 403 | 1) No characters in a character constant. 404 | 2) More than 4 bytes in a character constant. 405 | 3.1.3.4 406 | Wide character constant size out of range 407 | 1) No characters in the multibyte sequence (0 assumed). 408 | 2) More than 1 byte in the multi-byte sequence (only the first byte was converted). 409 | 3.1.3.4 410 | Invalid multibyte character 411 | 4.10.7.2 412 | Newline in string or character constant 413 | 1) Terminate your string or character constant with closing quotes. 414 | 2) Put a backslash before the newline. 415 | 3.1.3.4, 3.1.4 416 | Octal character escape too large: %s > %s 417 | 1) Terminate end of octal sequence with a non-octal character. 418 | 2) Select a character value within the limits. 419 | Value may be truncated 420 | 3.1.3.4, 3.1.4 421 | Hex character escape too large: %s > %s 422 | 1) Terminate end of hex sequence with a non-hex character. 423 | 2) Select a character value within the limits. 424 | Value may be truncated 425 | 3.1.3.4, 3.1.4 426 | Unexpected End-of-file 427 | 1) Unterminated string or character constant 428 | 2) Missing closing comment marker (*/) 429 | 3) File system problems 430 | Unrecognized escape sequence in string \%s 431 | Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. 432 | Character will be treated as un-escaped. 433 | 3.9.2 434 | Illegal octal digit %s 435 | Octal constants, beginning with 0, must only have digits between 0 and 7, 436 | inclusive. 437 | 3.1.3.2 438 | Unable to open temporary file for compiling %s 439 | 1) TMPDIR environment variable is set to a directory that you have no 440 | permissions for. 441 | 2) The file system is full. 442 | 3) System errors beyond the scope of the compiler. 443 | %s: Hangup 444 | %s: Interrupt 445 | %s: Quit (ASCII FS) 446 | %s: Illegal instruction (not reset when caught) 447 | %s: Trace trap (not reset when caught) 448 | %s: IOT instruction 449 | Also SIGABRT, used by abort, replace SIGIOT in the future 450 | %s: EMT instruction 451 | Also SIGXCPU, Exceeded CPU time limit 452 | %s: Floating point exception 453 | %s: Kill (cannot be caught or ignored) 454 | %s: Bus error 455 | %s: Segmentation violation 456 | %s: Bad argument to system call 457 | %s: Write on a pipe with no one to read it 458 | %s: Alarm clock 459 | %s: Software termination signal from kill 460 | %s: User defined signal 1 461 | %s: User defined signal 2 462 | %s: Death of a child 463 | Power-fail restart 464 | %s: Also SIGXFSZ, exceeded file size limit 465 | %s: Window change 466 | %s: Handset, line status change 467 | %s: Sendablestop signalnot from tty 468 | %s: Stop signal from tty 469 | %s: Pollable event occurred 470 | %s: Input/Output possible signal 471 | %s: Urgent condition on IO channel 472 | %s: Window size changes 473 | %s: Virtual time alarm 474 | %s: Profiling alarm 475 | %s: Continue a stopped process 476 | %s: To readers pgrp upon background tty read 477 | %s: Like TTIN for output if (tp->t_local<OSTOP) 478 | %s: Resource lost (eg, record-lock) 479 | 'auto' and 'register' are not allowed in an external declaration 480 | 3.7(10) 481 | must have function type 482 | 3.7.1(30) 483 | Functions cannot return arrays 484 | 3.7.1(33), 3.3.2.2 485 | Declaration list not allowed 486 | 3.7.1(5) 487 | Too many input files %s 488 | The command line may contain only one file 489 | cpp internal error: input stack underflow 490 | cpp internal error: if stack underflow 491 | Cannot open the file %s 492 | No new-line character at the end of the file %s 493 | 2.1.1.2(30) 494 | Fatal: Exceeded the limit of nesting level for #include file 495 | Fatal: Exceeded the limit of nesting level for #include file. This limit 496 | is 200. 497 | Fail to read the file %s 498 | Cannot write the file %s 499 | %s: %s: An if directive is not terminated properly in the file 500 | %s: %s: nested comment 501 | %s:%s: Illegal macro name %s; macro name shall be an identifier 502 | %s:%s: Illegal preprocessing token sequence 503 | 3.8.3(35) 504 | %s:%s: Illegal macro parameter name 505 | %s:%s: Non-unique macro parameter name 506 | 3.8.3(18) 507 | %s:%s: Missing ')' in parameter list for #define %s 508 | %s:%s: Missing ')' in macro instantiation 509 | %s:%s: Bad punctuator in the parameter list for #define %s 510 | %s:%s: Macro %s redefined. 511 | %s:%s: # operator should be followed by a macro argument name 512 | %s:%s: Badly formed constant expression%s 513 | 3.4(9), 3.8 514 | %s:%s: Division by zero in #if or #elif 515 | 3.8 516 | unknown command line option %s 517 | extraneous input/output file name %s 518 | %s: %s: Unterminated string or character constant 519 | A preprocessing string or character constant token was not 520 | terminated. Note that preprocessing directives are processed 521 | after the source file has been divided into preprocessing tokens. 522 | 2.1.1.2(30) 3.1(18) 3.8 523 | %s: %s: 524 | %s: %s: 525 | %s: %s: Unterminated comment 526 | %s: %s: Unknown directive type %s 527 | %s: %s: #elif or #else after #else directive 528 | %s: %s: Bad identifier after the %s 529 | %s: %s: #%s accepts only one identifier as parameter 530 | 3.8 531 | %s: %s: Bad identifier after the %s 532 | %s: %s: text following #%s violates the ANSI C standard. 533 | 3.8 534 | %s: %s: Bad character %s occurs after the # directive. 535 | 3.8 536 | %s: %s: the ## operator shall not be the %s token in the replacement list 537 | 3.8.3.3 538 | %s: %s: the defined operator takes identifier as operand only. 539 | 3.8.1 540 | %s: %s: Not in a conditional directive while using %s 541 | %s: %s: Illegal filename specification for #include 542 | %s: %s: Invalid file name %s for #include 543 | %s: %s: Cannot open file %s for #include 544 | %s: %s: Bad argument for #line command 545 | %s: %s: #error %s 546 | %s: %s: Tried to redefine predefined macro %s, attempt ignored 547 | 3.8.7(22) 548 | %s: %s: Undefining predefined macro %s 549 | 3.8.7(22) 550 | %s: %s: Undefined the ANSI standard library defined macro %s 551 | 4.1.2.1(9) 552 | %s: %s: The number of arguments in the macro invocation does not match the definition 553 | %s: %s: Illegal character %s in preprocessor if 554 | %s: %s: Illegal character %s for number in preprocessor if 555 | %s: %s: No string is allowed in preprocessor if 556 | %s: %s: Not supported pragma %s 557 | %s: %s: Not supported #pragma format 558 | %s: %s: ANSI C does not allow #ident; %s 559 | %s: %s: Not supported #ident format 560 | This cpp extension accepts the following format: 561 | #ident "any string" 562 | %s: %s: Not supported #assert/#unassert format 563 | This cpp extension accepts the following format: 564 | #assert identifier 565 | #assert identifier ( pp-tokens ) 566 | #unassert identifier 567 | #unassert identifier ( pp-tokens ) 568 | %s: %s: Bad assertion predicate format 569 | The correct syntax for this cpp extension is: 570 | #assert identifier ( pp-token ) 571 | %s: %s: directive is an upward-compatible ANSI C extension 572 | %s: This option requires an argument 573 | %s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. 574 | A status return from cpp to cfe 575 | Syntax Error 576 | The token read was unexpected. 577 | Syntax Error -- cannot backup 578 | The token read was unexpected. 579 | Yacc stack overflow 580 | The expression is too complicated to parse. 581 | Trailing comma in enumerator list 582 | The use of a trailing comma in an enumerator list is not standard C. There 583 | may be portability problems. 584 | 3.5.2.2 585 | Empty declaration 586 | Empty declarations are invalid in standard C. 587 | 3.5 588 | %s declared, but not referenced. 589 | redeclaration of '%s'; previous declaration at line %s in file '%s' 590 | Identifier redeclared in the same scope/block. 591 | 3.1.2.3 592 | '%s' undefined; reoccurrences will not be reported. 593 | Non-function name referenced in function call. 594 | 3.3.2.2(18) 595 | The number of arguments doesn't agree with the number in the declaration. 596 | 3.3.2.2(5) 597 | '%s' section name longer than 8 characters. Name truncated. 598 | '%s' is already placed by pragma alloc_text. 599 | Cannot write ucode file while compiling %s 600 | 1) The file system is full 601 | 2) Permissions problem 602 | Must have corresponding formal argument for '%s' 603 | Parameter found in the declaration part, but not in the argument list. 604 | 3.7.1(7) 605 | Non-prototype declaration is an obsolescent feature. 606 | The use of function definitions with separate parameter identifier 607 | and declaration lists (not prototype-format parameter type and 608 | identifier declarators) is an obsolescent feature. 609 | 3.9.5 610 | Incompatible function declarations for %s 611 | For two function types to be compatible, both shall specify compatible 612 | return types. Moreover, the parameter type lists, if both are present, 613 | shall agree in the number of parameters and in use of the ellipsis 614 | terminator; corresponding parameters shall have compatible types. If 615 | one type has a parameter type list and the other type is specified by 616 | a function declarator that is not part of a function definition and 617 | contains an empty identifier list, the parameter list shall not have 618 | an ellipsis terminator and the type of each parameter shall be 619 | compatible with they type that results from application of the default 620 | argument promotions. If one type has a parameter type list and the 621 | other is specified by a function definition that contains a (possibly 622 | empty) identifier list, both shall agree in the number of parameters, 623 | and the type of each prototype parameter shall be compatible with the 624 | type that results from application of the default argument promotions 625 | to the type of the corresponding identifier. (For each parameter 626 | declared with function or array type, its type for these comparisons 627 | is the one that results from conversion to a pointer type. For each 628 | parameter declared with qualified type, its type for these comparisons 629 | is the unqualified version of its declared type.) There you have it! 630 | 3.5.4.3(15) 631 | Incompatible function return type for this function. 632 | For two function types to be compatible, both shall specify compatible 633 | return types. 634 | 3.5.4.3(15) 635 | The number of parameters for function is different from the previous declaration 636 | The parameter type lists, if both are present, shall agree in the 637 | number of parameters and in use of the ellipsis terminator. 638 | 3.5.4.3(15) 639 | Incompatible type for the function parameter 640 | If both parameter type lists are present, corresponding 641 | parameters shall have compatible types. 642 | 3.5.4.3(15) 643 | Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. 644 | The redeclaration could cause arguments at a call site to be passed 645 | inconsistently with what the function implementation expects, and 646 | parameters would therefore be accessed erroneously when executing the 647 | function body. Note that a float argument is promoted to a double 648 | when passed (potentially through fp registers) to an unprototyped 649 | function. 650 | 3.5.4.3(15) 651 | prototype and non-prototype declaration found for %s, ellipsis terminator not allowed 652 | If one type has a parameter type list and the other type is specified 653 | by a function declarator that is not part of a function definition and 654 | contains an empty identifier list, the parameter list shall not have 655 | an ellipsis terminator and the type of each parameter shall be 656 | compatible with they type that results from application of the default 657 | argument promotions. 658 | 3.5.4.3(15) 659 | prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion 660 | If one type has a parameter type list and the other type is specified 661 | by a function declarator that is not part of a function definition and 662 | contains an empty identifier list, the type of each parameter shall be 663 | compatible with the type that results from application of the default 664 | argument promotions. 665 | 3.5.4.3(15) 666 | prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion 667 | If one type has a parameter type list and the other is specified by a 668 | function definition that contains a (possibly empty) identifier list, 669 | both shall agree in the number of parameters, and the type of each 670 | prototype parameter shall be compatible with the type that results 671 | from application of the default argument promotions to the type of the 672 | corresponding identifier. 673 | 3.5.4.3(15) 674 | Empty declaration specifiers 675 | Standard C requires at least a storage class specifier, type specifier, 676 | or a type qualifier in declarations. 'extern int' assumed. 677 | 3.5 678 | Can't write to the file %s 679 | 1) The output file cannot be opened for writing. 680 | 2) Out of file space. 681 | Duplicate '%s' 682 | typedef, extern, static, auto, register, const, volatile may not 683 | appear more than once in the same specifier list or qualifier list. 684 | Duplicate occurrence ignored. 685 | 3.5.1(10) , 3.5.3(5) 686 | Null input 687 | There is nothing to compile. 688 | Illegal type combination 689 | 3.5.2 690 | Missing ';' at end of structure / union member declaration 691 | In standard C, each member declaration must be terminated by a ';'. A 692 | terminating ';' is assumed. 693 | 3.5.2.1 694 | Missing member name in structure / union 695 | In standard C, each member declaration have a member name. The missing 696 | member is assumed to not exist. 697 | 3.5.2.1 698 | This variable is initialized twice. 699 | Neither 'const' or 'volatile' have any effect on function results. 700 | Qualifiers only apply to expressions designating an object that 701 | can be altered or examined. 702 | 3.5.3(10) 703 | An integer constant expression is required here. 704 | The expression that defines the value of an enumeration constant 705 | shall be an integral constant expression that has a value 706 | representable as an int. 707 | 3.5.2.2(28) 708 | (previous declaration of '%s' at line %s in file '%s') 709 | Must be an integer type greater than zero. 710 | The array size must be either a char, signed or unsigned integer or 711 | an enumerated type with a value greater than zero. 712 | 3.5.4.2 713 | Array size cannot be a long long. 714 | Arrays with more than 2^32 elements are not yet supported. 715 | The array size must be either a char, signed or unsigned integer or 716 | an enumerated type with a value greater than zero. 717 | 3.5.4.2 718 | bit-field '%s' width is not an integer constant 719 | The expression that specifies the width of a bit-field shall be an 720 | integral constant expression. 721 | 3.5.2.1(15) 722 | bit-field '%s' width is negative 723 | The expression that specifies the width of a bit-field shall be 724 | non-negative. 725 | 3.5.2.1(15) 726 | bit-field '%s' type required to be int, unsigned int, or signed int. 727 | A bit-field shall have type int, unsigned int, or signed int. 728 | 3.5.2.1(30) 729 | bit-field %s's type not integer. 730 | Non-scalar type or pointer type to a non-object for increment or decrement operator. 731 | The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. 732 | 3.3.2.4(37), 3.3.3.1(25) 733 | Assign value to a function type. 734 | An assignment operator shall have a modifiable lvalue as its left operand. 735 | 3.2.2.1(5) 736 | Assign value to an array. 737 | An assignment operator shall have a modifiable lvalue as its left operand. 738 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 739 | Change value for variable of incomplete type. 740 | The operand of increment and decrement operator shall be a modifiable 741 | scalar lvalue. An assignment operator shall have a modifiable lvalue 742 | as its left operand. 743 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 744 | The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. 745 | This is a restriction in our implementation, which can be worked 746 | around by always accessing long long bit-fields indirectly (i.e. 747 | by means of the '->' operator). 748 | This expression is not an lvalue. 749 | 3.2.2.1 750 | Modified an rvalue. 751 | 3.2.2.1 752 | Change value for constant variable. 753 | The operand of increment and decrement operators shall be modifiable 754 | scalar lvalues. An assignment operator shall have a modifiable lvalue 755 | as its left operand. 756 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 757 | Change value for constant field of a struct or union. 758 | An assignment operator shall have a modifiable lvalue as its left operand. 759 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 760 | Dereferenced a non-pointer. 761 | The operand of the unary * operator shall have pointer type. 762 | 3.3.3.2(39) 763 | The operand of the unary + or - operator shall have arithmetic type. 764 | 3.3.3.3(6) 765 | The operand of the unary ~ operator shall have integral type. 766 | 3.3.3.3(6) 767 | The operand of the unary ! operator shall have scalar type. 768 | 3.3.3.3(6) 769 | Constants must have arithmetic type. 770 | 3.1.3 771 | Bad type name for cast operator 772 | The type name for the cast operator should either be void or a 773 | qualified or unqualified scalar type. 774 | 3.3.4(22) 775 | Improper cast of non-scalar type expression. 776 | The operand for the cast operator shall be of scalar type. 777 | 3.3.4(23) 778 | Cast a pointer into a non-integral type. 779 | A pointer may be converted to an integral type. 780 | 3.3.4(31) 781 | Cast a non-integral type into a pointer. 782 | An integral type may be converted to a pointer. 783 | 3.3.4(31) 784 | Duplicate member '%s' 785 | Two members of a struct may not have the same name. 786 | 3.1.2.2(7,25) 787 | Invalid constant expression. 788 | Constant expressions shall not contain assignment, increment, decrement, 789 | function-call, or comma operators, except when they are contained within 790 | the operand of the sizeof operator. 791 | 3.4(9) 792 | Constant expressions must be derived from a constant value or a constant 793 | variable. 794 | 3.4 795 | Dangerous operand of '&'. 796 | The operand of the unary & operator shall be either a function 797 | designator or an lvalue that designates an object that is not a 798 | bit-field and is not declared with the register storage-class 799 | specifier. This operand is NOT an lvalue, but we let it pass. 800 | Note that a segmentation error with possible core dump will result 801 | when the resulting address does not denote a valid (declared) 802 | storage location. This feature will be discontinued in future 803 | releases of the compiler! 804 | 3.3.3.2(36) 805 | Unacceptable operand of '&'. 806 | The operand of the unary & operator shall be either a function 807 | designator or an lvalue that designates an object that is not a 808 | bit-field and is not declared with the register storage-class 809 | specifier. 810 | 3.3.3.2(36) 811 | '&' before array or function; ignored 812 | Unacceptable operand of sizeof operator. 813 | The sizeof operator shall not be applied to an expression that has 814 | function type or an incomplete type, to the parenthesized name of such 815 | a type, or to an lvalue that designates a bit-field object. 816 | 3.3.3.4 817 | Unacceptable operand of a multiplicative operator. 818 | Each of the operands of a multiplicative operator shall have arithmetic type. 819 | 3.3.5(18) 820 | Unacceptable operand of the remainder operator 821 | Each of the operands of the remainder (%) operator shall have integral type. 822 | 3.3.5(18) 823 | Unacceptable operand of '+'. 824 | For the + operator, either both operands shall have arithmetic type, or 825 | one operand shall be a pointer to an object type and the other shall 826 | have integral type. 827 | 3.3.6(39) 828 | Unacceptable operand of '-'. 829 | For the subtraction operator, one of the following shall hold: both operands 830 | have arithmetic type; operands are pointers to qualified or unqualified 831 | versions of compatible object types; or the left operand is a pointer 832 | to an object type and the right operand has integral type. 833 | 3.3.6(39) 834 | Unacceptable operand of shift operator. 835 | Each of the operands of bitwise shift operators shall have integral type. 836 | 3.3.7(9) 837 | Unacceptable operand of relational operator. 838 | For relational operators, one of the following shall hold: both 839 | operands have arithmetic type; both operands are pointers to qualified 840 | or unqualified versions of compatible object types; or both operands 841 | are pointers to qualified or unqualified versions of compatible 842 | incomplete types. 843 | 3.3.8(32) 844 | Unacceptable operand of == or != 845 | For the == or != operator, one of the following shall hold: both operands 846 | are pointers to qualified or unqualified versions of compatible types; one 847 | operand is a pointer to an object or incomplete type and the other is a 848 | pointer to a qualified or unqualified version of void; or one operand is 849 | a pointer and the other is a null pointer constant. 850 | 3.3.9(21) 851 | Unacceptable operand of &. 852 | Each of the operands shall have integral type. 853 | 3.3.10(7) 854 | Unacceptable operand of ^. 855 | Each of the operands shall have integral type. 856 | 3.3.11(18) 857 | Unacceptable operand of |. 858 | Each of the operands shall have integral type. 859 | 3.3.12(30) 860 | Unacceptable operand of &&. 861 | Each of the operands shall have scalar type. 862 | 3.3.13(7) 863 | Unacceptable operand of ||. 864 | Each of the operands shall have scalar type. 865 | 3.3.14(20) 866 | Unacceptable operand of conditional operator. 867 | The first operand of conditional operator shall have scalar type. One 868 | of the following shall hold for the second and third operands: 869 | both operands have arithmetic type; both operands have compatible 870 | structure or union types; both operands have void type; both operands 871 | are pointers to qualified or unqualified versions of compatible types; 872 | one operand is a pointer and the other is a null pointer constant; or 873 | one operand is pointer to an object or incomplete type and the other 874 | is a pointer to a qualified or unqualified version of void. 875 | 3.3.15 876 | Duplicate label '%s' 877 | A label name can only occur once in a function. 878 | 3.1.2.1(25) 879 | Division by zero. 880 | 3.3.5 881 | Subscripting a non-array. 882 | 3.3.2.1 883 | Subscripting an array of incomplete type which is not an object type. 884 | The element of the array shall have an object type. 885 | 3.3.2.1 886 | Should only subscript an array with an integral expression 887 | 3.3.2.1 888 | Subscripting an unbounded array 889 | 3.3.2.1 890 | Array index out of range 891 | 3.3.2.1 892 | Selector requires struct/union pointer as left hand side 893 | In K&R mode the expression is implicitly converted to the '.' selector 894 | for a struct/union left-hand side. 895 | 3.3.2.3 896 | Selector requires struct/union as left hand side 897 | In K&R mode the expression is implicitly converted to the '->' selector 898 | for a struct/union pointer left-hand side. 899 | 3.3.2.3 900 | member of structure or union required 901 | 3.3.2.3 902 | types have different qualifier specifications 903 | For two qualified types to be compatible, both shall have the 904 | identically qualified version of a compatible type; qualified 905 | and unqualified versions of a type are distinct types. For two 906 | types to be compatible their types must be the same. 907 | 3.5.3(26) 908 | Incompatible array type due to different array size 909 | For two array types to be compatible, both shall have compatible element 910 | types; if both size specifiers are present, they shall have the 911 | same value. 912 | 3.5.4.2(11) 913 | Incompatible array type due to incompatible element type 914 | For two array types to be compatible, both shall have compatible element 915 | types. 916 | 3.5.4.2(11) 917 | Incompatible pointer type assignment 918 | The type pointed to by the left-hand side of simple assignment 919 | statement is incompatible with the type pointed to by the right-hand side. 920 | 3.3.16.1, 3.5.4.1(21) 921 | Incompatible base type of pointer type 922 | K&R feature. 923 | Type %s of %s is incompatible with type %s of %s 924 | Incompatible types can be resolved by casting or by other means. 925 | 3.3.16.1 926 | illegal combination of pointer and integer 927 | Assigning an integral expression to a pointer is a bad practice. 928 | Type for %s is incompatible with %s 929 | Incompatible types can be resolved by casting or by other means. 930 | 3.1.2.6 931 | Bad operand type for += or -= 932 | 3.3.16.2(26) 933 | A case or default label appears outside a switch statement 934 | A case or default label shall appear only in a switch statement. 935 | 3.6.1 936 | The controlling expression of the if statement is not scalar type 937 | The controlling expression of an if statement shall have scalar type. 938 | 3.6.4.1 939 | The controlling expression of switch statement is not integral type 940 | The controlling expression of an switch statement shall have integral type. 941 | 3.6.4.2(20) 942 | The case label is not an integral constant expression 943 | The case label shall be an integral constant expression. 944 | 3.6.4.2(22) 945 | Duplicate case label in the same switch statement 946 | No two of the case constant expressions in the same switch statement 947 | shall have the same value after conversion. 948 | 3.6.4.2(22) 949 | More than one default label in the same switch statement 950 | There may be at most one default label in a switch statement. 951 | 3.6.4.2(23) 952 | The controlling expression of the iteration statement is not scalar 953 | type 954 | The controlling expression of a iteration statement shall have scalar 955 | type. 956 | 3.6.5.1 957 | label '%s' used, but not defined 958 | The identifier in a goto statement shall name a label located 959 | somewhere in the enclosing function. 960 | 3.6.6.1 961 | A continue statement shall appear only in or as a loop body 962 | 3.6.6.2 963 | A break statement shall appear only in or as a switch body or loop body 964 | 3.6.6.3 965 | A return statement with an expression should not appear 966 | in a function '%s', whose return type is void 967 | 3.6.6.4(24) 968 | A return statement without an expression appears in a 969 | function '%s', whose return type is not void 970 | If a return statement without an expression is executed, and the value 971 | of the function call is used by the caller, the behavior is undefined. 972 | 3.6.6.4(33) 973 | Internal Error: statement stack underflow 974 | Long double not supported; double assumed. 975 | Long float not standard; double assumed. 976 | Only 'register' allowed in parameter declaration 977 | The only storage-class specifier that shall occur in a parameter 978 | declaration is 'register'; illegal storage class ignored. 979 | 3.5.4.3(25) 980 | Name(s) without types in a function declaration 981 | An old-style function declaration is not allowed to have names 982 | in the parameter list; useless names ignored 983 | 3.5.4.3(26) 984 | Functions cannot return functions 985 | 3.7.1(33), 3.3.2.2 986 | Functions cannot return a non-object type 987 | 3.3.2.2 988 | enum declaration must contain enum literals 989 | Although structs or unions may delay the declaration of their members, 990 | a similar construction with enum does not exist and is not necessary, 991 | as there can be no mutual dependencies between the declaration of an 992 | enumerated type and any other type. 993 | 3.5.2.3(27) 994 | Register qualification has no effect for this type of object 995 | Register declarations for array, struct, and function types have 996 | no effect. 997 | 3.5.1(16), 3.5.1(19) 998 | Functions cannot be declared 'register' 999 | The declaration of an identifier for a function that has block 1000 | scope shall have no explicit storage-class specifier other than 1001 | 'extern'. 1002 | 3.5.1(19) 1003 | '%s' cannot be initialized 1004 | The type of the entity to be initialized shall be an object type 1005 | or an array of unknown size. 1006 | 3.5.7(32) 1007 | Cannot initialize 'extern' variable '%s' within a function 1008 | If the declaration of an identifier has block scope, and the 1009 | identifier has 'extern' or 'static' linkage, the declaration 1010 | shall have no initializer for the identifier; initialization 1011 | allowed anyway. 1012 | 3.5.7(35) 1013 | initializing an 'extern' is an ANSI C extension 1014 | conflicting declarations for '%s' 1015 | 'static' and 'extern' declarations conflict. Which is meant? 1016 | 3.1.2.2(15), 3.1.2.2(27) 1017 | Too many initial values for '%s' 1018 | 3.5.7(1) 1019 | incompatible types in initialization 1020 | 3.3.16(35) 1021 | redefinition of '%s'; previous definition at line %s in file '%s' 1022 | Identifier redeclared in the same scope/block. 1023 | 3.1.2.3 1024 | bit-fields as members of a union are an ANSI C invention. 1025 | storage size for '%s' isn't known 1026 | type mismatch in initialization 1027 | Missing braces in a union initialization or illegally formed 1028 | initialization. 1029 | 3.5.7(5) 1030 | union '%s' only allowed one initializer for the first member 1031 | 3.5.7(5) 1032 | width of '%s' exceeds its type 1033 | the specified bitfield width is too large to be contained within a 1034 | bitfield type. 1035 | structure has no member named '%s' 1036 | This is allowed for compatibility with AT&T pcc-based compilers. 1037 | Reference of an expression of void type or an incomplete type. 1038 | 3.2.2.1 1039 | element size of an array shall not be zero 1040 | 3.2.2.5(25) 1041 | invalid combination of type specifiers 1042 | Although order is unimportant, not all type specifiers can occur together. 1043 | 3.5.2 1044 | declaration must at least declare an identifier, tag, or the member of an enumeration 1045 | 3.5(16) 1046 | at most one storage class may be given in the declaration 1047 | Duplicate occurrence ignored. 1048 | 3.5.1(10) 1049 | size of function's return type is zero 1050 | The return type of a function must be void or an object type other than array. 1051 | 3.7.1(33) 1052 | Expecting an integral return type from the main function 1053 | identifier missing from parameter declaration 1054 | Prototypes for function definitions require identifiers in parameter 1055 | declarations. 1056 | 3.7.1(4) 1057 | only 'register' allowed for storage class for parameters 1058 | The declarations in the declaration list shall contain no storage class 1059 | other than 'register', and no initializations. 1060 | 3.7.1(10) 1061 | parameters declarations can not have initializations 1062 | 3.7.1(10) 1063 | only one instance of 'void' allowed in the parameter list 1064 | 'void' must occur by itself (specifying that the function has no parameters). 1065 | 3.5.4.3(1) 1066 | %s must have function type 1067 | 1) An argument list must be explicitly present in the declarator; it cannot 1068 | be inherited from a typedef (3.5.4.3). 1069 | 2) The declarator is not a function. 1070 | 3.7.1(30) 1071 | Illegal hexadecimal constant 1072 | You have no digits after the 0x or 0X. 0x0 assumed. 1073 | 3.1.3.2 1074 | value overflows its type in this context. Value is set to be '%s'! 1075 | 3.2.1.4 1076 | value is outside range representable for type '%s' 1077 | missing member name 1078 | K&R mode permits a missing member name; otherwise, only bitfields can omit 1079 | the member name. 1080 | 3.5.2.1(10) 1081 | useless keyword or type name in declaration 1082 | Type was ignored. 1083 | '%s' declared within and is limited to this function prototype 1084 | Possible program error, since parameter type checking will always fail 1085 | unless the type declaration is visible to the caller. 1086 | 3.1.2.1(35) 1087 | Extra spaces within operator, %s assumed 1088 | In ANSI C, the compound assignment operator cannot have embedded 1089 | white space characters. 1090 | 3.1.5 1091 | missing size for array '%s' 1092 | Incomplete types permitted for identifiers with internal or 1093 | external linkage, but not automatic linkage. 1094 | 3.1.2.5(10) 1095 | can't jump into (from outside of) the body of a 'try' or into either type of handler 1096 | '%s' missing, please #include excpt.h 1097 | excpt.h required to declare exception statements, intrinsics or compiler 1098 | runtime names. 1099 | local function declarations cannot be 'static' 1100 | A function declaration can only contain the storage-class 'static' 1101 | if it is at file scope. Declaration made 'extern'. 1102 | 3.5.1(19) 1103 | static function '%s' declared and referenced, but not defined. 1104 | If an identifier declared with internal linkage is used in an 1105 | expression (other than as a part of the operand of a sizeof 1106 | operator), there shall be exactly one external definition for 1107 | the identifier in the translation unit. 1108 | 3.7(12) 1109 | pragma argument '%s' must be declared prior to being used in a pragma 1110 | Pragma name ignored. 1111 | Pragma not supported 1112 | '%s' not enabled as intrinsic 1113 | It may have already appeared in a function pragma, or never occurred in 1114 | an intrinsic pragma. 1115 | '%s' is already enabled as an intrinsic 1116 | weak definition for '%s' is later redefined; pragma weak ignored. 1117 | definition of primary name '%s' not found; pragma weak ignored. 1118 | definition of secondary name '%s' not found; pragma weak ignored. 1119 | primary name '%s' is declared as a common or external, and is not defined 1120 | with initial value within this file; pragma weak ignored. 1121 | useless '%s' storage class ignored 1122 | array of functions not allowed 1123 | The element type must be an object type representing a region 1124 | of data storage which can represent values. 1125 | 3.1.2.5(23) 1126 | array of voids not allowed 1127 | The element type must be an object type representing a region 1128 | of data storage which can represent values. 1129 | 3.1.2.5(23) 1130 | argument for pragma pack must be an integer constant; pragma ignored 1131 | '%s' has wrong tag type. 1132 | Identifier redeclared in the same scope/block. 1133 | 3.1.2.3 1134 | missing dimension bound 1135 | For multidimensional arrays, the constant bounds of the array may be 1136 | omitted only for the first member of the sequence. 1137 | 3.1.2.5(23) 1138 | Internal error in parameters to function substr; loc: '%s'; len: '%s'. 1139 | Internal error in parameters to function insertstr; indx: '%s'. 1140 | Internal error in function get_tag_name; input is a non-tagged type. 1141 | Internal error in function gen_type_str -- not a type tree '%s' 1142 | Cannot open file '%s' 1143 | Prototype should be moved after tag or a typedef declaration. 1144 | Please look for comments in the extracted header file. 1145 | The extracted header file includes prototypes for static functions, 1146 | which should be removed, if you wish to include the header in a source file 1147 | other than the originator. 1148 | ANSI C requires formal parameter before "..." 1149 | This extension is meant to be used for compatibility with varargs.h 1150 | 3.5.4.3(35) 1151 | syntax error: "&..." invalid 1152 | extension used to access "..." formal arguments. 1153 | function '%s' initialized like a variable 1154 | The type of entity to be initialized shall be an object type or an 1155 | array of unknown size. 1156 | 3.5.7(31) 1157 | initializer not an array aggregate 1158 | The initializer for an object that has aggregate type shall be a 1159 | brace-enclosed list of initializers for the members of the aggregate, 1160 | written in increasing subscript or member order. 1161 | 3.5.7(20) 1162 | '%s' type is incomplete; cannot initialize 1163 | Was the struct ever defined? 1164 | 3.5.7.(31) 1165 | '%s' is not standard ANSI. 1166 | This keyword/type is not defined in strict ANSI mode. 1167 | 3.1.1 1168 | not a legal asm string 1169 | The first operand of an asm string should be, after argument substitution, 1170 | a legal assembly string. 1171 | The -float option will be ignored in ANSI mode. 1172 | The -float option is ignored, since otherwise program semantics would 1173 | violate the ANSI standard. In particular, fp constants are always 1174 | 'double' with ANSI-C, while with -float the type of fp constants will 1175 | depend on the context and may be 'float'. 1176 | ANSI C support unavailable with C compiler bundled with RISC/os 1177 | The C compiler bundled with RISC/os does not support ANSI C. ANSI 1178 | C support requires a separate license. 1179 | Ignored invalid warning number(s) in -woff option, %s%s ! 1180 | Warning numbers must be in the range %s to %s. 1181 | The set of warning numbers in cfe is disjoint from the set of warning numbers 1182 | in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. 1183 | '%s' not handled as an intrinsic due to incompatible argument types . 1184 | '__unalign' only qualifies pointers 1185 | '__unalign' indicates the object pointed at by pointer is unaligned (e.g., 1186 | int * __unalign p). This is an extension to ANSI C and like 'volatile' 1187 | and 'const' can follow the '*' in pointer declarations, but unlike both 1188 | cannot qualify a base type. 1189 | index expression is an anachronism 1190 | ANSI C++ doesn't support array index expressions in delete. 1191 | 5.3.4 1192 | member cannot be of function or incomplete type. 1193 | 3.5.2.1(12) 1194 | Illegal lint option, '%s', is ignored. 1195 | cannot open header message buffer file 1196 | cannot write header message buffer file 1197 | cannot read header message buffer file 1198 | cannot seek in header message buffer file 1199 | struct/union/enum '%s' is used, but not defined 1200 | static '%s' unused 1201 | nonportable character comparison (chars may be signed or unsigned) 1202 | redundant comparison of unsigned with constant expression 1203 | redundant statement, control flow cannot reach this statement 1204 | '%s' may be used before set 1205 | function parameter '%s' is not used in function '%s' 1206 | '%s' can be const qualified, since it is not set within its lifetime. 1207 | '%s' is not used in function '%s' 1208 | '%s' set but unused in function '%s' 1209 | control may fall through %s statement 1210 | function '%s' has return(e); and return; 1211 | function '%s' may return random value to place of invocation %s 1212 | label without goto: '%s' 1213 | width of %s constant is smaller than size of type (%s) 1214 | explicit conversion from '%s' to '%s' %s 1215 | implicit conversion from '%s' to '%s' %s 1216 | '%s' may be indistinguishable from '%s' due to internal name truncation 1217 | Promoted formal parameter and promoted argument have incompatible types 1218 | No prototype for the definition of '%s' %s 1219 | References to '%s' are substituted by its literal initializer 1220 | (as included in %s) 1221 | ============== 1222 | unsupported language linkage 1223 | string-literal specifies an unsupported linkage 1224 | 7.4(1) 1225 | No prototype for the call to %s 1226 | To achieve better type-checking, there should be a full prototype for 1227 | the function being called. 1228 | 3.5.4.3 1229 | 'inline' only applies to function declarations 1230 | leave statment can occur only within try body 1231 | Microsoft extension 1232 | Use of a Microsoft extension detected without usage of the 1233 | compiler option -msft. 1234 | No parameter mentioned 1235 | A file with no declarations or definitions is accepted as an extension to ANSI C 1236 | The translation unit must contain at least one external definition. 1237 | 3.7 1238 | Incompatible signed and unsigned version of a type 1239 | Yacc initialization error 1240 | Internal error: yacc cannot initialize itself. 1241 | The cfe option %s may not be in future releases. We suggest that you not use this option! 1242 | Incompatible char and unsigned char versions of a type 1243 | Lshift with undefined behaviour. 1244 | Lshift with a negative right operand, or a right operand that is greater 1245 | than or equal to the width in bits of the promoted left operand, results 1246 | in undefined behaviour. 1247 | 3.3.7(11) 1248 | useless type name in declaration, possibly a semicolon is missing. 1249 | Type was ignored. 1250 | constant initializer expression is invalid (refers to automatic variables). 1251 | All the expressions in an initializer for an object that has static storage 1252 | duration or in the initializer list for an object that has aggregate or 1253 | union type shall be constant expressions. Otherwise, unexpected results 1254 | may occur. 1255 | 3.5.7(32) and 3.4 1256 | invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. 1257 | An address constant in a constant initializing expression can neither 1258 | initialize a bit-field nor be directly or indirectly converted to an 1259 | integral type of size different from an address type. 1260 | 6.4 1261 | -------------------------------------------------------------------------------- /ido/5.3/usr/lib/libc.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/libc.so.1 -------------------------------------------------------------------------------- /ido/5.3/usr/lib/libexc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/libexc.so -------------------------------------------------------------------------------- /ido/5.3/usr/lib/libgen.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/libgen.so -------------------------------------------------------------------------------- /ido/5.3/usr/lib/libm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/libm.so -------------------------------------------------------------------------------- /ido/5.3/usr/lib/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/ugen -------------------------------------------------------------------------------- /ido/5.3/usr/lib/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/ujoin -------------------------------------------------------------------------------- /ido/5.3/usr/lib/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/uld -------------------------------------------------------------------------------- /ido/5.3/usr/lib/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/umerge -------------------------------------------------------------------------------- /ido/5.3/usr/lib/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/uopt -------------------------------------------------------------------------------- /ido/5.3/usr/lib/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/5.3/usr/lib/usplit -------------------------------------------------------------------------------- /ido/7.1/lib/cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/lib/cpp -------------------------------------------------------------------------------- /ido/7.1/lib/libc.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/lib/libc.so.1 -------------------------------------------------------------------------------- /ido/7.1/lib/libmalloc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/lib/libmalloc.so -------------------------------------------------------------------------------- /ido/7.1/lib/rld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/lib/rld -------------------------------------------------------------------------------- /ido/7.1/usr/bin/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/bin/cc -------------------------------------------------------------------------------- /ido/7.1/usr/lib/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/as1 -------------------------------------------------------------------------------- /ido/7.1/usr/lib/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/cfe -------------------------------------------------------------------------------- /ido/7.1/usr/lib/err.english.cc: -------------------------------------------------------------------------------- 1 | @ 2 | 358 358 358 3 | 6464 6482 6553 4 | 6553 6593 6728 5 | 6728 6746 6803 6 | 6803 6808 6808 7 | 6808 6818 6818 8 | 6818 6826 6826 9 | 6826 6847 6847 10 | 6847 6875 6922 11 | 6922 6930 6930 12 | 6930 6939 6939 13 | 6939 6948 6948 14 | 6948 6974 7120 15 | 7120 7149 7204 16 | 7210 7248 7311 17 | 7317 7350 7442 18 | 7450 7497 7627 19 | 7635 7709 7930 20 | 7938 7975 8063 21 | 8071 8113 8253 22 | 8261 8289 8289 23 | 8298 8338 8445 24 | 8460 8502 8635 25 | 8650 8690 8819 26 | 8834 8857 8965 27 | 8965 9008 9113 28 | 9119 9142 9227 29 | 9235 9282 9451 30 | 9451 9462 9462 31 | 9462 9477 9477 32 | 9477 9497 9497 33 | 9497 9545 9545 34 | 9545 9584 9584 35 | 9584 9604 9662 36 | 9662 9682 9720 37 | 9720 9749 9749 38 | 9749 9788 9788 39 | 9788 9802 9802 40 | 9802 9829 9829 41 | 9829 9861 9861 42 | 9861 9904 9904 43 | 9904 9920 9920 44 | 9920 9962 9962 45 | 9962 9988 9988 46 | 9988 10014 10014 47 | 10014 10035 10035 48 | 10035 10054 10097 49 | 10097 10115 10115 50 | 10115 10147 10147 51 | 10147 10183 10183 52 | 10183 10208 10208 53 | 10208 10236 10236 54 | 10236 10269 10269 55 | 10269 10304 10304 56 | 10304 10328 10328 57 | 10328 10351 10351 58 | 10351 10371 10371 59 | 10371 10402 10402 60 | 10402 10447 10447 61 | 10447 10497 10497 62 | 10497 10533 10533 63 | 10533 10598 10598 64 | 10606 10630 10630 65 | 10640 10671 10671 66 | 10690 10719 10719 67 | 10728 10752 10795 68 | 10795 10837 10837 69 | 10837 10876 10876 70 | 10876 10900 10900 71 | 10900 10948 10948 72 | 10960 11021 11103 73 | 11103 11128 11128 74 | 11128 11153 11153 75 | 11153 11216 11216 76 | 11216 11239 11239 77 | 11239 11303 11303 78 | 11303 11347 11347 79 | 11357 11393 11393 80 | 11393 11432 11432 81 | 11442 11494 11494 82 | 11494 11536 11536 83 | 11536 11595 11595 84 | 11595 11622 11622 85 | 11622 11684 11684 86 | 11684 11726 11726 87 | 11738 11778 11778 88 | 11782 11813 11813 89 | 11813 11850 11850 90 | 11850 11900 12087 91 | 12111 12120 12120 92 | 12120 12129 12129 93 | 12129 12158 12158 94 | 12158 12192 12192 95 | 12192 12237 12237 96 | 12237 12273 12273 97 | 12273 12326 12326 98 | 12330 12366 12366 99 | 12366 12423 12423 100 | 12427 12482 12482 101 | 12486 12560 12560 102 | 12568 12631 12631 103 | 12637 12691 12691 104 | 12691 12743 12743 105 | 12743 12785 12785 106 | 12785 12826 12826 107 | 12826 12865 12865 108 | 12865 12883 12883 109 | 12883 12946 12946 110 | 12956 12995 12995 111 | 13005 13066 13066 112 | 13077 13163 13163 113 | 13163 13211 13211 114 | 13211 13270 13270 115 | 13270 13318 13318 116 | 13318 13350 13350 117 | 13350 13387 13387 118 | 13387 13428 13428 119 | 13428 13464 13533 120 | 13533 13580 13737 121 | 13737 13776 13854 122 | 13854 13913 13913 123 | 13913 13950 13950 124 | 13950 14118 14118 125 | 14118 14150 14150 126 | 14150 14163 14194 127 | 14194 14224 14255 128 | 14255 14275 14319 129 | 14319 14353 14458 130 | 14466 14484 14530 131 | 14534 14567 14567 132 | 14567 14635 14682 133 | 14690 14742 14742 134 | 14742 14789 14789 135 | 14801 14875 14875 136 | 14886 14947 14947 137 | 14947 14992 14992 138 | 14992 15035 15085 139 | 15085 15134 15205 140 | 15214 15267 15448 141 | 15454 15496 16810 142 | 16822 16875 16960 143 | 16972 17053 17179 144 | 17191 17236 17332 145 | 17344 17491 17841 146 | 17853 17939 18304 147 | 18316 18471 18774 148 | 18786 18952 19323 149 | 19335 19364 19496 150 | 19500 19527 19598 151 | 19598 19613 19776 152 | 19797 19808 19837 153 | 19837 19862 19862 154 | 19868 19927 20026 155 | 20034 20075 20179 156 | 20187 20223 20223 157 | 20223 20290 20382 158 | 20392 20441 20589 159 | 20601 20656 20656 160 | 20656 20699 20818 161 | 20826 20860 21038 162 | 21046 21094 21191 163 | 21203 21236 21314 164 | 21326 21395 21457 165 | 21469 21502 21502 166 | 21502 21587 21731 167 | 21756 21789 21864 168 | 21875 21901 21976 169 | 22013 22059 22220 170 | 22257 22397 22561 171 | 22561 22595 22595 172 | 22603 22623 22623 173 | 22631 22667 22828 174 | 22865 22919 22994 175 | 23031 23059 23120 176 | 23132 23201 23201 177 | 23212 23274 23274 178 | 23285 23345 23345 179 | 23356 23393 23393 180 | 23399 23431 23532 181 | 23542 23587 23646 182 | 23656 23697 23745 183 | 23755 23796 23844 184 | 23854 23876 23928 185 | 23942 23971 24153 186 | 24160 24243 24243 187 | 24247 24273 24743 188 | 24755 24784 24984 189 | 24996 25034 25034 190 | 25034 25075 25273 191 | 25281 25332 25410 192 | 25420 25467 25544 193 | 25554 25583 25744 194 | 25754 25783 26061 195 | 26071 26111 26185 196 | 26194 26239 26525 197 | 26535 26568 26914 198 | 26924 26951 26998 199 | 27008 27035 27082 200 | 27093 27120 27167 201 | 27178 27206 27251 202 | 27261 27289 27334 203 | 27345 27391 27931 204 | 27938 27959 28007 205 | 28019 28037 28037 206 | 28043 28069 28069 207 | 28077 28147 28199 208 | 28207 28266 28266 209 | 28274 28306 28306 210 | 28314 28339 28339 211 | 28347 28404 28510 212 | 28518 28567 28682 213 | 28690 28728 28728 214 | 28736 28782 29023 215 | 29033 29085 29234 216 | 29246 29303 29383 217 | 29395 29432 29570 218 | 29592 29631 29644 219 | 29644 29693 29758 220 | 29767 29810 29875 221 | 29875 29911 29976 222 | 29984 30014 30014 223 | 30027 30086 30151 224 | 30157 30223 30293 225 | 30301 30369 30445 226 | 30457 30511 30568 227 | 30580 30630 30743 228 | 30755 30812 30874 229 | 30886 30959 31035 230 | 31043 31076 31175 231 | 31183 31243 31243 232 | 31251 31323 31323 233 | 31331 31433 31433 234 | 31445 31544 31686 235 | 31698 31740 31740 236 | 31740 31783 31783 237 | 31783 31824 31824 238 | 31824 31873 31996 239 | 32008 32056 32164 240 | 32176 32210 32210 241 | 32229 32271 32271 242 | 32279 32323 32569 243 | 32581 32642 32718 244 | 32739 32779 32916 245 | 32926 32953 33047 246 | 33057 33116 33315 247 | 33325 33373 33373 248 | 33373 33407 33469 249 | 33494 33527 33527 250 | 33536 33573 33573 251 | 33584 33650 33697 252 | 33705 33763 33763 253 | 33763 33797 33797 254 | 33797 33829 33906 255 | 33915 33976 33976 256 | 33985 34016 34098 257 | 34098 34133 34198 258 | 34198 34261 34261 259 | 34269 34312 34312 260 | 34324 34363 34438 261 | 34444 34530 34530 262 | 34538 34596 34626 263 | 34636 34675 34754 264 | 34764 34821 34821 265 | 34821 34867 34950 266 | 34959 35016 35135 267 | 35145 35198 35198 268 | 35208 35266 35344 269 | 35355 35382 35537 270 | 35547 35576 35629 271 | 35637 35705 35705 272 | 35713 35764 35764 273 | 35764 35784 35876 274 | 35888 35932 35950 275 | 35950 36013 36138 276 | 36150 36191 36280 277 | 36286 36314 36419 278 | 36431 36516 36516 279 | 36516 36554 36642 280 | 36642 36689 36808 281 | 36818 36881 37105 282 | 37113 37183 37204 283 | 37204 37225 37225 284 | 37225 37255 37348 285 | 37348 37388 37388 286 | 37388 37454 37454 287 | 37454 37518 37518 288 | 37518 37584 37584 289 | 37584 37717 37717 290 | 37717 37752 37752 291 | 37752 37783 37889 292 | 37901 37928 38034 293 | 38046 38115 38115 294 | 38115 38140 38187 295 | 38195 38219 38339 296 | 38351 38422 38422 297 | 38422 38486 38486 298 | 38486 38555 38555 299 | 38555 38619 38619 300 | 38619 38641 38641 301 | 38641 38758 38758 302 | 38758 38929 38929 303 | 38929 38975 39043 304 | 39055 39084 39133 305 | 39133 39175 39265 306 | 39275 39310 39494 307 | 39504 39547 39576 308 | 39587 39614 39668 309 | 39674 39697 39797 310 | 39797 39845 40094 311 | 40094 40158 40264 312 | 40264 40369 40523 313 | 40523 40593 40593 314 | 40593 40629 40876 315 | 40876 40911 40971 316 | 40977 41026 41026 317 | 41038 41077 41077 318 | 41077 41116 41116 319 | 41116 41156 41156 320 | 41156 41195 41195 321 | 41195 41237 41237 322 | 41237 41285 41285 323 | 41285 41304 41304 324 | 41304 41371 41371 325 | 41371 41429 41429 326 | 41429 41491 41491 327 | 41491 41519 41519 328 | 41519 41572 41572 329 | 41572 41642 41642 330 | 41642 41676 41676 331 | 41676 41713 41713 332 | 41713 41751 41751 333 | 41751 41792 41792 334 | 41792 41856 41856 335 | 41856 41881 41881 336 | 41881 41944 41944 337 | 41944 41985 41985 338 | 41985 42026 42026 339 | 42026 42098 42098 340 | 42098 42170 42170 341 | 42170 42213 42213 342 | 42213 42275 42275 343 | 42275 42302 42302 344 | 42302 42317 42317 345 | 42317 42346 42394 346 | 42401 42433 42530 347 | 42538 42585 42585 348 | 42585 42631 42631 349 | 42631 42651 42733 350 | 42733 42756 42756 351 | 42756 42837 42905 352 | 42909 42960 42960 353 | 42960 42986 43033 354 | 43033 43124 43124 355 | 43124 43179 43179 356 | 43179 43212 43384 357 | 43394 43461 43479 358 | 43479 43555 43788 359 | 43806 43929 44124 360 | 44128 44128 44128 361 | Out of memory: %s 362 | There is no more memory left in the system for compiling this program. 363 | Internal Error Unknown Error Message %s 364 | 1) An internal error, while attempting to print an unavailable message 365 | 2) The error message file is inaccessible or has other problems 366 | Unknown Signal %s 367 | 1) An unknown signal has been caught 368 | 2) 2 Nested signals 369 | line 370 | Warning: 371 | Fatal: 372 | Source not available 373 | Too many errors... goodbye. 374 | There is a limit of 30 errors before aborting. 375 | Error: 376 | reserved 377 | reserved 378 | Unknown Control Statement 379 | 1) The line begins with a '#' and is not of the form: 380 | # "" 381 | 2) Please compile this program with the preprocessor enabled. 382 | Unknown character %s ignored 383 | The character is not part of the source character set. 384 | 2.2.1 385 | Unknown control character \%s ignored 386 | The control character is not part of the source character set. 387 | 2.2.1 388 | Illegal character %s in exponent 389 | 1) Digits or sign expected after 'e' or 'E'. 390 | 2) Digits are expected after sign in exponent. 391 | 3.1.3.1 392 | Constant is out of range and may be truncated. 393 | The constant is too large to be accurately represented and may be 394 | truncated. The limits are in the system include file limits.h. 395 | 2.2.4.2 396 | Constant is out of range for a 32-bit data type, but accepted as written. 397 | The constant is too large to fit in a 32-bit data type, but will be 398 | accurately represented in a wider data type. The value may be truncated, 399 | depending on its context. The limits are in the system include file 400 | limits.h. 401 | 2.2.4.2 402 | Character constant size out of range 403 | 1) No characters in a character constant. 404 | 2) More than 4 bytes in a character constant. 405 | 3.1.3.4 406 | Wide character constant size out of range 407 | 1) No characters in the multibyte sequence (0 assumed). 408 | 2) More than 1 byte in the multi-byte sequence (only the first byte was converted). 409 | 3.1.3.4 410 | Invalid multibyte character 411 | 4.10.7.2 412 | Newline in string or character constant 413 | 1) Terminate your string or character constant with closing quotes. 414 | 2) Put a backslash before the newline. 415 | 3.1.3.4, 3.1.4 416 | Octal character escape too large: %s > %s 417 | 1) Terminate end of octal sequence with a non-octal character. 418 | 2) Select a character value within the limits. 419 | Value may be truncated 420 | 3.1.3.4, 3.1.4 421 | Hex character escape too large: %s > %s 422 | 1) Terminate end of hex sequence with a non-hex character. 423 | 2) Select a character value within the limits. 424 | Value may be truncated 425 | 3.1.3.4, 3.1.4 426 | Unexpected End-of-file 427 | 1) Unterminated string or character constant 428 | 2) Missing closing comment marker (*/) 429 | 3) File system problems 430 | Unrecognized escape sequence in string \%s 431 | Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. 432 | Character will be treated as un-escaped. 433 | 3.9.2 434 | Illegal octal digit %s 435 | Octal constants, beginning with 0, must only have digits between 0 and 7, 436 | inclusive. 437 | 3.1.3.2 438 | Unable to open temporary file for compiling %s 439 | 1) TMPDIR environment variable is set to a directory that you have no 440 | permissions for. 441 | 2) The file system is full. 442 | 3) System errors beyond the scope of the compiler. 443 | %s: Hangup 444 | %s: Interrupt 445 | %s: Quit (ASCII FS) 446 | %s: Illegal instruction (not reset when caught) 447 | %s: Trace trap (not reset when caught) 448 | %s: IOT instruction 449 | Also SIGABRT, used by abort, replace SIGIOT in the future 450 | %s: EMT instruction 451 | Also SIGXCPU, Exceeded CPU time limit 452 | %s: Floating point exception 453 | %s: Kill (cannot be caught or ignored) 454 | %s: Bus error 455 | %s: Segmentation violation 456 | %s: Bad argument to system call 457 | %s: Write on a pipe with no one to read it 458 | %s: Alarm clock 459 | %s: Software termination signal from kill 460 | %s: User defined signal 1 461 | %s: User defined signal 2 462 | %s: Death of a child 463 | Power-fail restart 464 | %s: Also SIGXFSZ, exceeded file size limit 465 | %s: Window change 466 | %s: Handset, line status change 467 | %s: Sendablestop signalnot from tty 468 | %s: Stop signal from tty 469 | %s: Pollable event occurred 470 | %s: Input/Output possible signal 471 | %s: Urgent condition on IO channel 472 | %s: Window size changes 473 | %s: Virtual time alarm 474 | %s: Profiling alarm 475 | %s: Continue a stopped process 476 | %s: To readers pgrp upon background tty read 477 | %s: Like TTIN for output if (tp->t_local<OSTOP) 478 | %s: Resource lost (eg, record-lock) 479 | 'auto' and 'register' are not allowed in an external declaration 480 | 3.7(10) 481 | must have function type 482 | 3.7.1(30) 483 | Functions cannot return arrays 484 | 3.7.1(33), 3.3.2.2 485 | Declaration list not allowed 486 | 3.7.1(5) 487 | Too many input files %s 488 | The command line may contain only one file 489 | cpp internal error: input stack underflow 490 | cpp internal error: if stack underflow 491 | Cannot open the file %s 492 | No new-line character at the end of the file %s 493 | 2.1.1.2(30) 494 | Fatal: Exceeded the limit of nesting level for #include file 495 | Fatal: Exceeded the limit of nesting level for #include file. This limit 496 | is 200. 497 | Fail to read the file %s 498 | Cannot write the file %s 499 | %s: %s: An if directive is not terminated properly in the file 500 | %s: %s: nested comment 501 | %s:%s: Illegal macro name %s; macro name shall be an identifier 502 | %s:%s: Illegal preprocessing token sequence 503 | 3.8.3(35) 504 | %s:%s: Illegal macro parameter name 505 | %s:%s: Non-unique macro parameter name 506 | 3.8.3(18) 507 | %s:%s: Missing ')' in parameter list for #define %s 508 | %s:%s: Missing ')' in macro instantiation 509 | %s:%s: Bad punctuator in the parameter list for #define %s 510 | %s:%s: Macro %s redefined. 511 | %s:%s: # operator should be followed by a macro argument name 512 | %s:%s: Badly formed constant expression%s 513 | 3.4(9), 3.8 514 | %s:%s: Division by zero in #if or #elif 515 | 3.8 516 | unknown command line option %s 517 | extraneous input/output file name %s 518 | %s: %s: Unterminated string or character constant 519 | A preprocessing string or character constant token was not 520 | terminated. Note that preprocessing directives are processed 521 | after the source file has been divided into preprocessing tokens. 522 | 2.1.1.2(30) 3.1(18) 3.8 523 | %s: %s: 524 | %s: %s: 525 | %s: %s: Unterminated comment 526 | %s: %s: Unknown directive type %s 527 | %s: %s: #elif or #else after #else directive 528 | %s: %s: Bad identifier after the %s 529 | %s: %s: #%s accepts only one identifier as parameter 530 | 3.8 531 | %s: %s: Bad identifier after the %s 532 | %s: %s: text following #%s violates the ANSI C standard. 533 | 3.8 534 | %s: %s: Bad character %s occurs after the # directive. 535 | 3.8 536 | %s: %s: the ## operator shall not be the %s token in the replacement list 537 | 3.8.3.3 538 | %s: %s: the defined operator takes identifier as operand only. 539 | 3.8.1 540 | %s: %s: Not in a conditional directive while using %s 541 | %s: %s: Illegal filename specification for #include 542 | %s: %s: Invalid file name %s for #include 543 | %s: %s: Cannot open file %s for #include 544 | %s: %s: Bad argument for #line command 545 | %s: %s: #error %s 546 | %s: %s: Tried to redefine predefined macro %s, attempt ignored 547 | 3.8.7(22) 548 | %s: %s: Undefining predefined macro %s 549 | 3.8.7(22) 550 | %s: %s: Undefined the ANSI standard library defined macro %s 551 | 4.1.2.1(9) 552 | %s: %s: The number of arguments in the macro invocation does not match the definition 553 | %s: %s: Illegal character %s in preprocessor if 554 | %s: %s: Illegal character %s for number in preprocessor if 555 | %s: %s: No string is allowed in preprocessor if 556 | %s: %s: Not supported pragma %s 557 | %s: %s: Not supported #pragma format 558 | %s: %s: ANSI C does not allow #ident; %s 559 | %s: %s: Not supported #ident format 560 | This cpp extension accepts the following format: 561 | #ident "any string" 562 | %s: %s: Not supported #assert/#unassert format 563 | This cpp extension accepts the following format: 564 | #assert identifier 565 | #assert identifier ( pp-tokens ) 566 | #unassert identifier 567 | #unassert identifier ( pp-tokens ) 568 | %s: %s: Bad assertion predicate format 569 | The correct syntax for this cpp extension is: 570 | #assert identifier ( pp-token ) 571 | %s: %s: directive is an upward-compatible ANSI C extension 572 | %s: This option requires an argument 573 | %s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. 574 | A status return from cpp to cfe 575 | Syntax Error 576 | The token read was unexpected. 577 | Syntax Error -- cannot backup 578 | The token read was unexpected. 579 | Yacc stack overflow 580 | The expression is too complicated to parse. 581 | Trailing comma in enumerator list 582 | The use of a trailing comma in an enumerator list is not standard C. There 583 | may be portability problems. 584 | 3.5.2.2 585 | Empty declaration 586 | Empty declarations are invalid in standard C. 587 | 3.5 588 | %s declared, but not referenced. 589 | redeclaration of '%s'; previous declaration at line %s in file '%s' 590 | Identifier redeclared in the same scope/block. 591 | 3.1.2.3 592 | '%s' undefined; reoccurrences will not be reported. 593 | Non-function name referenced in function call. 594 | 3.3.2.2(18) 595 | The number of arguments doesn't agree with the number in the declaration. 596 | 3.3.2.2(5) 597 | '%s' section name longer than 8 characters. Name truncated. 598 | '%s' is already placed by pragma alloc_text. 599 | Cannot write ucode file while compiling %s 600 | 1) The file system is full 601 | 2) Permissions problem 602 | Must have corresponding formal argument for '%s' 603 | Parameter found in the declaration part, but not in the argument list. 604 | 3.7.1(7) 605 | Non-prototype declaration is an obsolescent feature. 606 | The use of function definitions with separate parameter identifier 607 | and declaration lists (not prototype-format parameter type and 608 | identifier declarators) is an obsolescent feature. 609 | 3.9.5 610 | Incompatible function declarations for %s 611 | For two function types to be compatible, both shall specify compatible 612 | return types. Moreover, the parameter type lists, if both are present, 613 | shall agree in the number of parameters and in use of the ellipsis 614 | terminator; corresponding parameters shall have compatible types. If 615 | one type has a parameter type list and the other type is specified by 616 | a function declarator that is not part of a function definition and 617 | contains an empty identifier list, the parameter list shall not have 618 | an ellipsis terminator and the type of each parameter shall be 619 | compatible with they type that results from application of the default 620 | argument promotions. If one type has a parameter type list and the 621 | other is specified by a function definition that contains a (possibly 622 | empty) identifier list, both shall agree in the number of parameters, 623 | and the type of each prototype parameter shall be compatible with the 624 | type that results from application of the default argument promotions 625 | to the type of the corresponding identifier. (For each parameter 626 | declared with function or array type, its type for these comparisons 627 | is the one that results from conversion to a pointer type. For each 628 | parameter declared with qualified type, its type for these comparisons 629 | is the unqualified version of its declared type.) There you have it! 630 | 3.5.4.3(15) 631 | Incompatible function return type for this function. 632 | For two function types to be compatible, both shall specify compatible 633 | return types. 634 | 3.5.4.3(15) 635 | The number of parameters for function is different from the previous declaration 636 | The parameter type lists, if both are present, shall agree in the 637 | number of parameters and in use of the ellipsis terminator. 638 | 3.5.4.3(15) 639 | Incompatible type for the function parameter 640 | If both parameter type lists are present, corresponding 641 | parameters shall have compatible types. 642 | 3.5.4.3(15) 643 | Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. 644 | The redeclaration could cause arguments at a call site to be passed 645 | inconsistently with what the function implementation expects, and 646 | parameters would therefore be accessed erroneously when executing the 647 | function body. Note that a float argument is promoted to a double 648 | when passed (potentially through fp registers) to an unprototyped 649 | function. 650 | 3.5.4.3(15) 651 | prototype and non-prototype declaration found for %s, ellipsis terminator not allowed 652 | If one type has a parameter type list and the other type is specified 653 | by a function declarator that is not part of a function definition and 654 | contains an empty identifier list, the parameter list shall not have 655 | an ellipsis terminator and the type of each parameter shall be 656 | compatible with they type that results from application of the default 657 | argument promotions. 658 | 3.5.4.3(15) 659 | prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion 660 | If one type has a parameter type list and the other type is specified 661 | by a function declarator that is not part of a function definition and 662 | contains an empty identifier list, the type of each parameter shall be 663 | compatible with the type that results from application of the default 664 | argument promotions. 665 | 3.5.4.3(15) 666 | prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion 667 | If one type has a parameter type list and the other is specified by a 668 | function definition that contains a (possibly empty) identifier list, 669 | both shall agree in the number of parameters, and the type of each 670 | prototype parameter shall be compatible with the type that results 671 | from application of the default argument promotions to the type of the 672 | corresponding identifier. 673 | 3.5.4.3(15) 674 | Empty declaration specifiers 675 | Standard C requires at least a storage class specifier, type specifier, 676 | or a type qualifier in declarations. 'extern int' assumed. 677 | 3.5 678 | Can't write to the file %s 679 | 1) The output file cannot be opened for writing. 680 | 2) Out of file space. 681 | Duplicate '%s' 682 | typedef, extern, static, auto, register, const, volatile may not 683 | appear more than once in the same specifier list or qualifier list. 684 | Duplicate occurrence ignored. 685 | 3.5.1(10) , 3.5.3(5) 686 | Null input 687 | There is nothing to compile. 688 | Illegal type combination 689 | 3.5.2 690 | Missing ';' at end of structure / union member declaration 691 | In standard C, each member declaration must be terminated by a ';'. A 692 | terminating ';' is assumed. 693 | 3.5.2.1 694 | Missing member name in structure / union 695 | In standard C, each member declaration have a member name. The missing 696 | member is assumed to not exist. 697 | 3.5.2.1 698 | This variable is initialized twice. 699 | Neither 'const' or 'volatile' have any effect on function results. 700 | Qualifiers only apply to expressions designating an object that 701 | can be altered or examined. 702 | 3.5.3(10) 703 | An integer constant expression is required here. 704 | The expression that defines the value of an enumeration constant 705 | shall be an integral constant expression that has a value 706 | representable as an int. 707 | 3.5.2.2(28) 708 | (previous declaration of '%s' at line %s in file '%s') 709 | Must be an integer type greater than zero. 710 | The array size must be either a char, signed or unsigned integer or 711 | an enumerated type with a value greater than zero. 712 | 3.5.4.2 713 | Array size cannot be a long long. 714 | Arrays with more than 2^32 elements are not yet supported. 715 | The array size must be either a char, signed or unsigned integer or 716 | an enumerated type with a value greater than zero. 717 | 3.5.4.2 718 | bit-field '%s' width is not an integer constant 719 | The expression that specifies the width of a bit-field shall be an 720 | integral constant expression. 721 | 3.5.2.1(15) 722 | bit-field '%s' width is negative 723 | The expression that specifies the width of a bit-field shall be 724 | non-negative. 725 | 3.5.2.1(15) 726 | bit-field '%s' type required to be int, unsigned int, or signed int. 727 | A bit-field shall have type int, unsigned int, or signed int. 728 | 3.5.2.1(30) 729 | bit-field %s's type not integer. 730 | Non-scalar type or pointer type to a non-object for increment or decrement operator. 731 | The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. 732 | 3.3.2.4(37), 3.3.3.1(25) 733 | Assign value to a function type. 734 | An assignment operator shall have a modifiable lvalue as its left operand. 735 | 3.2.2.1(5) 736 | Assign value to an array. 737 | An assignment operator shall have a modifiable lvalue as its left operand. 738 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 739 | Change value for variable of incomplete type. 740 | The operand of increment and decrement operator shall be a modifiable 741 | scalar lvalue. An assignment operator shall have a modifiable lvalue 742 | as its left operand. 743 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 744 | The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. 745 | This is a restriction in our implementation, which can be worked 746 | around by always accessing long long bit-fields indirectly (i.e. 747 | by means of the '->' operator). 748 | This expression is not an lvalue. 749 | 3.2.2.1 750 | Modified an rvalue. 751 | 3.2.2.1 752 | Change value for constant variable. 753 | The operand of increment and decrement operators shall be modifiable 754 | scalar lvalues. An assignment operator shall have a modifiable lvalue 755 | as its left operand. 756 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 757 | Change value for constant field of a struct or union. 758 | An assignment operator shall have a modifiable lvalue as its left operand. 759 | 3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) 760 | Dereferenced a non-pointer. 761 | The operand of the unary * operator shall have pointer type. 762 | 3.3.3.2(39) 763 | The operand of the unary + or - operator shall have arithmetic type. 764 | 3.3.3.3(6) 765 | The operand of the unary ~ operator shall have integral type. 766 | 3.3.3.3(6) 767 | The operand of the unary ! operator shall have scalar type. 768 | 3.3.3.3(6) 769 | Constants must have arithmetic type. 770 | 3.1.3 771 | Bad type name for cast operator 772 | The type name for the cast operator should either be void or a 773 | qualified or unqualified scalar type. 774 | 3.3.4(22) 775 | Improper cast of non-scalar type expression. 776 | The operand for the cast operator shall be of scalar type. 777 | 3.3.4(23) 778 | Cast a pointer into a non-integral type. 779 | A pointer may be converted to an integral type. 780 | 3.3.4(31) 781 | Cast a non-integral type into a pointer. 782 | An integral type may be converted to a pointer. 783 | 3.3.4(31) 784 | Duplicate member '%s' 785 | Two members of a struct may not have the same name. 786 | 3.1.2.2(7,25) 787 | Invalid constant expression. 788 | Constant expressions shall not contain assignment, increment, decrement, 789 | function-call, or comma operators, except when they are contained within 790 | the operand of the sizeof operator. 791 | 3.4(9) 792 | Constant expressions must be derived from a constant value or a constant 793 | variable. 794 | 3.4 795 | Dangerous operand of '&'. 796 | The operand of the unary & operator shall be either a function 797 | designator or an lvalue that designates an object that is not a 798 | bit-field and is not declared with the register storage-class 799 | specifier. This operand is NOT an lvalue, but we let it pass. 800 | Note that a segmentation error with possible core dump will result 801 | when the resulting address does not denote a valid (declared) 802 | storage location. This feature will be discontinued in future 803 | releases of the compiler! 804 | 3.3.3.2(36) 805 | Unacceptable operand of '&'. 806 | The operand of the unary & operator shall be either a function 807 | designator or an lvalue that designates an object that is not a 808 | bit-field and is not declared with the register storage-class 809 | specifier. 810 | 3.3.3.2(36) 811 | '&' before array or function; ignored 812 | Unacceptable operand of sizeof operator. 813 | The sizeof operator shall not be applied to an expression that has 814 | function type or an incomplete type, to the parenthesized name of such 815 | a type, or to an lvalue that designates a bit-field object. 816 | 3.3.3.4 817 | Unacceptable operand of a multiplicative operator. 818 | Each of the operands of a multiplicative operator shall have arithmetic type. 819 | 3.3.5(18) 820 | Unacceptable operand of the remainder operator 821 | Each of the operands of the remainder (%) operator shall have integral type. 822 | 3.3.5(18) 823 | Unacceptable operand of '+'. 824 | For the + operator, either both operands shall have arithmetic type, or 825 | one operand shall be a pointer to an object type and the other shall 826 | have integral type. 827 | 3.3.6(39) 828 | Unacceptable operand of '-'. 829 | For the subtraction operator, one of the following shall hold: both operands 830 | have arithmetic type; operands are pointers to qualified or unqualified 831 | versions of compatible object types; or the left operand is a pointer 832 | to an object type and the right operand has integral type. 833 | 3.3.6(39) 834 | Unacceptable operand of shift operator. 835 | Each of the operands of bitwise shift operators shall have integral type. 836 | 3.3.7(9) 837 | Unacceptable operand of relational operator. 838 | For relational operators, one of the following shall hold: both 839 | operands have arithmetic type; both operands are pointers to qualified 840 | or unqualified versions of compatible object types; or both operands 841 | are pointers to qualified or unqualified versions of compatible 842 | incomplete types. 843 | 3.3.8(32) 844 | Unacceptable operand of == or != 845 | For the == or != operator, one of the following shall hold: both operands 846 | are pointers to qualified or unqualified versions of compatible types; one 847 | operand is a pointer to an object or incomplete type and the other is a 848 | pointer to a qualified or unqualified version of void; or one operand is 849 | a pointer and the other is a null pointer constant. 850 | 3.3.9(21) 851 | Unacceptable operand of &. 852 | Each of the operands shall have integral type. 853 | 3.3.10(7) 854 | Unacceptable operand of ^. 855 | Each of the operands shall have integral type. 856 | 3.3.11(18) 857 | Unacceptable operand of |. 858 | Each of the operands shall have integral type. 859 | 3.3.12(30) 860 | Unacceptable operand of &&. 861 | Each of the operands shall have scalar type. 862 | 3.3.13(7) 863 | Unacceptable operand of ||. 864 | Each of the operands shall have scalar type. 865 | 3.3.14(20) 866 | Unacceptable operand of conditional operator. 867 | The first operand of conditional operator shall have scalar type. One 868 | of the following shall hold for the second and third operands: 869 | both operands have arithmetic type; both operands have compatible 870 | structure or union types; both operands have void type; both operands 871 | are pointers to qualified or unqualified versions of compatible types; 872 | one operand is a pointer and the other is a null pointer constant; or 873 | one operand is pointer to an object or incomplete type and the other 874 | is a pointer to a qualified or unqualified version of void. 875 | 3.3.15 876 | Duplicate label '%s' 877 | A label name can only occur once in a function. 878 | 3.1.2.1(25) 879 | Division by zero. 880 | 3.3.5 881 | Subscripting a non-array. 882 | 3.3.2.1 883 | Subscripting an array of incomplete type which is not an object type. 884 | The element of the array shall have an object type. 885 | 3.3.2.1 886 | Should only subscript an array with an integral expression 887 | 3.3.2.1 888 | Subscripting an unbounded array 889 | 3.3.2.1 890 | Array index out of range 891 | 3.3.2.1 892 | Selector requires struct/union pointer as left hand side 893 | In K&R mode the expression is implicitly converted to the '.' selector 894 | for a struct/union left-hand side. 895 | 3.3.2.3 896 | Selector requires struct/union as left hand side 897 | In K&R mode the expression is implicitly converted to the '->' selector 898 | for a struct/union pointer left-hand side. 899 | 3.3.2.3 900 | member of structure or union required 901 | 3.3.2.3 902 | types have different qualifier specifications 903 | For two qualified types to be compatible, both shall have the 904 | identically qualified version of a compatible type; qualified 905 | and unqualified versions of a type are distinct types. For two 906 | types to be compatible their types must be the same. 907 | 3.5.3(26) 908 | Incompatible array type due to different array size 909 | For two array types to be compatible, both shall have compatible element 910 | types; if both size specifiers are present, they shall have the 911 | same value. 912 | 3.5.4.2(11) 913 | Incompatible array type due to incompatible element type 914 | For two array types to be compatible, both shall have compatible element 915 | types. 916 | 3.5.4.2(11) 917 | Incompatible pointer type assignment 918 | The type pointed to by the left-hand side of simple assignment 919 | statement is incompatible with the type pointed to by the right-hand side. 920 | 3.3.16.1, 3.5.4.1(21) 921 | Incompatible base type of pointer type 922 | K&R feature. 923 | Type %s of %s is incompatible with type %s of %s 924 | Incompatible types can be resolved by casting or by other means. 925 | 3.3.16.1 926 | illegal combination of pointer and integer 927 | Assigning an integral expression to a pointer is a bad practice. 928 | Type for %s is incompatible with %s 929 | Incompatible types can be resolved by casting or by other means. 930 | 3.1.2.6 931 | Bad operand type for += or -= 932 | 3.3.16.2(26) 933 | A case or default label appears outside a switch statement 934 | A case or default label shall appear only in a switch statement. 935 | 3.6.1 936 | The controlling expression of the if statement is not scalar type 937 | The controlling expression of an if statement shall have scalar type. 938 | 3.6.4.1 939 | The controlling expression of switch statement is not integral type 940 | The controlling expression of an switch statement shall have integral type. 941 | 3.6.4.2(20) 942 | The case label is not an integral constant expression 943 | The case label shall be an integral constant expression. 944 | 3.6.4.2(22) 945 | Duplicate case label in the same switch statement 946 | No two of the case constant expressions in the same switch statement 947 | shall have the same value after conversion. 948 | 3.6.4.2(22) 949 | More than one default label in the same switch statement 950 | There may be at most one default label in a switch statement. 951 | 3.6.4.2(23) 952 | The controlling expression of the iteration statement is not scalar 953 | type 954 | The controlling expression of a iteration statement shall have scalar 955 | type. 956 | 3.6.5.1 957 | label '%s' used, but not defined 958 | The identifier in a goto statement shall name a label located 959 | somewhere in the enclosing function. 960 | 3.6.6.1 961 | A continue statement shall appear only in or as a loop body 962 | 3.6.6.2 963 | A break statement shall appear only in or as a switch body or loop body 964 | 3.6.6.3 965 | A return statement with an expression should not appear 966 | in a function '%s', whose return type is void 967 | 3.6.6.4(24) 968 | A return statement without an expression appears in a 969 | function '%s', whose return type is not void 970 | If a return statement without an expression is executed, and the value 971 | of the function call is used by the caller, the behavior is undefined. 972 | 3.6.6.4(33) 973 | Internal Error: statement stack underflow 974 | Long double not supported; double assumed. 975 | Long float not standard; double assumed. 976 | Only 'register' allowed in parameter declaration 977 | The only storage-class specifier that shall occur in a parameter 978 | declaration is 'register'; illegal storage class ignored. 979 | 3.5.4.3(25) 980 | Name(s) without types in a function declaration 981 | An old-style function declaration is not allowed to have names 982 | in the parameter list; useless names ignored 983 | 3.5.4.3(26) 984 | Functions cannot return functions 985 | 3.7.1(33), 3.3.2.2 986 | Functions cannot return a non-object type 987 | 3.3.2.2 988 | enum declaration must contain enum literals 989 | Although structs or unions may delay the declaration of their members, 990 | a similar construction with enum does not exist and is not necessary, 991 | as there can be no mutual dependencies between the declaration of an 992 | enumerated type and any other type. 993 | 3.5.2.3(27) 994 | Register qualification has no effect for this type of object 995 | Register declarations for array, struct, and function types have 996 | no effect. 997 | 3.5.1(16), 3.5.1(19) 998 | Functions cannot be declared 'register' 999 | The declaration of an identifier for a function that has block 1000 | scope shall have no explicit storage-class specifier other than 1001 | 'extern'. 1002 | 3.5.1(19) 1003 | '%s' cannot be initialized 1004 | The type of the entity to be initialized shall be an object type 1005 | or an array of unknown size. 1006 | 3.5.7(32) 1007 | Cannot initialize 'extern' variable '%s' within a function 1008 | If the declaration of an identifier has block scope, and the 1009 | identifier has 'extern' or 'static' linkage, the declaration 1010 | shall have no initializer for the identifier; initialization 1011 | allowed anyway. 1012 | 3.5.7(35) 1013 | initializing an 'extern' is an ANSI C extension 1014 | conflicting declarations for '%s' 1015 | 'static' and 'extern' declarations conflict. Which is meant? 1016 | 3.1.2.2(15), 3.1.2.2(27) 1017 | Too many initial values for '%s' 1018 | 3.5.7(1) 1019 | incompatible types in initialization 1020 | 3.3.16(35) 1021 | redefinition of '%s'; previous definition at line %s in file '%s' 1022 | Identifier redeclared in the same scope/block. 1023 | 3.1.2.3 1024 | bit-fields as members of a union are an ANSI C invention. 1025 | storage size for '%s' isn't known 1026 | type mismatch in initialization 1027 | Missing braces in a union initialization or illegally formed 1028 | initialization. 1029 | 3.5.7(5) 1030 | union '%s' only allowed one initializer for the first member 1031 | 3.5.7(5) 1032 | width of '%s' exceeds its type 1033 | the specified bitfield width is too large to be contained within a 1034 | bitfield type. 1035 | structure has no member named '%s' 1036 | This is allowed for compatibility with AT&T pcc-based compilers. 1037 | Reference of an expression of void type or an incomplete type. 1038 | 3.2.2.1 1039 | element size of an array shall not be zero 1040 | 3.2.2.5(25) 1041 | invalid combination of type specifiers 1042 | Although order is unimportant, not all type specifiers can occur together. 1043 | 3.5.2 1044 | declaration must at least declare an identifier, tag, or the member of an enumeration 1045 | 3.5(16) 1046 | at most one storage class may be given in the declaration 1047 | Duplicate occurrence ignored. 1048 | 3.5.1(10) 1049 | size of function's return type is zero 1050 | The return type of a function must be void or an object type other than array. 1051 | 3.7.1(33) 1052 | Expecting an integral return type from the main function 1053 | identifier missing from parameter declaration 1054 | Prototypes for function definitions require identifiers in parameter 1055 | declarations. 1056 | 3.7.1(4) 1057 | only 'register' allowed for storage class for parameters 1058 | The declarations in the declaration list shall contain no storage class 1059 | other than 'register', and no initializations. 1060 | 3.7.1(10) 1061 | parameters declarations can not have initializations 1062 | 3.7.1(10) 1063 | only one instance of 'void' allowed in the parameter list 1064 | 'void' must occur by itself (specifying that the function has no parameters). 1065 | 3.5.4.3(1) 1066 | %s must have function type 1067 | 1) An argument list must be explicitly present in the declarator; it cannot 1068 | be inherited from a typedef (3.5.4.3). 1069 | 2) The declarator is not a function. 1070 | 3.7.1(30) 1071 | Illegal hexadecimal constant 1072 | You have no digits after the 0x or 0X. 0x0 assumed. 1073 | 3.1.3.2 1074 | value overflows its type in this context. Value is set to be '%s'! 1075 | 3.2.1.4 1076 | value is outside range representable for type '%s' 1077 | missing member name 1078 | K&R mode permits a missing member name; otherwise, only bitfields can omit 1079 | the member name. 1080 | 3.5.2.1(10) 1081 | useless keyword or type name in declaration 1082 | Type was ignored. 1083 | '%s' declared within and is limited to this function prototype 1084 | Possible program error, since parameter type checking will always fail 1085 | unless the type declaration is visible to the caller. 1086 | 3.1.2.1(35) 1087 | Extra spaces within operator, %s assumed 1088 | In ANSI C, the compound assignment operator cannot have embedded 1089 | white space characters. 1090 | 3.1.5 1091 | missing size for array '%s' 1092 | Incomplete types permitted for identifiers with internal or 1093 | external linkage, but not automatic linkage. 1094 | 3.1.2.5(10) 1095 | can't jump into (from outside of) the body of a 'try' or into either type of handler 1096 | '%s' missing, please #include excpt.h 1097 | excpt.h required to declare exception statements, intrinsics or compiler 1098 | runtime names. 1099 | local function declarations cannot be 'static' 1100 | A function declaration can only contain the storage-class 'static' 1101 | if it is at file scope. Declaration made 'extern'. 1102 | 3.5.1(19) 1103 | static function '%s' declared and referenced, but not defined. 1104 | If an identifier declared with internal linkage is used in an 1105 | expression (other than as a part of the operand of a sizeof 1106 | operator), there shall be exactly one external definition for 1107 | the identifier in the translation unit. 1108 | 3.7(12) 1109 | pragma argument '%s' must be declared prior to being used in a pragma 1110 | Pragma name ignored. 1111 | Pragma not supported 1112 | '%s' not enabled as intrinsic 1113 | It may have already appeared in a function pragma, or never occurred in 1114 | an intrinsic pragma. 1115 | '%s' is already enabled as an intrinsic 1116 | weak definition for '%s' is later redefined; pragma weak ignored. 1117 | definition of primary name '%s' not found; pragma weak ignored. 1118 | definition of secondary name '%s' not found; pragma weak ignored. 1119 | primary name '%s' is declared as a common or external, and is not defined 1120 | with initial value within this file; pragma weak ignored. 1121 | useless '%s' storage class ignored 1122 | array of functions not allowed 1123 | The element type must be an object type representing a region 1124 | of data storage which can represent values. 1125 | 3.1.2.5(23) 1126 | array of voids not allowed 1127 | The element type must be an object type representing a region 1128 | of data storage which can represent values. 1129 | 3.1.2.5(23) 1130 | argument for pragma pack must be an integer constant; pragma ignored 1131 | '%s' has wrong tag type. 1132 | Identifier redeclared in the same scope/block. 1133 | 3.1.2.3 1134 | missing dimension bound 1135 | For multidimensional arrays, the constant bounds of the array may be 1136 | omitted only for the first member of the sequence. 1137 | 3.1.2.5(23) 1138 | Internal error in parameters to function substr; loc: '%s'; len: '%s'. 1139 | Internal error in parameters to function insertstr; indx: '%s'. 1140 | Internal error in function get_tag_name; input is a non-tagged type. 1141 | Internal error in function gen_type_str -- not a type tree '%s' 1142 | Cannot open file '%s' 1143 | Prototype should be moved after tag or a typedef declaration. 1144 | Please look for comments in the extracted header file. 1145 | The extracted header file includes prototypes for static functions, 1146 | which should be removed, if you wish to include the header in a source file 1147 | other than the originator. 1148 | ANSI C requires formal parameter before "..." 1149 | This extension is meant to be used for compatibility with varargs.h 1150 | 3.5.4.3(35) 1151 | syntax error: "&..." invalid 1152 | extension used to access "..." formal arguments. 1153 | function '%s' initialized like a variable 1154 | The type of entity to be initialized shall be an object type or an 1155 | array of unknown size. 1156 | 3.5.7(31) 1157 | initializer not an array aggregate 1158 | The initializer for an object that has aggregate type shall be a 1159 | brace-enclosed list of initializers for the members of the aggregate, 1160 | written in increasing subscript or member order. 1161 | 3.5.7(20) 1162 | '%s' type is incomplete; cannot initialize 1163 | Was the struct ever defined? 1164 | 3.5.7.(31) 1165 | '%s' is not standard ANSI. 1166 | This keyword/type is not defined in strict ANSI mode. 1167 | 3.1.1 1168 | not a legal asm string 1169 | The first operand of an asm string should be, after argument substitution, 1170 | a legal assembly string. 1171 | The -float option will be ignored in ANSI mode. 1172 | The -float option is ignored, since otherwise program semantics would 1173 | violate the ANSI standard. In particular, fp constants are always 1174 | 'double' with ANSI-C, while with -float the type of fp constants will 1175 | depend on the context and may be 'float'. 1176 | ANSI C support unavailable with C compiler bundled with RISC/os 1177 | The C compiler bundled with RISC/os does not support ANSI C. ANSI 1178 | C support requires a separate license. 1179 | Ignored invalid warning number(s) in -woff option, %s%s ! 1180 | Warning numbers must be in the range %s to %s. 1181 | The set of warning numbers in cfe is disjoint from the set of warning numbers 1182 | in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. 1183 | '%s' not handled as an intrinsic due to incompatible argument types . 1184 | '__unalign' only qualifies pointers 1185 | '__unalign' indicates the object pointed at by pointer is unaligned (e.g., 1186 | int * __unalign p). This is an extension to ANSI C and like 'volatile' 1187 | and 'const' can follow the '*' in pointer declarations, but unlike both 1188 | cannot qualify a base type. 1189 | index expression is an anachronism 1190 | ANSI C++ doesn't support array index expressions in delete. 1191 | 5.3.4 1192 | member cannot be of function or incomplete type. 1193 | 3.5.2.1(12) 1194 | Illegal lint option, '%s', is ignored. 1195 | cannot open header message buffer file 1196 | cannot write header message buffer file 1197 | cannot read header message buffer file 1198 | cannot seek in header message buffer file 1199 | struct/union/enum '%s' is used, but not defined 1200 | static '%s' unused 1201 | nonportable character comparison (chars may be signed or unsigned) 1202 | redundant comparison of unsigned with constant expression 1203 | redundant statement, control flow cannot reach this statement 1204 | '%s' may be used before set 1205 | function parameter '%s' is not used in function '%s' 1206 | '%s' can be const qualified, since it is not set within its lifetime. 1207 | '%s' is not used in function '%s' 1208 | '%s' set but unused in function '%s' 1209 | control may fall through %s statement 1210 | function '%s' has return(e); and return; 1211 | function '%s' may return random value to place of invocation %s 1212 | label without goto: '%s' 1213 | only %s bits of '%s' constant (type '%s') are explicitly given 1214 | explicit conversion from '%s' to '%s' %s 1215 | implicit conversion from '%s' to '%s' %s 1216 | '%s' may be indistinguishable from '%s' due to internal name truncation 1217 | Promoted formal parameter and promoted argument have incompatible types 1218 | No prototype for the definition of '%s' %s 1219 | References to '%s' are substituted by its literal initializer 1220 | (as included in %s) 1221 | ============== 1222 | unsupported language linkage 1223 | string-literal specifies an unsupported linkage 1224 | 7.4(1) 1225 | No prototype for the call to %s 1226 | To achieve better type-checking, there should be a full prototype for 1227 | the function being called. 1228 | 3.5.4.3 1229 | 'inline' only applies to function declarations 1230 | leave statment can occur only within try body 1231 | Microsoft extension 1232 | Use of a Microsoft extension detected without usage of the 1233 | compiler option -msft. 1234 | No parameter mentioned 1235 | A file with no declarations or definitions is accepted as an extension to ANSI C 1236 | The translation unit must contain at least one external definition. 1237 | 3.7 1238 | Incompatible signed and unsigned version of a type 1239 | Yacc initialization error 1240 | Internal error: yacc cannot initialize itself. 1241 | The cfe option %s may not be in future releases. We suggest that you not use this option! 1242 | Incompatible char and unsigned char versions of a type 1243 | Lshift with undefined behaviour. 1244 | Lshift with a negative right operand, or a right operand that is greater 1245 | than or equal to the width in bits of the promoted left operand, results 1246 | in undefined behaviour. 1247 | 3.3.7(11) 1248 | useless type name in declaration, possibly a semicolon is missing. 1249 | Type was ignored. 1250 | constant initializer expression is invalid (refers to automatic variables). 1251 | All the expressions in an initializer for an object that has static storage 1252 | duration or in the initializer list for an object that has aggregate or 1253 | union type shall be constant expressions. Otherwise, unexpected results 1254 | may occur. 1255 | 3.5.7(32) and 3.4 1256 | invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. 1257 | An address constant in a constant initializing expression can neither 1258 | initialize a bit-field nor be directly or indirectly converted to an 1259 | integral type of size different from an address type. 1260 | 6.4 1261 | -------------------------------------------------------------------------------- /ido/7.1/usr/lib/libc.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/libc.so.1 -------------------------------------------------------------------------------- /ido/7.1/usr/lib/libexc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/libexc.so -------------------------------------------------------------------------------- /ido/7.1/usr/lib/libm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/libm.so -------------------------------------------------------------------------------- /ido/7.1/usr/lib/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/ugen -------------------------------------------------------------------------------- /ido/7.1/usr/lib/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/umerge -------------------------------------------------------------------------------- /ido/7.1/usr/lib/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emill/ido-static-recomp/421e546956ceae984927e609b083195e9e81659e/ido/7.1/usr/lib/uopt -------------------------------------------------------------------------------- /libc_impl.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE // for sigset 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #ifdef __CYGWIN__ 17 | #include 18 | #endif 19 | #ifdef __APPLE__ 20 | #include 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "libc_impl.h" 35 | #include "helpers.h" 36 | 37 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 38 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) 39 | 40 | #define STRING(param) size_t param##_len = wrapper_strlen(mem, param##_addr); \ 41 | char param[param##_len + 1]; \ 42 | for (size_t i = 0; i <= param##_len; i++) { \ 43 | param[i] = MEM_S8(param##_addr + i); \ 44 | } 45 | 46 | #if !defined(IDO53) && !defined(IDO71) && !defined(IDO72) 47 | #define IDO71 48 | #endif 49 | 50 | #define MEM_REGION_START 0xfb00000 51 | #define MEM_REGION_SIZE (512 * 1024 * 1024) 52 | 53 | #ifdef IDO53 54 | // IDO 5.3 55 | #define IOB_ADDR 0x0fb528e4 56 | #define ERRNO_ADDR 0x0fb52720 57 | #define CTYPE_ADDR 0x0fb504f0 58 | #define LIBC_ADDR 0x0fb50000 59 | #define LIBC_SIZE 0x3000 60 | #endif 61 | 62 | #ifdef IDO71 63 | // IDO 7.1 64 | #define IOB_ADDR 0x0fb4ee44 65 | #define ERRNO_ADDR 0x0fb4ec80 66 | #define CTYPE_ADDR 0x0fb4cba0 67 | #define LIBC_ADDR 0x0fb4c000 68 | #define LIBC_SIZE 0x3000 69 | #endif 70 | 71 | #ifdef IDO72 72 | // IDO 7.2 73 | #define IOB_ADDR 0x0fb49454 74 | #define ERRNO_ADDR 0x0fb49290 75 | #define CTYPE_ADDR 0x0fb46db0 76 | #define LIBC_ADDR 0x0fb46000 77 | #define LIBC_SIZE 0x4000 78 | #endif 79 | 80 | #define STDIN_ADDR IOB_ADDR 81 | #define STDOUT_ADDR (IOB_ADDR + 0x10) 82 | #define STDERR_ADDR (IOB_ADDR + 0x20) 83 | #define STDIN ((struct FILE_irix *)&MEM_U32(STDIN_ADDR)) 84 | #define STDOUT ((struct FILE_irix *)&MEM_U32(STDOUT_ADDR)) 85 | #define STDERR ((struct FILE_irix *)&MEM_U32(STDERR_ADDR)) 86 | 87 | #define MALLOC_BINS_ADDR custom_libc_data_addr 88 | #define STRTOK_DATA_ADDR (MALLOC_BINS_ADDR + (30 - 3) * 4) 89 | #define INTBUF_ADDR (STRTOK_DATA_ADDR + 4) 90 | 91 | #define SIGNAL_HANDLER_STACK_START LIBC_ADDR 92 | 93 | #define NFILE 100 94 | 95 | #define IOFBF 0000 /* full buffered */ 96 | #define IOLBF 0100 /* line buffered */ 97 | #define IONBF 0004 /* not buffered */ 98 | #define IOEOF 0020 /* EOF reached on read */ 99 | #define IOERR 0040 /* I/O error from system */ 100 | 101 | #define IOREAD 0001 /* currently reading */ 102 | #define IOWRT 0002 /* currently writing */ 103 | #define IORW 0200 /* opened for reading and writing */ 104 | #define IOMYBUF 0010 /* stdio malloc()'d buffer */ 105 | 106 | #define STDIO_BUFSIZE 16384 107 | 108 | struct timespec_t_irix { 109 | int tv_sec; 110 | int tv_nsec; 111 | }; 112 | 113 | struct FILE_irix { 114 | int _cnt; 115 | uint32_t _ptr_addr; 116 | uint32_t _base_addr; 117 | uint8_t pad[2]; 118 | uint8_t _file; 119 | uint8_t _flag; 120 | }; 121 | 122 | static struct { 123 | struct { 124 | uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest); 125 | uint8_t *mem; 126 | uint32_t fp_dest; 127 | } handlers[65]; 128 | volatile uint32_t recursion_level; 129 | } signal_context; 130 | 131 | static uint32_t cur_sbrk; 132 | static uint32_t bufendtab[NFILE]; // this version contains the size and not the end ptr 133 | static uint32_t custom_libc_data_addr; 134 | 135 | #define _U 01 /* Upper case */ 136 | #define _L 02 /* Lower case */ 137 | #define _N 04 /* Numeral (digit) */ 138 | #define _S 010 /* Spacing character */ 139 | #define _P 020 /* Punctuation */ 140 | #define _C 040 /* Control character */ 141 | #define _B 0100 /* Blank */ 142 | #define _X 0200 /* heXadecimal digit */ 143 | 144 | static char ctype[] = { 0, 145 | 146 | /* 0 1 2 3 4 5 6 7 */ 147 | 148 | /* 0*/ _C, _C, _C, _C, _C, _C, _C, _C, 149 | /* 10*/ _C, _S|_C, _S|_C, _S|_C, _S|_C, _S|_C, _C, _C, 150 | /* 20*/ _C, _C, _C, _C, _C, _C, _C, _C, 151 | /* 30*/ _C, _C, _C, _C, _C, _C, _C, _C, 152 | /* 40*/ _S|_B, _P, _P, _P, _P, _P, _P, _P, 153 | /* 50*/ _P, _P, _P, _P, _P, _P, _P, _P, 154 | /* 60*/ _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, 155 | /* 70*/ _N|_X, _N|_X, _P, _P, _P, _P, _P, _P, 156 | /*100*/ _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, 157 | /*110*/ _U, _U, _U, _U, _U, _U, _U, _U, 158 | /*120*/ _U, _U, _U, _U, _U, _U, _U, _U, 159 | /*130*/ _U, _U, _U, _P, _P, _P, _P, _P, 160 | /*140*/ _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, 161 | /*150*/ _L, _L, _L, _L, _L, _L, _L, _L, 162 | /*160*/ _L, _L, _L, _L, _L, _L, _L, _L, 163 | /*170*/ _L, _L, _L, _P, _P, _P, _P, _C, 164 | /*200*/ 0, 0, 0, 0, 0, 0, 0, 0, 165 | 0, 0, 0, 0, 0, 0, 0, 0, 166 | 0, 0, 0, 0, 0, 0, 0, 0, 167 | 0, 0, 0, 0, 0, 0, 0, 0, 168 | 0, 0, 0, 0, 0, 0, 0, 0, 169 | 0, 0, 0, 0, 0, 0, 0, 0, 170 | 0, 0, 0, 0, 0, 0, 0, 0, 171 | 0, 0, 0, 0, 0, 0, 0, 0, 172 | 0, 0, 0, 0, 0, 0, 0, 0, 173 | 0, 0, 0, 0, 0, 0, 0, 0, 174 | 0, 0, 0, 0, 0, 0, 0, 0, 175 | 0, 0, 0, 0, 0, 0, 0, 0, 176 | 0, 0, 0, 0, 0, 0, 0, 0, 177 | 0, 0, 0, 0, 0, 0, 0, 0, 178 | 0, 0, 0, 0, 0, 0, 0, 0, 179 | 0, 0, 0, 0, 0, 0, 0, 0 180 | }; 181 | 182 | #define REDIRECT_USR_LIB 183 | 184 | #ifdef REDIRECT_USR_LIB 185 | static char bin_dir[PATH_MAX + 1]; 186 | #endif 187 | static int g_file_max = 3; 188 | 189 | #ifdef __CYGWIN__ 190 | static size_t g_Pagesize; 191 | #endif 192 | 193 | static uint8_t *memory_map(size_t length) 194 | { 195 | #ifdef __CYGWIN__ 196 | uint8_t *mem = mmap(0, length, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0); 197 | g_Pagesize = sysconf(_SC_PAGESIZE); 198 | assert(((uintptr_t)mem & (g_Pagesize-1)) == 0); 199 | #else 200 | uint8_t *mem = mmap(0, length, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 201 | #endif 202 | if (mem == MAP_FAILED) { 203 | perror("mmap"); 204 | exit(1); 205 | } 206 | return mem; 207 | } 208 | 209 | static void memory_allocate(uint8_t *mem, uint32_t start, uint32_t end) 210 | { 211 | assert(start >= MEM_REGION_START); 212 | assert(end <= MEM_REGION_START + MEM_REGION_SIZE); 213 | #ifdef __CYGWIN__ 214 | uintptr_t _start = ((uintptr_t)mem + start) & ~(g_Pagesize-1); 215 | uintptr_t _end = ((uintptr_t)mem + end + (g_Pagesize-1)) & ~(g_Pagesize-1); 216 | 217 | if(mprotect((void*)_start, _end - _start, PROT_READ | PROT_WRITE) < 0) { 218 | perror("mprotect"); 219 | exit(1); 220 | } 221 | #else 222 | if (mmap(mem + start, end - start, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) == MAP_FAILED) { 223 | perror("mmap"); 224 | exit(1); 225 | } 226 | #endif 227 | } 228 | 229 | static void memory_unmap(uint8_t *mem, size_t length) 230 | { 231 | if (munmap(mem, length)) { 232 | perror("munmap"); 233 | exit(1); 234 | } 235 | } 236 | 237 | 238 | static void free_all_file_bufs(uint8_t *mem) { 239 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(IOB_ADDR); 240 | for (int i = 0; i < g_file_max; i++) { 241 | if (f[i]._flag & IOMYBUF) { 242 | wrapper_free(mem, f[i]._base_addr); 243 | } 244 | } 245 | } 246 | 247 | static void find_bin_dir(void) { 248 | #ifdef REDIRECT_USR_LIB 249 | // gets the current executable's path 250 | char path[PATH_MAX + 1] = {0}; 251 | #ifdef __CYGWIN__ 252 | uint32_t size = GetModuleFileName(NULL, path, PATH_MAX); 253 | if (size == 0 || size == PATH_MAX) { 254 | return; 255 | } 256 | #elif defined __APPLE__ 257 | uint32_t size = PATH_MAX; 258 | if (_NSGetExecutablePath(path, &size) < 0) { 259 | return; 260 | } 261 | #else 262 | ssize_t size = readlink("/proc/self/exe", path, PATH_MAX); 263 | if (size < 0 || size == PATH_MAX) { 264 | return; 265 | } 266 | #endif 267 | 268 | strcpy(bin_dir, dirname(path)); 269 | #endif 270 | } 271 | 272 | int main(int argc, char *argv[]) { 273 | int ret; 274 | 275 | find_bin_dir(); 276 | 277 | uint8_t *mem = memory_map(MEM_REGION_SIZE); 278 | mem -= MEM_REGION_START; 279 | int run(uint8_t *mem, int argc, char *argv[]); 280 | ret = run(mem, argc, argv); 281 | wrapper_fflush(mem, 0); 282 | free_all_file_bufs(mem); 283 | mem += MEM_REGION_START; 284 | memory_unmap(mem, MEM_REGION_SIZE); 285 | return ret; 286 | } 287 | 288 | void mmap_initial_data_range(uint8_t *mem, uint32_t start, uint32_t end) { 289 | custom_libc_data_addr = end; 290 | end += 4096; 291 | memory_allocate(mem, start, end); 292 | cur_sbrk = end; 293 | } 294 | 295 | void setup_libc_data(uint8_t *mem) { 296 | memory_allocate(mem, LIBC_ADDR, (LIBC_ADDR + LIBC_SIZE)); 297 | for (size_t i = 0; i < sizeof(ctype); i++) { 298 | MEM_S8(CTYPE_ADDR + i) = ctype[i]; 299 | } 300 | STDIN->_flag = IOREAD; 301 | STDIN->_file = 0; 302 | STDOUT->_flag = IOWRT; 303 | STDOUT->_file = 1; 304 | STDERR->_flag = IOWRT | IONBF; 305 | STDERR->_file = 2; 306 | } 307 | 308 | static uint32_t strcpy1(uint8_t *mem, uint32_t dest_addr, const char *str) { 309 | for (;;) { 310 | char c = *str; 311 | ++str; 312 | MEM_S8(dest_addr) = c; 313 | ++dest_addr; 314 | if (c == '\0') { 315 | return dest_addr - 1; 316 | } 317 | } 318 | } 319 | 320 | static uint32_t strcpy2(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr) { 321 | for (;;) { 322 | char c = MEM_S8(src_addr); 323 | ++src_addr; 324 | MEM_S8(dest_addr) = c; 325 | ++dest_addr; 326 | if (c == '\0') { 327 | return dest_addr - 1; 328 | } 329 | } 330 | } 331 | 332 | uint32_t wrapper_sbrk(uint8_t *mem, int increment) { 333 | uint32_t old = cur_sbrk; 334 | memory_allocate(mem, old, (old + increment)); 335 | cur_sbrk += increment; 336 | return old; 337 | } 338 | 339 | #if 0 340 | uint32_t wrapper_malloc(uint8_t *mem, uint32_t size) { 341 | uint32_t orig_size = size; 342 | size += 8; 343 | size = (size + 0xfff) & ~0xfff; 344 | uint32_t ret = wrapper_sbrk(mem, size); 345 | MEM_U32(ret) = orig_size; 346 | return ret + 8; 347 | } 348 | 349 | uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size) { 350 | uint64_t new_size = (uint64_t)num * size; 351 | assert(new_size == (uint32_t)new_size); 352 | uint32_t ret = wrapper_malloc(mem, new_size); 353 | return wrapper_memset(mem, ret, 0, new_size); 354 | } 355 | 356 | uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size) { 357 | if (data_addr == 0) { 358 | return wrapper_malloc(mem, size); 359 | } 360 | uint32_t orig_size = MEM_U32(data_addr - 8); 361 | if (size < orig_size || orig_size < 4088 && size < 4088) { 362 | MEM_U32(data_addr - 8) = size; 363 | return data_addr; 364 | } 365 | uint32_t new_addr = wrapper_malloc(mem, size); 366 | return wrapper_memcpy(mem, new_addr, data_addr, MIN(size, orig_size)); 367 | } 368 | 369 | void wrapper_free(uint8_t *mem, uint32_t data_addr) { 370 | // NOP 371 | } 372 | #else 373 | 374 | /* 375 | Simple bin-based malloc algorithm 376 | 377 | The memory is divided into bins of item sizes 8, 16, 32, 64, 128, ..., 2^30. 378 | Size requests are divided into these bin sizes and each bin is handled 379 | completely separate from other bins. 380 | 381 | For each bin there is a linked list of free'd items. 382 | Linked list node: 383 | struct FreeListNode { 384 | struct Node *next; 385 | size_t free_space_after; 386 | uint8_t data[bin_item_size]; 387 | }; 388 | At most one value of next and space_after is non-zero. 389 | If a node exists in the linked list, it is the memory node to return. 390 | struct AllocatedNode { 391 | int bin; 392 | uint32_t current_size; 393 | uint8_t data[bin_item_size]; 394 | }; 395 | The returned address is the data element. 396 | When the last list node is returned, and free_space_after is big enough 397 | for a new node, a new node is created having free_space_after set to 398 | (free_space_after - (8 + bin_item_size)), and is appended to the list. 399 | 400 | If the list was empty, a new memory chunk is requested from the system 401 | of 65536 bytes, or at least (8 + bin_item_size), rounded up to nearest 402 | page size boundary. It can also be smaller if it leaves holes bigger than 403 | 4096 bytes that can never be used. This chunk is then inserted to the list, 404 | and the algorithm restarts. 405 | 406 | This algorithm, for each bin, never uses more than twice as much as is 407 | maximally in use (plus 65536 bytes). 408 | The malloc/free calls run in O(1) and calloc/realloc calls run in O(size). 409 | */ 410 | 411 | size_t mem_used; 412 | size_t mem_allocated; 413 | size_t max_mem_used; 414 | size_t num_sbrks; 415 | size_t num_allocs; 416 | uint32_t wrapper_malloc(uint8_t *mem, uint32_t size) { 417 | int bin = -1; 418 | for (int i = 3; i < 30; i++) { 419 | if (size <= (1 << i)) { 420 | bin = i; 421 | break; 422 | } 423 | } 424 | if (bin == -1) { 425 | return 0; 426 | } 427 | ++num_allocs; 428 | mem_used += size; 429 | max_mem_used = MAX(mem_used, max_mem_used); 430 | uint32_t item_size = 1 << bin; 431 | uint32_t list_ptr = MALLOC_BINS_ADDR + (bin - 3) * 4; 432 | uint32_t node_ptr = MEM_U32(list_ptr); 433 | if (node_ptr == 0) { 434 | uint32_t sbrk_request = 0x10000; 435 | if (8 + item_size > sbrk_request) { 436 | sbrk_request = 8 + item_size; 437 | sbrk_request = (sbrk_request + 0xfff) & ~0xfff; 438 | } 439 | uint32_t left_over = sbrk_request % (8 + item_size); 440 | sbrk_request -= left_over & ~0xfff; 441 | mem_allocated += sbrk_request; 442 | ++num_sbrks; 443 | node_ptr = wrapper_sbrk(mem, sbrk_request); 444 | MEM_U32(node_ptr + 4) = sbrk_request - (8 + item_size); 445 | } 446 | uint32_t next = MEM_U32(node_ptr); 447 | if (next == 0) { 448 | uint32_t free_space_after = MEM_U32(node_ptr + 4); 449 | if (free_space_after >= 8 + item_size) { 450 | next = node_ptr + 8 + item_size; 451 | MEM_U32(next + 4) = free_space_after - (8 + item_size); 452 | } 453 | } else { 454 | assert(MEM_U32(node_ptr + 4) == 0); 455 | } 456 | MEM_U32(list_ptr) = next; 457 | MEM_U32(node_ptr) = bin; 458 | MEM_U32(node_ptr + 4) = size; 459 | return node_ptr + 8; 460 | } 461 | 462 | uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size) { 463 | uint64_t new_size = (uint64_t)num * size; 464 | assert(new_size == (uint32_t)new_size); 465 | uint32_t ret = wrapper_malloc(mem, new_size); 466 | return wrapper_memset(mem, ret, 0, new_size); 467 | } 468 | 469 | uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size) { 470 | if (data_addr == 0) { 471 | return wrapper_malloc(mem, size); 472 | } else { 473 | uint32_t node_ptr = data_addr - 8; 474 | int bin = MEM_U32(node_ptr); 475 | uint32_t old_size = MEM_U32(node_ptr + 4); 476 | uint32_t max_size = 1 << bin; 477 | assert(bin >= 3 && bin < 30); 478 | assert(old_size <= max_size); 479 | if (size <= max_size) { 480 | mem_used = mem_used - old_size + size; 481 | MEM_U32(node_ptr + 4) = size; 482 | return data_addr; 483 | } else { 484 | uint32_t new_addr = wrapper_malloc(mem, size); 485 | wrapper_memcpy(mem, new_addr, data_addr, old_size); 486 | wrapper_free(mem, data_addr); 487 | return new_addr; 488 | } 489 | } 490 | } 491 | 492 | void wrapper_free(uint8_t *mem, uint32_t data_addr) { 493 | uint32_t node_ptr = data_addr - 8; 494 | int bin = MEM_U32(node_ptr); 495 | uint32_t size = MEM_U32(node_ptr + 4); 496 | uint32_t list_ptr = MALLOC_BINS_ADDR + (bin - 3) * 4; 497 | assert(bin >= 3 && bin < 30); 498 | assert(size <= (1 << bin)); 499 | MEM_U32(node_ptr) = MEM_U32(list_ptr); 500 | MEM_U32(node_ptr + 4) = 0; 501 | MEM_U32(list_ptr) = node_ptr; 502 | mem_used -= size; 503 | } 504 | #endif 505 | 506 | int wrapper_fscanf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp) { 507 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 508 | STRING(format) // for debug 509 | 510 | int ret = 0; 511 | char c; 512 | int ch; 513 | sp += 2 * 4; 514 | for (;;) { 515 | c = MEM_S8(format_addr); 516 | ++format_addr; 517 | if (c == '%') { 518 | c = MEM_S8(format_addr); 519 | ++format_addr; 520 | if (c == '%') { 521 | goto percent; 522 | } 523 | for (;;) { 524 | ch = wrapper_fgetc(mem, fp_addr); 525 | if (ch == -1) { 526 | return ret; 527 | } 528 | if (!isspace(ch)) { 529 | //wrapper_ungetc(mem, ch, fp_addr); 530 | break; 531 | } 532 | } 533 | bool l = false; 534 | continue_format: 535 | switch (c) { 536 | case 'l': 537 | assert(!l && "ll not implemented in fscanf"); 538 | l = true; 539 | c = MEM_S8(format_addr); 540 | ++format_addr; 541 | goto continue_format; 542 | case 'd': 543 | { 544 | int64_t num = 0; 545 | int sign = 1; 546 | bool found_first = false; 547 | if (ch == '-') { 548 | sign = -1; 549 | ch = wrapper_fgetc(mem, fp_addr); 550 | if (ch == -1) { 551 | return ret; 552 | } 553 | } 554 | for (;;) { 555 | if (isdigit(ch)) { 556 | num *= 10; 557 | num += ch - '0'; 558 | found_first = true; 559 | ch = wrapper_fgetc(mem, fp_addr); 560 | if (ch == -1) { 561 | break; 562 | } 563 | } else { 564 | wrapper_ungetc(mem, ch, fp_addr); 565 | break; 566 | } 567 | } 568 | if (found_first) { 569 | uint32_t int_addr = MEM_U32(sp); 570 | sp += 4; 571 | MEM_S32(int_addr) = (int)(num * sign); 572 | ++ret; 573 | } else { 574 | return ret; 575 | } 576 | break; 577 | } 578 | default: 579 | assert(0 && "fscanf format not implemented"); 580 | } 581 | } else if (c == '\0') { 582 | break; 583 | } else { 584 | percent: 585 | ch = wrapper_fgetc(mem, fp_addr); 586 | if (ch == -1) { 587 | break; 588 | } 589 | if ((char)ch != c) { 590 | break; 591 | } 592 | } 593 | } 594 | 595 | return ret; 596 | } 597 | 598 | int wrapper_printf(uint8_t *mem, uint32_t format_addr, uint32_t sp) { 599 | STRING(format) 600 | if (!strcmp(format, " child died due to signal %d.\n")) { 601 | printf(format, MEM_U32(sp + 4)); 602 | return 1; 603 | } 604 | assert(0 && "printf not implemented"); 605 | return 0; 606 | } 607 | 608 | int wrapper_sprintf(uint8_t *mem, uint32_t str_addr, uint32_t format_addr, uint32_t sp) { 609 | STRING(format) // for debug 610 | char temp[32]; 611 | 612 | if (!strcmp(format, "%.16e")) { 613 | union { 614 | uint32_t w[2]; 615 | double d; 616 | } d; 617 | d.w[1] = MEM_U32(sp + 2 * 4); 618 | d.w[0] = MEM_U32(sp + 3 * 4); 619 | sprintf(temp, "%.16e", d.d); 620 | strcpy1(mem, str_addr, temp); 621 | return 1; 622 | } 623 | if (!strcmp(format, "\\%03o")) { 624 | sprintf(temp, "\\%03o", MEM_U32(sp + 2 * 4)); 625 | strcpy1(mem, str_addr, temp); 626 | return 1; 627 | } 628 | if (!strcmp(format, "%*ld=")) { 629 | sprintf(temp, "%*d=", MEM_U32(sp + 2 * 4), MEM_U32(sp + 3 * 4)); 630 | strcpy1(mem, str_addr, temp); 631 | return 1; 632 | } 633 | 634 | uint32_t orig_str_addr = str_addr; 635 | uint32_t pos = 0; 636 | int ret = 0; 637 | char c; 638 | sp += 2 * 4; 639 | for (;;) { 640 | c = MEM_S8(format_addr + pos); 641 | ++pos; 642 | if (c == '%') { 643 | bool l = false; 644 | c = MEM_S8(format_addr + pos); 645 | ++pos; 646 | uint32_t zeros = 0; 647 | bool zero_prefix = false; 648 | continue_format: 649 | switch (c) { 650 | case '0': 651 | do { 652 | c = MEM_S8(format_addr + pos); 653 | ++pos; 654 | if (c >= '0' && c <= '9') { 655 | zeros *= 10; 656 | zeros += c - '0'; 657 | } 658 | } while (c >= '0' && c <= '9'); 659 | goto continue_format; 660 | case '#': 661 | c = MEM_S8(format_addr + pos); 662 | ++pos; 663 | zero_prefix = true; 664 | goto continue_format; 665 | break; 666 | case 'l': 667 | assert(!l && "ll not implemented in fscanf"); 668 | c = MEM_S8(format_addr + pos); 669 | ++pos; 670 | l = true; 671 | goto continue_format; 672 | break; 673 | case 'd': 674 | if (zeros != 0) { 675 | char temp1[32]; 676 | sprintf(temp1, "%%0%dd", zeros); 677 | sprintf(temp, temp1, MEM_S32(sp)); 678 | } else { 679 | sprintf(temp, "%d", MEM_S32(sp)); 680 | } 681 | sp += 4; 682 | str_addr = strcpy1(mem, str_addr, temp); 683 | ++ret; 684 | break; 685 | case 'o': 686 | if (zero_prefix) { 687 | sprintf(temp, "%#o", MEM_S32(sp)); 688 | } else { 689 | sprintf(temp, "%o", MEM_S32(sp)); 690 | } 691 | sp += 4; 692 | str_addr = strcpy1(mem, str_addr, temp); 693 | ++ret; 694 | break; 695 | case 'x': 696 | if (zero_prefix) { 697 | sprintf(temp, "%#x", MEM_S32(sp)); 698 | } else { 699 | sprintf(temp, "%x", MEM_S32(sp)); 700 | } 701 | sp += 4; 702 | str_addr = strcpy1(mem, str_addr, temp); 703 | ++ret; 704 | break; 705 | case 'u': 706 | sprintf(temp, "%u", MEM_S32(sp)); 707 | sp += 4; 708 | str_addr = strcpy1(mem, str_addr, temp); 709 | ++ret; 710 | break; 711 | case 's': 712 | str_addr = strcpy2(mem, str_addr, MEM_U32(sp)); 713 | sp += 4; 714 | ++ret; 715 | break; 716 | case 'c': 717 | MEM_S8(str_addr) = (char)MEM_U32(sp); 718 | ++str_addr; 719 | sp += 4; 720 | ++ret; 721 | break; 722 | case '%': 723 | MEM_S8(str_addr) = '%'; 724 | ++str_addr; 725 | break; 726 | default: 727 | fprintf(stderr, "%s\n", format); 728 | assert(0 && "non-implemented sprintf format"); 729 | } 730 | } else if (c == '\0') { 731 | break; 732 | } else { 733 | MEM_S8(str_addr) = c; 734 | ++str_addr; 735 | } 736 | } 737 | 738 | MEM_S8(str_addr) = '\0'; 739 | STRING(orig_str) // for debug 740 | //printf("result: '%s' '%s'\n", format, orig_str); 741 | return ret; 742 | } 743 | 744 | int wrapper_fprintf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp) { 745 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 746 | STRING(format) 747 | sp += 8; 748 | /*if (!strcmp(format, "%s")) { 749 | uint32_t s_addr = MEM_U32(sp); 750 | STRING(s) 751 | if (fp_addr == STDERR_ADDR) { 752 | fprintf(stderr, "%s", s); 753 | fflush(stderr); 754 | return 1; 755 | } 756 | } 757 | if (!strcmp(format, "%s: %s: ")) { 758 | uint32_t s1_addr = MEM_U32(sp), s2_addr = MEM_U32(sp + 4); 759 | STRING(s1) 760 | STRING(s2) 761 | if (fp_addr == STDERR_ADDR) { 762 | fprintf(stderr, "%s: %s: ", s1, s2); 763 | fflush(stderr); 764 | return 1; 765 | } 766 | }*/ 767 | int ret = 0; 768 | for (;;) { 769 | uint32_t pos = format_addr; 770 | char ch = MEM_S8(pos); 771 | while (ch != '%' && ch != '\0') { 772 | ++pos; 773 | ch = MEM_S8(pos); 774 | } 775 | if (format_addr != pos) { 776 | if (wrapper_fwrite(mem, format_addr, 1, pos - format_addr, fp_addr) != pos - format_addr) { 777 | break; 778 | } 779 | } 780 | if (ch == '\0') { 781 | break; 782 | } 783 | ++pos; 784 | ch = MEM_S8(pos); 785 | switch (ch) { 786 | case 'd': 787 | { 788 | char buf[32]; 789 | sprintf(buf, "%d", MEM_U32(sp)); 790 | strcpy1(mem, INTBUF_ADDR, buf); 791 | if (wrapper_fputs(mem, INTBUF_ADDR, fp_addr) == -1) { 792 | return ret; 793 | } 794 | sp += 4; 795 | ++ret; 796 | break; 797 | } 798 | case 's': 799 | { 800 | if (wrapper_fputs(mem, MEM_U32(sp), fp_addr) == -1) { 801 | return ret; 802 | } 803 | sp += 4; 804 | ++ret; 805 | break; 806 | } 807 | case 'c': 808 | { 809 | char buf[32]; 810 | sprintf(buf, "%c", MEM_U32(sp)); 811 | strcpy1(mem, INTBUF_ADDR, buf); 812 | if (wrapper_fputs(mem, INTBUF_ADDR, fp_addr) == -1) { 813 | return ret; 814 | } 815 | sp += 4; 816 | ++ret; 817 | break; 818 | } 819 | default: 820 | fprintf(stderr, "missing format: '%s'\n", format); 821 | assert(0 && "non-implemented fprintf format"); 822 | } 823 | format_addr = ++pos; 824 | } 825 | return ret; 826 | } 827 | 828 | int wrapper__doprnt(uint8_t *mem, uint32_t format_addr, uint32_t params_addr, uint32_t fp_addr) { 829 | assert(0 && "_doprnt not implemented"); 830 | return 0; 831 | } 832 | 833 | uint32_t wrapper_strlen(uint8_t *mem, uint32_t str_addr) { 834 | uint32_t len = 0; 835 | while (MEM_S8(str_addr) != '\0') { 836 | ++str_addr; 837 | ++len; 838 | } 839 | return len; 840 | } 841 | 842 | int wrapper_open(uint8_t *mem, uint32_t pathname_addr, int flags, int mode) { 843 | STRING(pathname) 844 | int f = flags & O_ACCMODE; 845 | if (flags & 0x100) { 846 | f |= O_CREAT; 847 | } 848 | if (flags & 0x200) { 849 | f |= O_TRUNC; 850 | } 851 | if (flags & 0x400) { 852 | f |= O_EXCL; 853 | } 854 | if (flags & 0x800) { 855 | f |= O_NOCTTY; 856 | } 857 | if (flags & 0x08) { 858 | f |= O_APPEND; 859 | } 860 | int fd = open(pathname, f, mode); 861 | MEM_U32(ERRNO_ADDR) = errno; 862 | return fd; 863 | } 864 | 865 | int wrapper_creat(uint8_t *mem, uint32_t pathname_addr, int mode) { 866 | STRING(pathname) 867 | int ret = creat(pathname, mode); 868 | if (ret < 0) { 869 | MEM_U32(ERRNO_ADDR) = errno; 870 | } 871 | return ret; 872 | } 873 | 874 | int wrapper_access(uint8_t *mem, uint32_t pathname_addr, int mode) { 875 | STRING(pathname) 876 | int ret = access(pathname, mode); 877 | if (ret != 0) { 878 | MEM_U32(ERRNO_ADDR) = errno; 879 | } 880 | return ret; 881 | } 882 | 883 | int wrapper_rename(uint8_t *mem, uint32_t oldpath_addr, uint32_t newpath_addr) { 884 | STRING(oldpath) 885 | STRING(newpath) 886 | int ret = rename(oldpath, newpath); 887 | if (ret != 0) { 888 | MEM_U32(ERRNO_ADDR) = errno; 889 | } 890 | return ret; 891 | } 892 | 893 | int wrapper_utime(uint8_t *mem, uint32_t filename_addr, uint32_t times_addr) { 894 | STRING(filename) 895 | struct utimbuf buf = {0, 0}; 896 | int ret = utime(filename, times_addr == 0 ? NULL : &buf); 897 | if (ret == 0) { 898 | if (times_addr != 0) { 899 | MEM_U32(times_addr + 0) = buf.actime; 900 | MEM_U32(times_addr + 4) = buf.modtime; 901 | } 902 | } else { 903 | MEM_U32(ERRNO_ADDR) = errno; 904 | } 905 | return ret; 906 | } 907 | 908 | int wrapper_flock(uint8_t *mem, int fd, int operation) { 909 | int ret = flock(fd, operation); 910 | if (ret != 0) { 911 | MEM_U32(ERRNO_ADDR) = errno; 912 | } 913 | return ret; 914 | } 915 | 916 | int wrapper_chmod(uint8_t *mem, uint32_t path_addr, uint32_t mode) { 917 | STRING(path) 918 | int ret = chmod(path, mode); 919 | if (ret < 0) { 920 | MEM_U32(ERRNO_ADDR) = errno; 921 | } 922 | return ret; 923 | } 924 | 925 | int wrapper_umask(int mode) { 926 | return umask(mode); 927 | } 928 | 929 | uint32_t wrapper_ecvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr) { 930 | assert(0); 931 | } 932 | 933 | uint32_t wrapper_fcvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr) { 934 | assert(0); 935 | } 936 | 937 | double wrapper_sqrt(double v) { 938 | return sqrt(v); 939 | } 940 | 941 | float wrapper_sqrtf(float v) { 942 | return sqrtf(v); 943 | } 944 | 945 | int wrapper_atoi(uint8_t *mem, uint32_t nptr_addr) { 946 | STRING(nptr) 947 | return atoi(nptr); 948 | } 949 | 950 | int wrapper_atol(uint8_t *mem, uint32_t nptr_addr) { 951 | return wrapper_atoi(mem, nptr_addr); 952 | } 953 | 954 | double wrapper_atof(uint8_t *mem, uint32_t nptr_addr) { 955 | STRING(nptr); 956 | return atof(nptr); 957 | } 958 | 959 | int wrapper_strtol(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base) { 960 | STRING(nptr) 961 | char *endptr = NULL; 962 | int64_t res = strtoll(nptr, endptr_addr != 0 ? &endptr : NULL, base); 963 | if (res > INT_MAX) { 964 | MEM_U32(ERRNO_ADDR) = ERANGE; 965 | res = INT_MAX; 966 | } 967 | if (res < INT_MIN) { 968 | MEM_U32(ERRNO_ADDR) = ERANGE; 969 | res = INT_MIN; 970 | } 971 | if (endptr != NULL) { 972 | MEM_U32(endptr_addr) = nptr_addr + (uint32_t)(endptr - nptr); 973 | } 974 | return res; 975 | } 976 | 977 | uint32_t wrapper_strtoul(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base) { 978 | STRING(nptr) 979 | char *endptr = NULL; 980 | uint64_t res = strtoull(nptr, endptr_addr != 0 ? &endptr : NULL, base); 981 | if (res > INT_MAX) { 982 | MEM_U32(ERRNO_ADDR) = ERANGE; 983 | res = INT_MAX; 984 | } 985 | if (endptr != NULL) { 986 | MEM_U32(endptr_addr) = nptr_addr + (uint32_t)(endptr - nptr); 987 | } 988 | return res; 989 | } 990 | 991 | double wrapper_strtod(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr) { 992 | STRING(nptr) 993 | char *endptr = NULL; 994 | errno = 0; 995 | double res = strtod(nptr, endptr_addr != 0 ? &endptr : NULL); 996 | if (errno != 0) { 997 | MEM_U32(ERRNO_ADDR) = errno; 998 | } 999 | if (endptr != NULL) { 1000 | MEM_U32(endptr_addr) = nptr_addr + (uint32_t)(endptr - nptr); 1001 | } 1002 | return res; 1003 | } 1004 | 1005 | uint32_t wrapper_strchr(uint8_t *mem, uint32_t str_addr, int c) { 1006 | c = c & 0xff; 1007 | for (;;) { 1008 | unsigned char ch = MEM_U8(str_addr); 1009 | if (ch == c) { 1010 | return str_addr; 1011 | } 1012 | if (ch == '\0') { 1013 | return 0; 1014 | } 1015 | ++str_addr; 1016 | } 1017 | } 1018 | 1019 | uint32_t wrapper_strrchr(uint8_t *mem, uint32_t str_addr, int c) { 1020 | c = c & 0xff; 1021 | uint32_t ret = 0; 1022 | for (;;) { 1023 | unsigned char ch = MEM_U8(str_addr); 1024 | if (ch == c) { 1025 | ret = str_addr; 1026 | } 1027 | if (ch == '\0') { 1028 | return ret; 1029 | } 1030 | ++str_addr; 1031 | } 1032 | } 1033 | 1034 | uint32_t wrapper_strcspn(uint8_t *mem, uint32_t str_addr, uint32_t invalid_addr) { 1035 | STRING(invalid) 1036 | uint32_t n = strlen(invalid); 1037 | uint32_t pos = 0; 1038 | char c; 1039 | while ((c = MEM_S8(str_addr)) != 0) { 1040 | for (int i = 0; i < n; i++) { 1041 | if (c == invalid[i]) { 1042 | return pos; 1043 | } 1044 | } 1045 | ++pos; 1046 | ++str_addr; 1047 | } 1048 | return pos; 1049 | } 1050 | 1051 | uint32_t wrapper_strpbrk(uint8_t *mem, uint32_t str_addr, uint32_t accept_addr) { 1052 | STRING(accept) 1053 | uint32_t n = strlen(accept); 1054 | char c; 1055 | while ((c = MEM_S8(str_addr)) != 0) { 1056 | for (int i = 0; i < n; i++) { 1057 | if (c == accept[i]) { 1058 | return str_addr; 1059 | } 1060 | } 1061 | ++str_addr; 1062 | } 1063 | return 0; 1064 | } 1065 | 1066 | static void stat_common(uint8_t *mem, uint32_t buf_addr, struct stat *statbuf) { 1067 | struct irix_stat { 1068 | int st_dev; 1069 | int pad1[3]; 1070 | int st_ino; 1071 | int st_mode; 1072 | int st_nlink; 1073 | int st_uid; 1074 | int st_gid; 1075 | int st_rdev; 1076 | int pad2[2]; 1077 | int st_size; 1078 | int pad3; 1079 | struct timespec_t_irix st_atim; 1080 | struct timespec_t_irix st_mtim; 1081 | struct timespec_t_irix st_ctim; 1082 | int st_blksize; 1083 | int st_blocks; 1084 | } s; 1085 | s.st_dev = statbuf->st_dev; 1086 | s.st_ino = statbuf->st_ino; 1087 | s.st_mode = statbuf->st_mode; 1088 | s.st_nlink = statbuf->st_nlink; 1089 | s.st_uid = statbuf->st_uid; 1090 | s.st_gid = statbuf->st_gid; 1091 | s.st_rdev = statbuf->st_rdev; 1092 | s.st_size = statbuf->st_size; 1093 | #ifdef __APPLE__ 1094 | s.st_atim.tv_sec = statbuf->st_atimespec.tv_sec; 1095 | s.st_atim.tv_nsec = statbuf->st_atimespec.tv_nsec; 1096 | s.st_mtim.tv_sec = statbuf->st_mtimespec.tv_sec; 1097 | s.st_mtim.tv_nsec = statbuf->st_mtimespec.tv_nsec; 1098 | s.st_ctim.tv_sec = statbuf->st_ctimespec.tv_sec; 1099 | s.st_ctim.tv_nsec = statbuf->st_ctimespec.tv_nsec; 1100 | #else 1101 | s.st_atim.tv_sec = statbuf->st_atim.tv_sec; 1102 | s.st_atim.tv_nsec = statbuf->st_atim.tv_nsec; 1103 | s.st_mtim.tv_sec = statbuf->st_mtim.tv_sec; 1104 | s.st_mtim.tv_nsec = statbuf->st_mtim.tv_nsec; 1105 | s.st_ctim.tv_sec = statbuf->st_ctim.tv_sec; 1106 | s.st_ctim.tv_nsec = statbuf->st_ctim.tv_nsec; 1107 | #endif 1108 | memcpy(&MEM_U32(buf_addr), &s, sizeof(s)); 1109 | } 1110 | 1111 | int wrapper_fstat(uint8_t *mem, int fildes, uint32_t buf_addr) { 1112 | struct stat statbuf; 1113 | if (fstat(fildes, &statbuf) < 0) { 1114 | MEM_U32(ERRNO_ADDR) = errno; 1115 | return -1; 1116 | } else { 1117 | stat_common(mem, buf_addr, &statbuf); 1118 | return 0; 1119 | } 1120 | } 1121 | 1122 | int wrapper_stat(uint8_t *mem, uint32_t pathname_addr, uint32_t buf_addr) { 1123 | STRING(pathname) 1124 | struct stat statbuf; 1125 | if (stat(pathname, &statbuf) < 0) { 1126 | MEM_U32(ERRNO_ADDR) = errno; 1127 | return -1; 1128 | } else { 1129 | stat_common(mem, buf_addr, &statbuf); 1130 | return 0; 1131 | } 1132 | } 1133 | 1134 | int wrapper_ftruncate(uint8_t *mem, int fd, int length) { 1135 | int ret = ftruncate(fd, length); 1136 | if (ret != 0) { 1137 | MEM_U32(ERRNO_ADDR) = errno; 1138 | } 1139 | return ret; 1140 | } 1141 | 1142 | void wrapper_bcopy(uint8_t *mem, uint32_t src_addr, uint32_t dst_addr, uint32_t len) { 1143 | wrapper_memcpy(mem, dst_addr, src_addr, len); 1144 | } 1145 | 1146 | uint32_t wrapper_memcpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, uint32_t len) { 1147 | uint32_t saved = dst_addr; 1148 | if (dst_addr % 4 == 0 && src_addr % 4 == 0 && len % 4 == 0) { 1149 | memcpy(&MEM_U32(dst_addr), &MEM_U32(src_addr), len); 1150 | } else { 1151 | while (len--) { 1152 | MEM_U8(dst_addr) = MEM_U8(src_addr); 1153 | ++dst_addr; 1154 | ++src_addr; 1155 | } 1156 | } 1157 | return saved; 1158 | } 1159 | 1160 | uint32_t wrapper_memccpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, int c, uint32_t len) { 1161 | while (len--) { 1162 | uint8_t ch = MEM_U8(src_addr); 1163 | MEM_U8(dst_addr) = ch; 1164 | ++dst_addr; 1165 | ++src_addr; 1166 | if (ch == c) { 1167 | return dst_addr; 1168 | } 1169 | } 1170 | return 0; 1171 | } 1172 | 1173 | int wrapper_read(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes) { 1174 | uint8_t *buf = (uint8_t *)malloc(nbytes); 1175 | ssize_t ret = read(fd, buf, nbytes); 1176 | if (ret < 0) { 1177 | MEM_U32(ERRNO_ADDR) = errno; 1178 | } else { 1179 | for (ssize_t i = 0; i < ret; i++) { 1180 | MEM_U8(buf_addr + i) = buf[i]; 1181 | } 1182 | } 1183 | free(buf); 1184 | return (int)ret; 1185 | } 1186 | 1187 | int wrapper_write(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes) { 1188 | uint8_t *buf = (uint8_t *)malloc(nbytes); 1189 | for (size_t i = 0; i < nbytes; i++) { 1190 | buf[i] = MEM_U8(buf_addr + i); 1191 | } 1192 | ssize_t ret = write(fd, buf, nbytes); 1193 | if (ret < 0) { 1194 | MEM_U32(ERRNO_ADDR) = errno; 1195 | } 1196 | free(buf); 1197 | return (int)ret; 1198 | } 1199 | 1200 | static uint32_t init_file(uint8_t *mem, int fd, int i, const char *path, const char *mode) { 1201 | int flags = O_RDONLY; 1202 | if (strcmp(mode, "r") == 0 || strcmp(mode, "rb") == 0) { 1203 | flags = O_RDONLY; 1204 | } else if (strcmp(mode, "w") == 0 || strcmp(mode, "wb") == 0) { 1205 | flags = O_WRONLY | O_CREAT | O_TRUNC; 1206 | } else if (strcmp(mode, "a") == 0 || strcmp(mode, "ab") == 0) { 1207 | flags = O_WRONLY | O_CREAT | O_APPEND; 1208 | } else if (strcmp(mode, "r+") == 0 || strcmp(mode, "r+b") == 0) { 1209 | flags = O_RDWR; 1210 | } else if (strcmp(mode, "w+") == 0 || strcmp(mode, "w+b") == 0) { 1211 | flags = O_RDWR | O_CREAT | O_TRUNC; 1212 | } else if (strcmp(mode, "a+") == 0 || strcmp(mode, "a+b") == 0) { 1213 | flags = O_RDWR | O_CREAT | O_APPEND; 1214 | } 1215 | if (fd == -1) { 1216 | 1217 | #ifdef REDIRECT_USR_LIB 1218 | char fixed_path[PATH_MAX + 1]; 1219 | if (!strcmp(path, "/usr/lib/err.english.cc") && bin_dir[0] != '\0') { 1220 | int n = snprintf(fixed_path, sizeof(fixed_path), "%s/err.english.cc", bin_dir); 1221 | if (n >= 0 && n < sizeof(fixed_path)) { 1222 | path = fixed_path; 1223 | } 1224 | } 1225 | #endif 1226 | fd = open(path, flags, 0666); 1227 | if (fd < 0) { 1228 | MEM_U32(ERRNO_ADDR) = errno; 1229 | return 0; 1230 | } 1231 | } 1232 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(IOB_ADDR); 1233 | uint32_t ret = 0; 1234 | if (i == -1) { 1235 | for (i = 3; i < NFILE; i++) { 1236 | if (f[i]._flag == 0) { 1237 | break; 1238 | } 1239 | } 1240 | } 1241 | assert(i < NFILE); 1242 | g_file_max = i + 1; 1243 | ret = IOB_ADDR + i * sizeof(struct FILE_irix); 1244 | f[i]._cnt = 0; 1245 | f[i]._ptr_addr = 0; 1246 | f[i]._base_addr = 0; 1247 | f[i]._file = fd; 1248 | f[i]._flag = (flags & O_ACCMODE) == O_RDONLY ? IOREAD : 0; 1249 | f[i]._flag |= (flags & O_ACCMODE) == O_WRONLY ? IOWRT : 0; 1250 | f[i]._flag |= (flags & O_ACCMODE) == O_RDWR ? IORW : 0; 1251 | bufendtab[i] = 0; 1252 | return ret; 1253 | } 1254 | 1255 | uint32_t wrapper_fopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr) { 1256 | STRING(path) 1257 | STRING(mode) 1258 | return init_file(mem, -1, -1, path, mode); 1259 | } 1260 | 1261 | uint32_t wrapper_freopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr, uint32_t fp_addr) { 1262 | STRING(path) 1263 | STRING(mode) 1264 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1265 | wrapper_fclose(mem, fp_addr); 1266 | return init_file(mem, -1, f - (struct FILE_irix *)&MEM_U32(IOB_ADDR), path, mode); 1267 | } 1268 | 1269 | int wrapper_fclose(uint8_t *mem, uint32_t fp_addr) { 1270 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1271 | wrapper_fflush(mem, fp_addr); 1272 | if (f->_flag & IOMYBUF) { 1273 | wrapper_free(mem, f->_base_addr); 1274 | } 1275 | f->_flag = 0; 1276 | close(f->_file); 1277 | return 0; 1278 | } 1279 | 1280 | static int flush_all(uint8_t *mem) { 1281 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(IOB_ADDR); 1282 | int ret = 0; 1283 | for (int i = 0; i < g_file_max; i++) { 1284 | if (f[i]._flag & IOWRT) { 1285 | ret |= wrapper_fflush(mem, IOB_ADDR + i * sizeof(struct FILE_irix)); 1286 | } 1287 | } 1288 | return ret; 1289 | } 1290 | 1291 | int wrapper_fflush(uint8_t *mem, uint32_t fp_addr) { 1292 | if (fp_addr == 0) { 1293 | // Flush all 1294 | return flush_all(mem); 1295 | } 1296 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1297 | if (f->_flag & IOWRT) { 1298 | int p = 0; 1299 | int to_flush = f->_ptr_addr - f->_base_addr; 1300 | int c = to_flush; 1301 | while (c > 0) { 1302 | int r = wrapper_write(mem, f->_file, f->_base_addr + p, c); 1303 | if (r < 0) { 1304 | f->_file |= IOERR; 1305 | return -1; 1306 | } 1307 | p += r; 1308 | c -= r; 1309 | } 1310 | f->_ptr_addr = f->_base_addr; 1311 | f->_cnt += to_flush; 1312 | } 1313 | return 0; 1314 | } 1315 | 1316 | int wrapper_ftell(uint8_t *mem, uint32_t fp_addr) { 1317 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1318 | int adjust; 1319 | if (f->_cnt < 0) { 1320 | f->_cnt = 0; 1321 | } 1322 | if (f->_flag & IOREAD) { 1323 | adjust = -f->_cnt; 1324 | } else if (f->_flag & (IOWRT | IORW)) { 1325 | adjust = 0; 1326 | if ((f->_flag & IOWRT) && f->_base_addr != 0 && (f->_flag & IONBF) == 0) { 1327 | adjust = f->_ptr_addr - f->_base_addr; 1328 | } 1329 | } else { 1330 | return -1; 1331 | } 1332 | int res = wrapper_lseek(mem, f->_file, 0, 1); 1333 | if (res >= 0) { 1334 | res += adjust; 1335 | } 1336 | return res; 1337 | } 1338 | 1339 | int wrapper_rewind(uint8_t *mem, uint32_t fp_addr) { 1340 | (void)wrapper_fseek(mem, fp_addr, 0, SEEK_SET); 1341 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1342 | f->_flag &= ~IOERR; 1343 | } 1344 | 1345 | int wrapper_fseek(uint8_t *mem, uint32_t fp_addr, int offset, int origin) { 1346 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1347 | int c, p; 1348 | f->_flag &= ~IOEOF; 1349 | if (f->_flag & IOREAD) { 1350 | if (origin < SEEK_END && f->_base_addr && !(f->_flag & IONBF)) { 1351 | c = f->_cnt; 1352 | p = offset; 1353 | if (origin == SEEK_SET) { 1354 | p += c - lseek(f->_file, 0L, SEEK_CUR); 1355 | } else { 1356 | offset -= c; 1357 | } 1358 | if (!(f->_flag & IORW) && c > 0 && p <= c && p >= f->_base_addr - f->_ptr_addr) { 1359 | f->_ptr_addr += p; 1360 | f->_cnt -= p; 1361 | return 0; 1362 | } 1363 | } 1364 | if (f->_flag & IORW) { 1365 | f->_ptr_addr = f->_base_addr; 1366 | f->_flag &= ~IOREAD; 1367 | } 1368 | p = lseek(f->_file, offset, origin); 1369 | f->_cnt = 0; 1370 | } else if (f->_flag & (IOWRT | IORW)) { 1371 | wrapper_fflush(mem, fp_addr); 1372 | if (f->_flag & IORW) { 1373 | f->_cnt = 0; 1374 | f->_flag &= ~IOWRT; 1375 | f->_ptr_addr = f->_base_addr; 1376 | } 1377 | p = lseek(f->_file, offset, origin); 1378 | } 1379 | if (p < 0) { 1380 | MEM_U32(ERRNO_ADDR) = errno; 1381 | return p; 1382 | } 1383 | return 0; 1384 | } 1385 | 1386 | int wrapper_lseek(uint8_t *mem, int fd, int offset, int whence) { 1387 | int ret = (int)lseek(fd, offset, whence); 1388 | if (ret == -1) { 1389 | MEM_U32(ERRNO_ADDR) = errno; 1390 | } 1391 | return ret; 1392 | } 1393 | 1394 | int wrapper_dup(uint8_t *mem, int fd) { 1395 | fd = dup(fd); 1396 | if (fd < 0) { 1397 | MEM_U32(ERRNO_ADDR) = errno; 1398 | } 1399 | return fd; 1400 | } 1401 | 1402 | int wrapper_dup2(uint8_t *mem, int oldfd, int newfd) { 1403 | int fd = dup2(oldfd, newfd); 1404 | if (fd < 0) { 1405 | MEM_U32(ERRNO_ADDR) = errno; 1406 | } 1407 | return fd; 1408 | } 1409 | 1410 | int wrapper_pipe(uint8_t *mem, uint32_t pipefd_addr) { 1411 | int pipefd[2]; 1412 | int ret = pipe(pipefd); 1413 | if (ret == 0) { 1414 | MEM_U32(pipefd_addr + 0) = pipefd[0]; 1415 | MEM_U32(pipefd_addr + 4) = pipefd[1]; 1416 | } else { 1417 | MEM_U32(ERRNO_ADDR) = errno; 1418 | } 1419 | return ret; 1420 | } 1421 | 1422 | void wrapper_perror(uint8_t *mem, uint32_t str_addr) { 1423 | STRING(str) 1424 | perror(str); 1425 | } 1426 | 1427 | int wrapper_fdopen(uint8_t *mem, int fd, uint32_t mode_addr) { 1428 | STRING(mode) 1429 | return init_file(mem, fd, -1, NULL, mode); 1430 | } 1431 | 1432 | uint32_t wrapper_memset(uint8_t *mem, uint32_t dest_addr, int byte, uint32_t n) { 1433 | uint32_t saved = dest_addr; 1434 | if (dest_addr % 4 == 0 && n % 4 == 0) { 1435 | memset(&MEM_U32(dest_addr), byte, n); 1436 | } else { 1437 | while (n--) { 1438 | MEM_U8(dest_addr) = (uint8_t)byte; 1439 | ++dest_addr; 1440 | } 1441 | } 1442 | return saved; 1443 | } 1444 | 1445 | int wrapper_bcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n) { 1446 | while (n--) { 1447 | if (MEM_U8(s1_addr) != MEM_U8(s2_addr)) { 1448 | return 1; 1449 | } 1450 | ++s1_addr; 1451 | ++s2_addr; 1452 | } 1453 | return 0; 1454 | } 1455 | 1456 | int wrapper_memcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n) { 1457 | while (n--) { 1458 | unsigned char c1 = MEM_U8(s1_addr); 1459 | unsigned char c2 = MEM_U8(s2_addr); 1460 | if (c1 < c2) { 1461 | return -1; 1462 | } 1463 | if (c1 > c2) { 1464 | return 1; 1465 | } 1466 | ++s1_addr; 1467 | ++s2_addr; 1468 | } 1469 | return 0; 1470 | } 1471 | 1472 | int wrapper_getpid(void) { 1473 | return getpid(); 1474 | } 1475 | 1476 | int wrapper_getpgrp(uint8_t *mem) { 1477 | int ret = getpgrp(); 1478 | if (ret == -1) { 1479 | MEM_U32(ERRNO_ADDR) = errno; 1480 | } 1481 | return ret; 1482 | } 1483 | 1484 | int wrapper_remove(uint8_t *mem, uint32_t path_addr) { 1485 | STRING(path) 1486 | int ret = remove(path); 1487 | if (ret < 0) { 1488 | MEM_U32(ERRNO_ADDR) = errno; 1489 | } 1490 | return ret; 1491 | } 1492 | 1493 | int wrapper_unlink(uint8_t *mem, uint32_t path_addr) { 1494 | if (path_addr == 0) { 1495 | fprintf(stderr, "Warning: unlink with NULL as arguement\n"); 1496 | MEM_U32(ERRNO_ADDR) = EFAULT; 1497 | return -1; 1498 | } 1499 | STRING(path) 1500 | int ret = unlink(path); 1501 | if (ret < 0) { 1502 | MEM_U32(ERRNO_ADDR) = errno; 1503 | } 1504 | return ret; 1505 | } 1506 | 1507 | int wrapper_close(uint8_t *mem, int fd) { 1508 | int ret = close(fd); 1509 | if (ret < 0) { 1510 | MEM_U32(ERRNO_ADDR) = errno; 1511 | } 1512 | return ret; 1513 | } 1514 | 1515 | int wrapper_strcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr) { 1516 | for (;;) { 1517 | char c1 = MEM_S8(s1_addr); 1518 | char c2 = MEM_S8(s2_addr); 1519 | if (c1 != c2) { 1520 | return c1 < c2 ? -1 : 1; 1521 | } 1522 | if (c1 == '\0') { 1523 | return 0; 1524 | } 1525 | ++s1_addr; 1526 | ++s2_addr; 1527 | } 1528 | } 1529 | 1530 | int wrapper_strncmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n) { 1531 | if (n == 0) { 1532 | return 0; 1533 | } 1534 | for (;;) { 1535 | char c1 = MEM_S8(s1_addr); 1536 | char c2 = MEM_S8(s2_addr); 1537 | if (c1 != c2) { 1538 | return c1 < c2 ? -1 : 1; 1539 | } 1540 | if (--n == 0 || c1 == '\0') { 1541 | return 0; 1542 | } 1543 | ++s1_addr; 1544 | ++s2_addr; 1545 | } 1546 | } 1547 | 1548 | uint32_t wrapper_strcpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr) { 1549 | uint32_t saved = dest_addr; 1550 | for (;;) { 1551 | char c = MEM_S8(src_addr); 1552 | ++src_addr; 1553 | MEM_S8(dest_addr) = c; 1554 | ++dest_addr; 1555 | if (c == '\0') { 1556 | return saved; 1557 | } 1558 | } 1559 | } 1560 | 1561 | uint32_t wrapper_strncpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n) { 1562 | uint32_t i; 1563 | for (i = 0; i < n && MEM_S8(src_addr) != '\0'; i++) { 1564 | MEM_S8(dest_addr + i) = MEM_S8(src_addr + i); 1565 | } 1566 | for (; i < n; i++) { 1567 | MEM_S8(dest_addr + i) = '\0'; 1568 | } 1569 | return dest_addr; 1570 | } 1571 | 1572 | uint32_t wrapper_strcat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr) { 1573 | uint32_t saved = dest_addr; 1574 | while (MEM_S8(dest_addr) != '\0') { 1575 | ++dest_addr; 1576 | } 1577 | while (MEM_S8(src_addr) != '\0') { 1578 | MEM_S8(dest_addr) = MEM_S8(src_addr); 1579 | ++src_addr; 1580 | ++dest_addr; 1581 | } 1582 | MEM_S8(dest_addr) = '\0'; 1583 | return saved; 1584 | } 1585 | 1586 | uint32_t wrapper_strncat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n) { 1587 | uint32_t saved = dest_addr; 1588 | while (MEM_S8(dest_addr) != '\0') { 1589 | ++dest_addr; 1590 | } 1591 | while (n-- && MEM_S8(src_addr) != '\0') { 1592 | MEM_S8(dest_addr) = MEM_S8(src_addr); 1593 | ++src_addr; 1594 | ++dest_addr; 1595 | } 1596 | MEM_S8(dest_addr) = '\0'; 1597 | return saved; 1598 | } 1599 | 1600 | uint32_t wrapper_strtok(uint8_t *mem, uint32_t str_addr, uint32_t delimiters_addr) { 1601 | if (str_addr == 0) { 1602 | str_addr = MEM_U32(STRTOK_DATA_ADDR); 1603 | } 1604 | if (str_addr == 0) { 1605 | // nothing remaining 1606 | return 0; 1607 | } 1608 | uint32_t p; 1609 | for (p = str_addr; MEM_S8(p) != '\0'; p++) { 1610 | uint32_t q; 1611 | for (q = delimiters_addr; MEM_S8(q) != '\0' && MEM_S8(q) != MEM_S8(p); q++) { 1612 | } 1613 | if (MEM_S8(q) == '\0') { 1614 | break; 1615 | } 1616 | } 1617 | if (MEM_S8(p) == '\0') { 1618 | return 0; 1619 | } 1620 | uint32_t ret = p; 1621 | for (;;) { 1622 | uint32_t q; 1623 | for (q = delimiters_addr; MEM_S8(q) != '\0' && MEM_S8(q) != MEM_S8(p); q++) { 1624 | } 1625 | if (MEM_S8(q) != '\0') { 1626 | MEM_S8(p) = '\0'; 1627 | MEM_U32(STRTOK_DATA_ADDR) = ++p; 1628 | return ret; 1629 | } 1630 | char next = MEM_S8(p); 1631 | ++p; 1632 | if (next == '\0') { 1633 | MEM_U32(STRTOK_DATA_ADDR) = 0; 1634 | return ret; 1635 | } 1636 | } 1637 | } 1638 | 1639 | uint32_t wrapper_strstr(uint8_t *mem, uint32_t str1_addr, uint32_t str2_addr) { 1640 | for (;;) { 1641 | if (MEM_S8(str1_addr) == '\0') { 1642 | return 0; 1643 | } 1644 | uint32_t s1 = str1_addr; 1645 | uint32_t s2 = str2_addr; 1646 | for (;;) { 1647 | char c2 = MEM_S8(s2); 1648 | if (c2 == '\0') { 1649 | return str1_addr; 1650 | } 1651 | if (MEM_S8(s1) == c2) { 1652 | ++s1; 1653 | ++s2; 1654 | } else { 1655 | break; 1656 | } 1657 | } 1658 | ++str1_addr; 1659 | } 1660 | } 1661 | 1662 | uint32_t wrapper_strdup(uint8_t *mem, uint32_t str_addr) { 1663 | uint32_t len = wrapper_strlen(mem, str_addr) + 1; 1664 | uint32_t ret = wrapper_malloc(mem, len); 1665 | if (ret == 0) { 1666 | MEM_U32(ERRNO_ADDR) = ENOMEM; 1667 | return 0; 1668 | } 1669 | return wrapper_memcpy(mem, ret, str_addr, len); 1670 | } 1671 | 1672 | int wrapper_toupper(int c) { 1673 | return toupper(c); 1674 | } 1675 | 1676 | int wrapper_tolower(int c) { 1677 | return tolower(c); 1678 | } 1679 | 1680 | int wrapper_gethostname(uint8_t *mem, uint32_t name_addr, uint32_t len) { 1681 | char buf[256] = {0}; 1682 | if (len > 256) { 1683 | len = 256; 1684 | } 1685 | int ret = gethostname(buf, len); 1686 | if (ret < 0) { 1687 | MEM_U32(ERRNO_ADDR) = errno; 1688 | } else { 1689 | for (uint32_t i = 0; i < len; i++) { 1690 | MEM_S8(name_addr + i) = buf[i]; 1691 | } 1692 | } 1693 | return ret; 1694 | } 1695 | 1696 | int wrapper_isatty(uint8_t *mem, int fd) { 1697 | int ret = isatty(fd); 1698 | if (ret == 0) { 1699 | MEM_U32(ERRNO_ADDR) = errno; 1700 | } 1701 | return ret; 1702 | } 1703 | 1704 | uint32_t wrapper_strftime(uint8_t *mem, uint32_t ptr_addr, uint32_t maxsize, uint32_t format_addr, uint32_t timeptr_addr) { 1705 | //assert(0 && "strftime not implemented"); 1706 | MEM_S8(ptr_addr) = 0; 1707 | return 0; 1708 | } 1709 | 1710 | int wrapper_times(uint8_t *mem, uint32_t buffer_addr) { 1711 | struct tms_irix { 1712 | int tms_utime; 1713 | int tms_stime; 1714 | int tms_cutime; 1715 | int tms_cstime; 1716 | } r; 1717 | struct tms t; 1718 | clock_t ret = times(&t); 1719 | if (ret == (clock_t)-1) { 1720 | MEM_U32(ERRNO_ADDR) = errno; 1721 | } else { 1722 | r.tms_utime = t.tms_utime; 1723 | r.tms_stime = t.tms_stime; 1724 | r.tms_cutime = t.tms_cutime; 1725 | r.tms_cstime = t.tms_cstime; 1726 | } 1727 | return (int)ret; 1728 | } 1729 | 1730 | int wrapper_clock(void) { 1731 | return (int)clock(); 1732 | } 1733 | 1734 | uint32_t wrapper_ctime(uint8_t *mem, uint32_t timep_addr) { 1735 | time_t t = MEM_S32(timep_addr); 1736 | char *res = ctime(&t); 1737 | size_t len = strlen(res) + 1; 1738 | uint32_t ret_addr = wrapper_malloc(mem, len); 1739 | uint32_t pos = ret_addr; 1740 | while (len--) { 1741 | MEM_S8(pos) = *res; 1742 | ++pos; 1743 | ++res; 1744 | } 1745 | return ret_addr; 1746 | //assert(0 && "ctime not implemented"); 1747 | //return 0; 1748 | } 1749 | 1750 | uint32_t wrapper_localtime(uint8_t *mem, uint32_t timep_addr) { 1751 | time_t t = MEM_S32(timep_addr); 1752 | struct irix_tm { 1753 | int tm_sec; 1754 | int tm_min; 1755 | int tm_hour; 1756 | int tm_mday; 1757 | int tm_mon; 1758 | int tm_year; 1759 | int tm_wday; 1760 | int tm_yday; 1761 | int tm_isdst; 1762 | }; 1763 | uint32_t ret = wrapper_malloc(mem, sizeof(struct irix_tm)); 1764 | struct irix_tm *r = (struct irix_tm *)&MEM_U32(ret); 1765 | struct tm *l = localtime(&t); 1766 | r->tm_sec = l->tm_sec; 1767 | r->tm_min = l->tm_min; 1768 | r->tm_hour = l->tm_hour; 1769 | r->tm_mday = l->tm_mday; 1770 | r->tm_mon = l->tm_mon; 1771 | r->tm_year = l->tm_year; 1772 | r->tm_wday = l->tm_wday; 1773 | r->tm_yday = l->tm_yday; 1774 | r->tm_isdst = l->tm_isdst; 1775 | return ret; 1776 | } 1777 | 1778 | int wrapper_setvbuf(uint8_t *mem, uint32_t fp_addr, uint32_t buf_addr, int mode, uint32_t size) { 1779 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1780 | wrapper_fflush(mem, fp_addr); 1781 | if ((f->_flag & IOMYBUF) && f->_base_addr != 0) { 1782 | wrapper_free(mem, f->_base_addr); 1783 | } 1784 | size &= ~0xf; 1785 | f->_flag &= ~IOMYBUF; 1786 | f->_base_addr = buf_addr; 1787 | f->_ptr_addr = buf_addr; 1788 | f->_cnt = 0; 1789 | bufendtab[(fp_addr - IOB_ADDR) / sizeof(struct FILE_irix)] = size; 1790 | } 1791 | 1792 | int wrapper___semgetc(uint8_t *mem, uint32_t fp_addr) { 1793 | assert(0); 1794 | } 1795 | 1796 | int wrapper___semputc(uint8_t *mem, int c, uint32_t fp_addr) { 1797 | assert(0); 1798 | } 1799 | 1800 | int wrapper_fgetc(uint8_t *mem, uint32_t fp_addr) { 1801 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1802 | if (--f->_cnt < 0) { 1803 | return wrapper___filbuf(mem, fp_addr); 1804 | } else { 1805 | int ret = MEM_U8(f->_ptr_addr); 1806 | ++f->_ptr_addr; 1807 | return ret; 1808 | } 1809 | } 1810 | 1811 | int wrapper_fgets(uint8_t *mem, uint32_t str_addr, int count, uint32_t fp_addr) { 1812 | bool modified = false; 1813 | uint32_t saved = str_addr; 1814 | for (count--; count > 0; count--) { 1815 | int ch = wrapper_fgetc(mem, fp_addr); 1816 | if (ch == -1) { 1817 | MEM_S8(str_addr) = '\0'; 1818 | return modified ? saved : 0; 1819 | } 1820 | modified = true; 1821 | MEM_S8(str_addr) = (char)ch; 1822 | ++str_addr; 1823 | if (ch == '\n') { 1824 | break; 1825 | } 1826 | } 1827 | MEM_S8(str_addr) = '\0'; 1828 | return saved; 1829 | } 1830 | 1831 | static void file_assign_buffer(uint8_t *mem, struct FILE_irix *f) { 1832 | f->_base_addr = wrapper_malloc(mem, STDIO_BUFSIZE); 1833 | f->_ptr_addr = f->_base_addr; 1834 | f->_flag |= IOMYBUF; 1835 | f->_cnt = 0; 1836 | bufendtab[f - (struct FILE_irix *)&MEM_U32(IOB_ADDR)] = STDIO_BUFSIZE; 1837 | } 1838 | 1839 | int wrapper___filbuf(uint8_t *mem, uint32_t fp_addr) { 1840 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1841 | if (!(f->_flag & IOREAD)) { 1842 | if (f->_flag & IORW) { 1843 | f->_flag |= IOREAD; 1844 | } else { 1845 | MEM_U32(ERRNO_ADDR) = 9; // EBADF 1846 | return -1; 1847 | } 1848 | } 1849 | if (f->_base_addr == 0) { 1850 | file_assign_buffer(mem, f); 1851 | } 1852 | uint32_t size = bufendtab[(fp_addr - IOB_ADDR) / sizeof(struct FILE_irix)]; 1853 | int nread = wrapper_read(mem, f->_file, f->_base_addr, size); 1854 | int ret = -1; 1855 | if (nread > 0) { 1856 | f->_ptr_addr = f->_base_addr; 1857 | f->_cnt = nread; 1858 | ret = MEM_U8(f->_ptr_addr); 1859 | ++f->_ptr_addr; 1860 | --f->_cnt; 1861 | } else if (nread == 0) { 1862 | f->_flag |= IOEOF; 1863 | } else { 1864 | f->_flag |= IOERR; 1865 | } 1866 | return ret; 1867 | } 1868 | 1869 | int wrapper___flsbuf(uint8_t *mem, int ch, uint32_t fp_addr) { 1870 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1871 | if (wrapper_fflush(mem, fp_addr) != 0) { 1872 | return -1; 1873 | } 1874 | if (f->_base_addr == 0) { 1875 | file_assign_buffer(mem, f); 1876 | f->_cnt = bufendtab[f - (struct FILE_irix *)&MEM_U32(IOB_ADDR)]; 1877 | } 1878 | MEM_U8(f->_ptr_addr) = ch; 1879 | ++f->_ptr_addr; 1880 | --f->_cnt; 1881 | if (f->_flag & IONBF) { 1882 | if (wrapper_fflush(mem, fp_addr) != 0) { 1883 | return -1; 1884 | } 1885 | f->_cnt = 0; 1886 | } 1887 | return ch; 1888 | } 1889 | 1890 | int wrapper_ungetc(uint8_t *mem, int ch, uint32_t fp_addr) { 1891 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1892 | if (ch == -1 || f->_ptr_addr == f->_base_addr) { 1893 | return -1; 1894 | } 1895 | --f->_ptr_addr; 1896 | MEM_U8(f->_ptr_addr) = (uint8_t)ch; 1897 | ++f->_cnt; 1898 | f->_flag &= ~IOEOF; 1899 | return ch; 1900 | } 1901 | 1902 | uint32_t wrapper_gets(uint8_t *mem, uint32_t str_addr) { 1903 | uint32_t p, str0 = str_addr; 1904 | int n; 1905 | 1906 | for (;;) { 1907 | if (STDIN->_cnt <= 0) { 1908 | if (wrapper___filbuf(mem, STDIN_ADDR) == -1) { 1909 | if (str0 == str_addr) { 1910 | return 0; 1911 | } 1912 | break; 1913 | } 1914 | --STDIN->_ptr_addr; 1915 | ++STDIN->_cnt; 1916 | } 1917 | n = STDIN->_cnt; 1918 | if ((p = wrapper_memccpy(mem, str_addr, STDIN->_ptr_addr, '\n', n)) != 0) { 1919 | n = p - str_addr; 1920 | } 1921 | str_addr += n; 1922 | STDIN->_cnt -= n; 1923 | STDIN->_ptr_addr += n; 1924 | // bufsync 1925 | if (p != 0) { 1926 | // found '\n' in buffer 1927 | --str_addr; 1928 | break; 1929 | } 1930 | } 1931 | MEM_S8(str_addr) = '\0'; 1932 | return str0; 1933 | } 1934 | 1935 | uint32_t wrapper_fread(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr) { 1936 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1937 | int nleft = count * size; 1938 | int n; 1939 | for (;;) { 1940 | if (f->_cnt <= 0) { 1941 | if (wrapper___filbuf(mem, fp_addr) == -1) { 1942 | return count - (nleft + size - 1) / size; 1943 | } 1944 | --f->_ptr_addr; 1945 | ++f->_cnt; 1946 | } 1947 | n = MIN(nleft, f->_cnt); 1948 | data_addr = wrapper_memcpy(mem, data_addr, f->_ptr_addr, n) + n; 1949 | f->_cnt -= n; 1950 | f->_ptr_addr += n; 1951 | if ((nleft -= n) <= 0) { 1952 | return count; 1953 | } 1954 | } 1955 | } 1956 | 1957 | uint32_t wrapper_fwrite(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr) { 1958 | struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); 1959 | if (size > 0 && count > 0 && f->_base_addr == 0) { 1960 | file_assign_buffer(mem, f); 1961 | f->_cnt = bufendtab[f - (struct FILE_irix *)&MEM_U32(IOB_ADDR)]; 1962 | f->_flag |= IOWRT; 1963 | } 1964 | uint32_t num_written = 0; 1965 | while (count--) { 1966 | uint32_t s = size; 1967 | while (s > 0) { 1968 | uint32_t to_write = f->_cnt; 1969 | if (s < to_write) { 1970 | to_write = s; 1971 | } 1972 | if (f->_cnt == 0) { 1973 | if (wrapper_fflush(mem, fp_addr) != 0) { 1974 | return num_written; 1975 | } 1976 | } 1977 | wrapper_memcpy(mem, f->_ptr_addr, data_addr, to_write); 1978 | data_addr += to_write; 1979 | f->_ptr_addr += to_write; 1980 | f->_cnt -= to_write; 1981 | s -= to_write; 1982 | } 1983 | num_written++; 1984 | } 1985 | if (f->_flag & IONBF) { 1986 | wrapper_fflush(mem, fp_addr); // TODO check error return value 1987 | } 1988 | return num_written; 1989 | } 1990 | 1991 | int wrapper_fputs(uint8_t *mem, uint32_t str_addr, uint32_t fp_addr) { 1992 | uint32_t len = wrapper_strlen(mem, str_addr); 1993 | uint32_t ret = wrapper_fwrite(mem, str_addr, 1, len, fp_addr); 1994 | return ret == 0 && len != 0 ? -1 : 0; 1995 | } 1996 | 1997 | int wrapper_puts(uint8_t *mem, uint32_t str_addr) { 1998 | int ret = wrapper_fputs(mem, str_addr, STDOUT_ADDR); 1999 | if (ret != 0) { 2000 | return ret; 2001 | } 2002 | struct FILE_irix *f = STDOUT; 2003 | if (--f->_cnt < 0) { 2004 | if (wrapper___flsbuf(mem, '\n', STDOUT_ADDR) != '\n') { 2005 | return -1; 2006 | } 2007 | } else { 2008 | MEM_S8(f->_ptr_addr) = '\n'; 2009 | ++f->_ptr_addr; 2010 | } 2011 | return 0; 2012 | } 2013 | 2014 | uint32_t wrapper_getcwd(uint8_t *mem, uint32_t buf_addr, uint32_t size) { 2015 | char buf[size]; 2016 | if (getcwd(buf, size) == NULL) { 2017 | MEM_U32(ERRNO_ADDR) = errno; 2018 | return 0; 2019 | } else { 2020 | if (buf_addr == 0) { 2021 | buf_addr = wrapper_malloc(mem, size); 2022 | } 2023 | strcpy1(mem, buf_addr, buf); 2024 | return buf_addr; 2025 | } 2026 | } 2027 | 2028 | int wrapper_time(uint8_t *mem, uint32_t tloc_addr) { 2029 | time_t ret = time(NULL); 2030 | if (ret == (time_t)-1) { 2031 | MEM_U32(ERRNO_ADDR) = errno; 2032 | } else if (tloc_addr != 0) { 2033 | MEM_S32(tloc_addr) = ret; 2034 | } 2035 | return ret; 2036 | } 2037 | 2038 | void wrapper_bzero(uint8_t *mem, uint32_t str_addr, uint32_t n) { 2039 | while (n--) { 2040 | MEM_U8(str_addr) = 0; 2041 | ++str_addr; 2042 | } 2043 | } 2044 | 2045 | int wrapper_fp_class_d(double d) { 2046 | union { 2047 | uint32_t w[2]; 2048 | double d; 2049 | } bits; 2050 | bits.d = d; 2051 | uint32_t a2 = bits.w[1]; 2052 | uint32_t a1 = a2 >> 20; 2053 | uint32_t a0 = a1; 2054 | a2 &= 0xfffff; 2055 | uint32_t a3 = bits.w[0]; 2056 | a1 &= 0x7ff; 2057 | a0 &= 0x800; 2058 | if (a1 == 0x7ff) { 2059 | if (a2 == 0 && a3 == 0) { 2060 | return a0 == 0 ? 2 : 3; 2061 | } 2062 | a0 = a2 & 0x80000; 2063 | return a0 == 0 ? 1 : 0; 2064 | } 2065 | if (a1 == 0) { 2066 | if (a2 == 0 && a3 == 0) { 2067 | return a0 == 0 ? 8 : 9; 2068 | } 2069 | return a0 == 0 ? 6 : 7; 2070 | } 2071 | return a0 == 0 ? 4 : 5; 2072 | } 2073 | 2074 | double wrapper_ldexp(double d, int i) { 2075 | return ldexp(d, i); 2076 | } 2077 | 2078 | int64_t wrapper___ll_mul(int64_t a0, int64_t a1) { 2079 | return a0 * a1; 2080 | } 2081 | 2082 | int64_t wrapper___ll_div(int64_t a0, int64_t a1) { 2083 | return a0 / a1; 2084 | } 2085 | 2086 | int64_t wrapper___ll_rem(uint64_t a0, int64_t a1) { 2087 | return a0 % a1; 2088 | } 2089 | 2090 | int64_t wrapper___ll_lshift(int64_t a0, uint64_t shift) { 2091 | return a0 << (shift & 0x3f); 2092 | } 2093 | 2094 | int64_t wrapper___ll_rshift(int64_t a0, uint64_t shift) { 2095 | return a0 >> (shift & 0x3f); 2096 | } 2097 | 2098 | uint64_t wrapper___ull_div(uint64_t a0, uint64_t a1) { 2099 | return a0 / a1; 2100 | } 2101 | 2102 | uint64_t wrapper___ull_rem(uint64_t a0, uint64_t a1) { 2103 | return a0 % a1; 2104 | } 2105 | 2106 | uint64_t wrapper___ull_rshift(uint64_t a0, uint64_t shift) { 2107 | return a0 >> (shift & 0x3f); 2108 | } 2109 | 2110 | uint64_t wrapper___d_to_ull(double d) { 2111 | return d; 2112 | } 2113 | 2114 | int64_t wrapper___d_to_ll(double d) { 2115 | return d; 2116 | } 2117 | 2118 | uint64_t wrapper___f_to_ull(float f) { 2119 | return f; 2120 | } 2121 | 2122 | int64_t wrapper___f_to_ll(float f) { 2123 | return f; 2124 | } 2125 | 2126 | float wrapper___ull_to_f(uint64_t v) { 2127 | return v; 2128 | } 2129 | 2130 | float wrapper___ll_to_f(int64_t v) { 2131 | return v; 2132 | } 2133 | 2134 | double wrapper___ull_to_d(uint64_t v) { 2135 | return v; 2136 | } 2137 | 2138 | double wrapper___ll_to_d(int64_t v) { 2139 | return v; 2140 | } 2141 | 2142 | void wrapper_abort(uint8_t *mem) { 2143 | abort(); 2144 | } 2145 | 2146 | void wrapper_exit(uint8_t *mem, int status) { 2147 | exit(status); 2148 | } 2149 | 2150 | void wrapper__exit(uint8_t *mem, int status) { 2151 | assert(0 && "_exit not implemented"); // exit() is already overridden 2152 | } 2153 | 2154 | void wrapper__cleanup(uint8_t *mem) { 2155 | } 2156 | 2157 | uint32_t wrapper__rld_new_interface(uint8_t *mem, uint32_t operation, uint32_t sp) { 2158 | assert(0 && "_rld_new_interface not implemented"); 2159 | return 0; 2160 | } 2161 | 2162 | void wrapper__exithandle(uint8_t *mem) { 2163 | assert(0 && "_exithandle not implemented"); 2164 | } 2165 | 2166 | int wrapper__prctl(uint8_t *mem, int operation, uint32_t sp) { 2167 | assert(0 && "_prctl not implemented"); 2168 | return 0; 2169 | } 2170 | 2171 | double wrapper__atod(uint8_t *mem, uint32_t buffer_addr, int ndigits, int dexp) { 2172 | // ftp://atoum.hst.nerim.net/irix/src/irix-6.5.5-src/6.5.5/m/irix/lib/libc/src/math/atod.c 2173 | assert(0 && "_atod not implemented"); 2174 | return 0.0; 2175 | } 2176 | 2177 | int wrapper_pathconf(uint8_t *mem, uint32_t path_addr, int name) { 2178 | STRING(path) 2179 | if (name == 5) { 2180 | errno = 0; 2181 | int ret = pathconf(path, _PC_PATH_MAX); 2182 | if (errno != 0) { 2183 | MEM_U32(ERRNO_ADDR) = errno; 2184 | } 2185 | return ret; 2186 | } 2187 | assert(0 && "pathconf not implemented for the specific 'name'"); 2188 | return 0; 2189 | } 2190 | 2191 | uint32_t wrapper_getenv(uint8_t *mem, uint32_t name_addr) { 2192 | STRING(name); 2193 | const char *value = getenv(name); 2194 | if (value == NULL) { 2195 | return 0; 2196 | } 2197 | size_t value_size = strlen(value) + 1; 2198 | uint32_t buf_addr = wrapper_malloc(mem, value_size); 2199 | strcpy1(mem, buf_addr, value); 2200 | return buf_addr; 2201 | } 2202 | 2203 | uint32_t wrapper_gettxt(uint8_t *mem, uint32_t msgid_addr, uint32_t default_str_addr) { 2204 | // Return default for now 2205 | return default_str_addr; 2206 | } 2207 | 2208 | uint32_t wrapper_setlocale(uint8_t *mem, int category, uint32_t locale_addr) { 2209 | assert(locale_addr != 0); 2210 | STRING(locale) 2211 | assert(category == 6); // LC_ALL 2212 | char *ret = setlocale(LC_ALL, locale); 2213 | // Let's hope the caller doesn't use the return value 2214 | return 0; 2215 | } 2216 | 2217 | uint32_t wrapper_mmap(uint8_t *mem, uint32_t addr, uint32_t length, int prot, int flags, int fd, int offset) { 2218 | assert(0 && "mmap not implemented"); 2219 | return 0; 2220 | } 2221 | 2222 | int wrapper_munmap(uint8_t *mem, uint32_t addr, uint32_t length) { 2223 | assert(0 && "munmap not implemented"); 2224 | return 0; 2225 | } 2226 | 2227 | int wrapper_mprotect(uint8_t *mem, uint32_t addr, uint32_t length, int prot) { 2228 | assert(0 && "mprotect not implemented"); 2229 | return 0; 2230 | } 2231 | 2232 | int wrapper_sysconf(uint8_t *mem, int name) { 2233 | assert(0 && "sysconf not implemented"); 2234 | return 0; 2235 | } 2236 | 2237 | int wrapper_getpagesize(uint8_t *mem) { 2238 | return 4096; 2239 | } 2240 | 2241 | int wrapper_strerror(uint8_t *mem, int errnum) { 2242 | errno = errnum; 2243 | perror("strerror"); 2244 | assert(0 && "strerror not implemented"); 2245 | return 0; 2246 | } 2247 | 2248 | int wrapper_ioctl(uint8_t *mem, int fd, uint32_t request, uint32_t sp) { 2249 | assert(0 && "ioctl not implemented"); 2250 | return 0; 2251 | } 2252 | 2253 | int wrapper_fcntl(uint8_t *mem, int fd, int cmd, uint32_t sp) { 2254 | assert(0 && "fcntl not implemented"); 2255 | return 0; 2256 | } 2257 | 2258 | static void signal_handler(int signum) { 2259 | uint32_t level = signal_context.recursion_level++; 2260 | uint8_t *mem = signal_context.handlers[signum].mem; 2261 | uint32_t fp_dest = signal_context.handlers[signum].fp_dest; 2262 | uint32_t sp = SIGNAL_HANDLER_STACK_START - 16 - level * 0x1000; 2263 | signal_context.handlers[signum].trampoline(mem, sp, signum, 0, 0, 0, fp_dest); 2264 | signal_context.recursion_level--; 2265 | } 2266 | 2267 | uint32_t wrapper_signal(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t handler_addr, uint32_t sp) { 2268 | //assert(0 && "signal not implemented"); 2269 | return 0; 2270 | } 2271 | 2272 | uint32_t wrapper_sigset(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t disp_addr, uint32_t sp) { 2273 | void (*handler)(int) = signal_handler; 2274 | 2275 | if ((int)disp_addr >= -1 && (int)disp_addr <= 1) { 2276 | // SIG_DFL etc. 2277 | handler = (void (*)(int))(intptr_t)(int)disp_addr; 2278 | } 2279 | 2280 | switch (signum) { 2281 | case 2: 2282 | signum = SIGINT; 2283 | break; 2284 | case 13: 2285 | signum = SIGPIPE; 2286 | break; 2287 | case 15: 2288 | signum = SIGTERM; 2289 | break; 2290 | default: 2291 | assert(0 && "sigset with this signum not implemented"); 2292 | break; 2293 | } 2294 | 2295 | signal_context.handlers[signum].trampoline = trampoline; 2296 | signal_context.handlers[signum].mem = mem; 2297 | signal_context.handlers[signum].fp_dest = disp_addr; 2298 | 2299 | return (uint32_t)(uintptr_t)sigset(signum, handler); // for now only support SIG_DFL etc. as return value 2300 | } 2301 | 2302 | int wrapper_get_fpc_csr(uint8_t *mem) { 2303 | //assert(0 && "get_fpc_csr not implemented"); 2304 | return 0; 2305 | } 2306 | 2307 | int wrapper_set_fpc_csr(uint8_t *mem, int csr) { 2308 | //assert(0 && "set_fpc_csr not implemented"); 2309 | return 0; 2310 | } 2311 | 2312 | int wrapper_setjmp(uint8_t *mem, uint32_t addr) { 2313 | return 0; 2314 | } 2315 | 2316 | void wrapper_longjmp(uint8_t *mem, uint32_t addr, int status) { 2317 | assert(0 && "longjmp not implemented"); 2318 | } 2319 | 2320 | uint32_t wrapper_tempnam(uint8_t *mem, uint32_t dir_addr, uint32_t pfx_addr) { 2321 | STRING(dir) 2322 | STRING(pfx) 2323 | char *ret = tempnam(dir, pfx); 2324 | char *ret_saved = ret; 2325 | if (ret == NULL) { 2326 | MEM_U32(ERRNO_ADDR) = errno; 2327 | return 0; 2328 | } 2329 | size_t len = strlen(ret) + 1; 2330 | uint32_t ret_addr = wrapper_malloc(mem, len); 2331 | uint32_t pos = ret_addr; 2332 | while (len--) { 2333 | MEM_S8(pos) = *ret; 2334 | ++pos; 2335 | ++ret; 2336 | } 2337 | free(ret_saved); 2338 | return ret_addr; 2339 | } 2340 | 2341 | uint32_t wrapper_tmpnam(uint8_t *mem, uint32_t str_addr) { 2342 | char buf[1024]; 2343 | assert(str_addr != 0 && "s NULL not implemented for tmpnam"); 2344 | char *ret = tmpnam(buf); 2345 | if (ret == NULL) { 2346 | return 0; 2347 | } else { 2348 | strcpy1(mem, str_addr, ret); 2349 | return str_addr; 2350 | } 2351 | } 2352 | 2353 | uint32_t wrapper_mktemp(uint8_t *mem, uint32_t template_addr) { 2354 | STRING(template) 2355 | mktemp(template); 2356 | strcpy1(mem, template_addr, template); 2357 | return template_addr; 2358 | } 2359 | 2360 | int wrapper_mkstemp(uint8_t *mem, uint32_t name_addr) { 2361 | STRING(name) 2362 | int fd = mkstemp(name); 2363 | if (fd < 0) { 2364 | MEM_U32(ERRNO_ADDR) = errno; 2365 | } else { 2366 | strcpy1(mem, name_addr, name); 2367 | } 2368 | return fd; 2369 | } 2370 | 2371 | uint32_t wrapper_tmpfile(uint8_t *mem) { 2372 | // create and fopen a temporary file that is removed when the program exits 2373 | const char *tmpdir = getenv("TMPDIR"); 2374 | if (tmpdir == NULL) { 2375 | tmpdir = "/tmp"; 2376 | } 2377 | 2378 | char name[PATH_MAX + 1] = {0}; 2379 | int n = snprintf(name, sizeof(name), "%s/copt_temp_XXXXXX", tmpdir); 2380 | if (n < 0 || n >= sizeof(name)) { 2381 | // This isn't the best errno code, but it is one that can be returned by tmpfile 2382 | MEM_U32(ERRNO_ADDR) = EACCES; 2383 | return 0; 2384 | } 2385 | 2386 | int fd = mkstemp(name); 2387 | if (fd < 0) { 2388 | MEM_U32(ERRNO_ADDR) = errno; 2389 | return 0; 2390 | } 2391 | 2392 | // the file will be removed from disk when it's closed later 2393 | unlink(name); 2394 | 2395 | // fdopen: 2396 | uint32_t ret = init_file(mem, fd, -1, NULL, "w+"); 2397 | if (ret == 0) { 2398 | close(fd); 2399 | } 2400 | return ret; 2401 | } 2402 | 2403 | int wrapper_wait(uint8_t *mem, uint32_t wstatus_addr) { 2404 | int wstatus; 2405 | pid_t ret = wait(&wstatus); 2406 | MEM_S32(wstatus_addr) = wstatus; 2407 | return ret; 2408 | } 2409 | 2410 | int wrapper_kill(uint8_t *mem, int pid, int sig) { 2411 | int ret = kill(pid, sig); 2412 | if (ret != 0) { 2413 | MEM_U32(ERRNO_ADDR) = errno; 2414 | } 2415 | return ret; 2416 | } 2417 | 2418 | int wrapper_execlp(uint8_t *mem, uint32_t file_addr, uint32_t sp) { 2419 | uint32_t argv_addr = sp + 4; 2420 | return wrapper_execvp(mem, file_addr, argv_addr); 2421 | } 2422 | 2423 | int wrapper_execv(uint8_t *mem, uint32_t pathname_addr, uint32_t argv_addr) { 2424 | STRING(pathname) 2425 | uint32_t argc = 0; 2426 | while (MEM_U32(argv_addr + argc * 4) != 0) { 2427 | ++argc; 2428 | } 2429 | char *argv[argc + 1]; 2430 | for (uint32_t i = 0; i < argc; i++) { 2431 | uint32_t str_addr = MEM_U32(argv_addr + i * 4); 2432 | uint32_t len = wrapper_strlen(mem, str_addr) + 1; 2433 | argv[i] = (char *)malloc(len); 2434 | char *pos = argv[i]; 2435 | while (len--) { 2436 | *pos++ = MEM_S8(str_addr); 2437 | ++str_addr; 2438 | } 2439 | } 2440 | argv[argc] = NULL; 2441 | execv(pathname, argv); 2442 | MEM_U32(ERRNO_ADDR) = errno; 2443 | for (uint32_t i = 0; i < argc; i++) { 2444 | free(argv[i]); 2445 | } 2446 | return -1; 2447 | } 2448 | 2449 | int wrapper_execvp(uint8_t *mem, uint32_t file_addr, uint32_t argv_addr) { 2450 | STRING(file) 2451 | uint32_t argc = 0; 2452 | while (MEM_U32(argv_addr + argc * 4) != 0) { 2453 | ++argc; 2454 | } 2455 | char *argv[argc + 1]; 2456 | for (uint32_t i = 0; i < argc; i++) { 2457 | uint32_t str_addr = MEM_U32(argv_addr + i * 4); 2458 | uint32_t len = wrapper_strlen(mem, str_addr) + 1; 2459 | argv[i] = (char *)malloc(len); 2460 | char *pos = argv[i]; 2461 | while (len--) { 2462 | *pos++ = MEM_S8(str_addr); 2463 | ++str_addr; 2464 | } 2465 | } 2466 | argv[argc] = NULL; 2467 | 2468 | #ifdef REDIRECT_USR_LIB 2469 | if (!strncmp(file, "/usr/lib/", 9) && bin_dir[0] != '\0') { 2470 | char fixed_path[PATH_MAX + 1]; 2471 | #ifdef __CYGWIN__ 2472 | int n = snprintf(fixed_path, sizeof(fixed_path), "%s/%s.exe", bin_dir, file + 9); 2473 | #else 2474 | int n = snprintf(fixed_path, sizeof(fixed_path), "%s/%s", bin_dir, file + 9); 2475 | #endif 2476 | if (n > 0 && n < sizeof(fixed_path)) { 2477 | execvp(fixed_path, argv); 2478 | } else { 2479 | execvp(file, argv); 2480 | } 2481 | } else { 2482 | execvp(file, argv); 2483 | } 2484 | #else 2485 | execvp(file, argv); 2486 | #endif 2487 | 2488 | MEM_U32(ERRNO_ADDR) = errno; 2489 | for (uint32_t i = 0; i < argc; i++) { 2490 | free(argv[i]); 2491 | } 2492 | return -1; 2493 | } 2494 | 2495 | int wrapper_fork(uint8_t *mem) { 2496 | int ret = fork(); 2497 | if (ret == -1) { 2498 | MEM_U32(ERRNO_ADDR) = errno; 2499 | } 2500 | return ret; 2501 | } 2502 | 2503 | int wrapper_system(uint8_t *mem, uint32_t command_addr) { 2504 | STRING(command) 2505 | return system(command); // no errno 2506 | } 2507 | 2508 | static int name_compare(uint8_t *mem, uint32_t a_addr, uint32_t b_addr) { 2509 | //printf("pc=0x00438180\n"); 2510 | return wrapper_strcmp(mem, MEM_U32(a_addr), MEM_U32(b_addr)); 2511 | } 2512 | 2513 | static uint32_t tsearch_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr, bool insert) { 2514 | //assert(compar_addr == 0x438180); // name_compare in as1 2515 | 2516 | if (rootp_addr == 0) { 2517 | return 0; 2518 | } 2519 | while (MEM_U32(rootp_addr) != 0) { 2520 | uint32_t node_addr = MEM_U32(rootp_addr); 2521 | int r = name_compare(mem, key_addr, MEM_U32(node_addr)); 2522 | if (r == 0) { 2523 | return node_addr; 2524 | } 2525 | rootp_addr = r < 0 ? node_addr + 4 : node_addr + 8; 2526 | } 2527 | if (insert) { 2528 | uint32_t node_addr = wrapper_malloc(mem, 12); 2529 | if (node_addr != 0) { 2530 | MEM_U32(rootp_addr) = node_addr; 2531 | MEM_U32(node_addr) = key_addr; 2532 | MEM_U32(node_addr + 4) = 0; 2533 | MEM_U32(node_addr + 8) = 0; 2534 | return node_addr; 2535 | } 2536 | } 2537 | return 0; 2538 | } 2539 | 2540 | uint32_t wrapper_tsearch(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr) { 2541 | return tsearch_tfind(mem, key_addr, rootp_addr, compar_addr, true); 2542 | } 2543 | 2544 | uint32_t wrapper_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr) { 2545 | return tsearch_tfind(mem, key_addr, rootp_addr, compar_addr, false); 2546 | } 2547 | 2548 | uint32_t wrapper_qsort(uint8_t *mem, uint32_t base_addr, uint32_t num, uint32_t size, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t compare_addr, uint32_t sp) { 2549 | assert(0 && "qsort not implemented"); 2550 | return 0; 2551 | } 2552 | 2553 | uint32_t wrapper_regcmp(uint8_t *mem, uint32_t string1_addr, uint32_t sp) { 2554 | STRING(string1); 2555 | fprintf(stderr, "regex string: %s\n", string1); 2556 | assert(0 && "regcmp not implemented"); 2557 | return 0; 2558 | } 2559 | 2560 | uint32_t wrapper_regex(uint8_t *mem, uint32_t re_addr, uint32_t subject_addr, uint32_t sp) { 2561 | STRING(subject); 2562 | assert(0 && "regex not implemented"); 2563 | return 0; 2564 | } 2565 | 2566 | void wrapper___assert(uint8_t *mem, uint32_t assertion_addr, uint32_t file_addr, int line) { 2567 | STRING(assertion) 2568 | STRING(file) 2569 | __assert(assertion, file, line); 2570 | } 2571 | -------------------------------------------------------------------------------- /libc_impl.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void mmap_initial_data_range(uint8_t *mem, uint32_t start, uint32_t end); 4 | void setup_libc_data(uint8_t *mem); 5 | 6 | uint32_t wrapper_sbrk(uint8_t *mem, int increment); 7 | uint32_t wrapper_malloc(uint8_t *mem, uint32_t size); 8 | uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size); 9 | uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size); 10 | int wrapper_fscanf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp); 11 | int wrapper_printf(uint8_t *mem, uint32_t format_addr, uint32_t sp); 12 | int wrapper_sprintf(uint8_t *mem, uint32_t str_addr, uint32_t format_addr, uint32_t sp); 13 | int wrapper_fprintf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp); 14 | int wrapper__doprnt(uint8_t *mem, uint32_t format_addr, uint32_t params_addr, uint32_t fp_addr); 15 | void wrapper_free(uint8_t *mem, uint32_t data_addr); 16 | uint32_t wrapper_strlen(uint8_t *mem, uint32_t str_addr); 17 | int wrapper_open(uint8_t *mem, uint32_t pathname_addr, int flags, int mode); 18 | int wrapper_creat(uint8_t *mem, uint32_t pathname_addr, int mode); 19 | int wrapper_access(uint8_t *mem, uint32_t pathname_addr, int mode); 20 | int wrapper_rename(uint8_t *mem, uint32_t oldpath_addr, uint32_t newpath_addr); 21 | int wrapper_utime(uint8_t *mem, uint32_t filename_addr, uint32_t times_addr); 22 | int wrapper_flock(uint8_t *mem, int fd, int operation); 23 | int wrapper_chmod(uint8_t *mem, uint32_t path_addr, uint32_t mode); 24 | int wrapper_umask(int mode); 25 | uint32_t wrapper_ecvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr); 26 | uint32_t wrapper_fcvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr); 27 | double wrapper_sqrt(double v); 28 | float wrapper_sqrtf(float v); 29 | int wrapper_atoi(uint8_t *mem, uint32_t nptr_addr); 30 | int wrapper_atol(uint8_t *mem, uint32_t nptr_addr); 31 | double wrapper_atof(uint8_t *mem, uint32_t nptr_addr); 32 | int wrapper_strtol(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base); 33 | uint32_t wrapper_strtoul(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base); 34 | double wrapper_strtod(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr); 35 | uint32_t wrapper_strchr(uint8_t *mem, uint32_t str_addr, int c); 36 | uint32_t wrapper_strrchr(uint8_t *mem, uint32_t str_addr, int c); 37 | uint32_t wrapper_strcspn(uint8_t *mem, uint32_t str_addr, uint32_t invalid_addr); 38 | uint32_t wrapper_strpbrk(uint8_t *mem, uint32_t str_addr, uint32_t accept_addr); 39 | int wrapper_fstat(uint8_t *mem, int fildes, uint32_t buf_addr); 40 | int wrapper_stat(uint8_t *mem, uint32_t pathname_addr, uint32_t buf_addr); 41 | int wrapper_ftruncate(uint8_t *mem, int fd, int length); 42 | void wrapper_bcopy(uint8_t *mem, uint32_t src_addr, uint32_t dst_addr, uint32_t len); 43 | uint32_t wrapper_memcpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, uint32_t len); 44 | uint32_t wrapper_memccpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, int c, uint32_t len); 45 | int wrapper_read(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes); 46 | int wrapper_write(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes); 47 | uint32_t wrapper_fopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr); 48 | uint32_t wrapper_freopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr, uint32_t fp_addr); 49 | int wrapper_fclose(uint8_t *mem, uint32_t fp_addr); 50 | int wrapper_fflush(uint8_t *mem, uint32_t fp_addr); 51 | int wrapper_ftell(uint8_t *mem, uint32_t fp_addr); 52 | int wrapper_rewind(uint8_t *mem, uint32_t fp_addr); 53 | int wrapper_fseek(uint8_t *mem, uint32_t fp_addr, int offset, int origin); 54 | int wrapper_lseek(uint8_t *mem, int fd, int offset, int whence); 55 | int wrapper_dup(uint8_t *mem, int fd); 56 | int wrapper_dup2(uint8_t *mem, int oldfd, int newfd); 57 | int wrapper_pipe(uint8_t *mem, uint32_t pipefd_addr); 58 | void wrapper_perror(uint8_t *mem, uint32_t str_addr); 59 | int wrapper_fdopen(uint8_t *mem, int fd, uint32_t mode_addr); 60 | uint32_t wrapper_memset(uint8_t *mem, uint32_t dest_addr, int byte, uint32_t n); 61 | int wrapper_bcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n); 62 | int wrapper_memcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n); 63 | int wrapper_getpid(void); 64 | int wrapper_getpgrp(uint8_t *mem); 65 | int wrapper_remove(uint8_t *mem, uint32_t path_addr); 66 | int wrapper_unlink(uint8_t *mem, uint32_t path_addr); 67 | int wrapper_close(uint8_t *mem, int fd); 68 | int wrapper_strcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr); 69 | int wrapper_strncmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n); 70 | uint32_t wrapper_strcpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr); 71 | uint32_t wrapper_strncpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n); 72 | uint32_t wrapper_strcat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr); 73 | uint32_t wrapper_strncat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n); 74 | uint32_t wrapper_strtok(uint8_t *mem, uint32_t str_addr, uint32_t delimiters_addr); 75 | uint32_t wrapper_strstr(uint8_t *mem, uint32_t str1_addr, uint32_t str2_addr); 76 | uint32_t wrapper_strdup(uint8_t *mem, uint32_t str_addr); 77 | int wrapper_toupper(int c); 78 | int wrapper_tolower(int c); 79 | int wrapper_gethostname(uint8_t *mem, uint32_t name_addr, uint32_t len); 80 | int wrapper_isatty(uint8_t *mem, int fd); 81 | int wrapper_times(uint8_t *mem, uint32_t buffer_addr); 82 | uint32_t wrapper_strftime(uint8_t *mem, uint32_t ptr_addr, uint32_t maxsize, uint32_t format_addr, uint32_t timeptr_addr); 83 | int wrapper_clock(void); 84 | uint32_t wrapper_ctime(uint8_t *mem, uint32_t timep_addr); 85 | uint32_t wrapper_localtime(uint8_t *mem, uint32_t timep_addr); 86 | int wrapper_setvbuf(uint8_t *mem, uint32_t fp_addr, uint32_t buf_addr, int mode, uint32_t size); 87 | int wrapper___semgetc(uint8_t *mem, uint32_t fp_addr); 88 | int wrapper___semputc(uint8_t *mem, int c, uint32_t fp_addr); 89 | int wrapper_fgetc(uint8_t *mem, uint32_t fp_addr); 90 | int wrapper_fgets(uint8_t *mem, uint32_t str_addr, int count, uint32_t fp_addr); 91 | int wrapper___filbuf(uint8_t *mem, uint32_t fp_addr); 92 | int wrapper___flsbuf(uint8_t *mem, int ch, uint32_t fp_addr); 93 | int wrapper_ungetc(uint8_t *mem, int ch, uint32_t fp_addr); 94 | uint32_t wrapper_gets(uint8_t *mem, uint32_t str_addr); 95 | uint32_t wrapper_fread(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr); 96 | uint32_t wrapper_fwrite(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr); 97 | int wrapper_fputs(uint8_t *mem, uint32_t str_addr, uint32_t fp_addr); 98 | int wrapper_puts(uint8_t *mem, uint32_t str_addr); 99 | uint32_t wrapper_getcwd(uint8_t *mem, uint32_t buf_addr, uint32_t size); 100 | int wrapper_time(uint8_t *mem, uint32_t tloc_addr); 101 | void wrapper_bzero(uint8_t *mem, uint32_t str_addr, uint32_t n); 102 | int wrapper_fp_class_d(double d); 103 | double wrapper_ldexp(double d, int i); 104 | int64_t wrapper___ll_mul(int64_t a0, int64_t a1); 105 | int64_t wrapper___ll_div(int64_t a0, int64_t a1); 106 | int64_t wrapper___ll_rem(uint64_t a0, int64_t a1); 107 | int64_t wrapper___ll_lshift(int64_t a0, uint64_t shift); 108 | int64_t wrapper___ll_rshift(int64_t a0, uint64_t shift); 109 | uint64_t wrapper___ull_div(uint64_t a0, uint64_t a1); 110 | uint64_t wrapper___ull_rem(uint64_t a0, uint64_t a1); 111 | uint64_t wrapper___ull_rshift(uint64_t a0, uint64_t shift); 112 | uint64_t wrapper___d_to_ull(double d); 113 | int64_t wrapper___d_to_ll(double d); 114 | uint64_t wrapper___f_to_ull(float f); 115 | int64_t wrapper___f_to_ll(float f); 116 | float wrapper___ull_to_f(uint64_t v); 117 | float wrapper___ll_to_f(int64_t v); 118 | double wrapper___ull_to_d(uint64_t v); 119 | double wrapper___ll_to_d(int64_t v); 120 | void wrapper_abort(uint8_t *mem); 121 | void wrapper_exit(uint8_t *mem, int status); 122 | void wrapper__exit(uint8_t *mem, int status); 123 | void wrapper__cleanup(uint8_t *mem); 124 | uint32_t wrapper__rld_new_interface(uint8_t *mem, uint32_t operation, uint32_t sp); 125 | void wrapper__exithandle(uint8_t *mem); 126 | int wrapper__prctl(uint8_t *mem, int operation, uint32_t sp); 127 | double wrapper__atod(uint8_t *mem, uint32_t buffer_addr, int ndigits, int dexp); 128 | int wrapper_pathconf(uint8_t *mem, uint32_t path_addr, int name); 129 | uint32_t wrapper_getenv(uint8_t *mem, uint32_t name_addr); 130 | uint32_t wrapper_gettxt(uint8_t *mem, uint32_t msgid_addr, uint32_t default_str_addr); 131 | uint32_t wrapper_setlocale(uint8_t *mem, int category, uint32_t locale_addr); 132 | uint32_t wrapper_mmap(uint8_t *mem, uint32_t addr, uint32_t length, int prot, int flags, int fd, int offset); 133 | int wrapper_munmap(uint8_t *mem, uint32_t addr, uint32_t length); 134 | int wrapper_mprotect(uint8_t *mem, uint32_t addr, uint32_t length, int prot); 135 | int wrapper_sysconf(uint8_t *mem, int name); 136 | int wrapper_getpagesize(uint8_t *mem); 137 | int wrapper_strerror(uint8_t *mem, int errnum); 138 | int wrapper_ioctl(uint8_t *mem, int fd, uint32_t request, uint32_t sp); 139 | int wrapper_fcntl(uint8_t *mem, int fd, int cmd, uint32_t sp); 140 | uint32_t wrapper_signal(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t handler_addr, uint32_t sp); 141 | uint32_t wrapper_sigset(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t disp_addr, uint32_t sp); 142 | int wrapper_get_fpc_csr(uint8_t *mem); 143 | int wrapper_set_fpc_csr(uint8_t *mem, int csr); 144 | int wrapper_setjmp(uint8_t *mem, uint32_t addr); 145 | void wrapper_longjmp(uint8_t *mem, uint32_t addr, int status); 146 | uint32_t wrapper_tempnam(uint8_t *mem, uint32_t dir_addr, uint32_t pfx_addr); 147 | uint32_t wrapper_tmpnam(uint8_t *mem, uint32_t str_addr); 148 | uint32_t wrapper_mktemp(uint8_t *mem, uint32_t template_addr); 149 | int wrapper_mkstemp(uint8_t *mem, uint32_t name_addr); 150 | uint32_t wrapper_tmpfile(uint8_t *mem); 151 | int wrapper_wait(uint8_t *mem, uint32_t wstatus_addr); 152 | int wrapper_kill(uint8_t *mem, int pid, int sig); 153 | int wrapper_execlp(uint8_t *mem, uint32_t file_addr, uint32_t sp); 154 | int wrapper_execv(uint8_t *mem, uint32_t pathname_addr, uint32_t argv_addr); 155 | int wrapper_execvp(uint8_t *mem, uint32_t file_addr, uint32_t argv_addr); 156 | int wrapper_fork(uint8_t *mem); 157 | int wrapper_system(uint8_t *mem, uint32_t command_addr); 158 | uint32_t wrapper_tsearch(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr); 159 | uint32_t wrapper_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr); 160 | uint32_t wrapper_qsort(uint8_t *mem, uint32_t base_addr, uint32_t num, uint32_t size, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t compare_addr, uint32_t sp); 161 | uint32_t wrapper_regcmp(uint8_t *mem, uint32_t string1_addr, uint32_t sp); 162 | uint32_t wrapper_regex(uint8_t *mem, uint32_t re_addr, uint32_t subject_addr, uint32_t sp); 163 | void wrapper___assert(uint8_t *mem, uint32_t assertion_addr, uint32_t file_addr, int line); 164 | -------------------------------------------------------------------------------- /skeleton.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "../libc_impl.h" 9 | #include "../helpers.h" 10 | 11 | #define RM_RN 0 12 | #define RM_RZ 1 13 | #define RM_RP 2 14 | #define RM_RM 3 15 | 16 | union FloatReg { 17 | float f[2]; 18 | uint32_t w[2]; 19 | double d; 20 | }; 21 | 22 | #define cvt_w_d(f) \ 23 | ((fcsr & RM_RZ) ? ((isnan(f) || f <= -2147483649.0 || f >= 2147483648.0) ? (fcsr |= 0x40, 2147483647) : (int)f) : (assert(0), 0)) 24 | 25 | #define cvt_w_s(f) cvt_w_d((double)f) 26 | 27 | int func(uint8_t *mem, int argc, char *argv[]) { 28 | const uint32_t zero = 0; 29 | uint32_t at = 0, v0 = 0, v1 = 0, a0 = 0, a1 = 0, a2 = 0, a3 = 0, t0 = 0, t1 = 0, t2 = 0, 30 | t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, 31 | s6 = 0, s7 = 0, t8 = 0, t9 = 0, k0 = 0, k1 = 0, gp = 0, sp = 0, fp = 0, s8 = 0, ra = 0; 32 | uint32_t lo = 0, hi = 0; 33 | union FloatReg f0 = {{0, 0}}, f2 = {{0, 0}}, f4 = {{0, 0}}, f6 = {{0, 0}}, f8 = {{0, 0}}, 34 | f10 = {{0, 0}}, f12 = {{0, 0}}, f14 = {{0, 0}}, f16 = {{0, 0}}, f18 = {{0, 0}}, f20 = {{0, 0}}, 35 | f22 = {{0, 0}}, f24 = {{0, 0}}, f26 = {{0, 0}}, f28 = {{0, 0}}, f30 = {{0, 0}}; 36 | int cf = 0; 37 | uint32_t fcsr = 1; 38 | void *dest = NULL; 39 | uint64_t temp64; 40 | #include "dummy.c" 41 | } 42 | --------------------------------------------------------------------------------