mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-07 04:54:55 -04:00
Overhaul the build system (#234)
* wip * fix * add disassembler * Disasm builds OK * Variable addends * More wip * Rodata migration implemented * Cleanup old tools * Try fix submodule -> subrepo merge * git subrepo pull --force --remote=https://github.com/zeldaret/ZAPD.git tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "602e609" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "602e609" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Builds again but assets are totally broken * git subrepo pull --force tools/asm-processor subrepo: subdir: "tools/asm-processor" merged: "1ffdb08a" upstream: origin: "https://github.com/simonlindholm/asm-processor.git" branch: "master" commit: "1ffdb08a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * More cleanup, move functions.txt and variables.txt to tools/disasm and rm tables * rm z64compress in preparation for subrepo * git subrepo clone (merge) https://github.com/z64me/z64compress.git tools/z64compress subrepo: subdir: "tools/z64compress" merged: "eb11085c" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "eb11085c" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Fix asset extraction * Fix diff-init make rule * Split code bss * Split assumed linker bug padding from assembly files * add filelists for mm.us.rev1 * Maybe working, but I'm not sure * add overlays to spec * Add rodata to actos * Everything compiles * Make a lot of C files for code * Add almost every file in code to spec * whoops * 3 code files left * add scenes to spec * More progress on progress.py * Fix skelanime in spec * audio files! * Fix merge issues * Fix some C files in code * Fix remaining code files * Use existing O1 C files in spec * reorder boot order in spec * update spec * fault.c * Convert relocs on completed actors, fixbaserom uses current rom name * more boot files * Add VT macros and script * finish already existing boot files * most of libultra * fix 64bits libultra files * Use C files for libultra, wrap some functions in NON_MATCHING * Remove duplicate of OS_CLOCK_RATE from fault.c * C files for fbdemos * delete dumb files * bootstrap C files, still need to add them to the spec * update fixbaserom * boot OK? * I forgot to commit the spec * C for gamestates * C for kaleido * Change all includes to "" * copy actor sizes script from oot * I forgot to delete those files * Basic C files for effects * Add effects initvars names * Remove mislabelled boot functions from header/txt * Begin porting bootstrap_fx, some sizes * Fix <> * Fix enum * Fix diff.py * fix libultra stuff * update regconvert * update setup warnings * add some missing ; * Fix some makefile stuff and other fixes on some non_matching functions * add executable flag in extract_baserom and fixbaserom * fix relative path * copy assist from oot * fix map path * another assist path fix * Delete C files for handwritten files * add code_801A51F0 to spec * add gfxbuffers to spec * Move rodata to top of each file when possible * UNK_TYPEs for func_801A51F0 * Remove kaleido rodata from spec * Update spec and undefined_syms for recent merge * GCC warnings and fix errors in nonmatchings, * round percentage numbers * progress script: format changes * progress: error on non-existing files * fix warning in z_scene_table * Match 2 nonmatchings in z_actor * Warnings in lightswitch and invadepoh * Fix warning in z_actor_dlftbls * I though I fixed this one * whoops * Comment out CC_CHECK * Removed redundant ultra64.h includes * Update asm_processor, sorted boot_O1 into other folders, completed the fbdemo bootstrap, cleaned up undefined_syms * Completed gamestates bootstrap * Split kaleido_scope * Remove section.h and segment.h, move keep object externs to a common location in variables.h * Completed effects bootstrap * Segmented address externs for effects, fbdemos, gamestates and kaleido * Move actor data externs out of the if 0 * Segmented address externs for actors * Prepare actionfunc detection * fix script, how did it even work before * Fix actionfunc script again, re-introduce some more intermediate prints to the disassembler * Automated actionFunc detection in actors * Segmented addresses from player .text * rm old segment addrs script and fix build * Move sizes folder to tools * Make build.py executable * New Jenkinsfile Prayge * Remove numpy dependencies * Add warnings_disasm_current.txt * my bad * Update spec and undefined_syms * Add z_eff_ss_hahen to pametfrog * git subrepo pull (merge) --force tools/z64compress subrepo: subdir: "tools/z64compress" merged: "163ca2af" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "163ca2af" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Make z64compress print to stdout * sneeky commit to update warnings tooling * test * Another test * Mark fixing overlay reloc generating as a TODO * Update warnings stuff * Communicate the return code from running z64compress back to the Makefile through the wrapper * Run formatter, remove extra commented copy of function * Re-fix some includes * Convert atan to hex to conform to decided style * Some tidying up, remove c for fp and the other two handwritten code files * BSS in z_collision_check & z_scene_proc * add static back in * Fix timerintr bss, add file to spec, some cleanup * Remove externs * Newline * Readd enums * Typo * Colours * Comments for hitmark enum values Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Improvements and suggestions * Organize and remove unused imports and use env for python3 scripts, delete unused overlay.py Co-authored-by: angie <angheloalf95@gmail.com> Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> Co-authored-by: engineer124 <engineer124engineer124@gmail.com> Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
*.o
|
||||
@@ -1,12 +0,0 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = https://github.com/simonlindholm/asm-processor.git
|
||||
branch = master
|
||||
commit = 85288fcdfefd5d2644d9bac1230c8b4aa7c92024
|
||||
parent = 492b92579d6bc30f635cbcc3852de1b17ed1bc43
|
||||
method = merge
|
||||
cmdver = 0.4.3
|
||||
@@ -1,24 +0,0 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org>
|
||||
@@ -1,93 +0,0 @@
|
||||
# asm-processor
|
||||
|
||||
Pre-process .c files and post-process .o files to enable embedding MIPS assembly into IDO-compiled C.
|
||||
|
||||
## Usage
|
||||
|
||||
Let's say you have a file compiled with `-g` on the IDO compiler, that looks like this:
|
||||
```c
|
||||
float func4(void) {
|
||||
"func4";
|
||||
return 0.2f;
|
||||
}
|
||||
```
|
||||
|
||||
This script enables replacing it by:
|
||||
```asm
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.word 0x66756e63 # func
|
||||
.word 0x34000000 # 4\0\0\0
|
||||
|
||||
.late_rodata
|
||||
glabel rv
|
||||
.word 0x3e4ccccd # 0.2f
|
||||
|
||||
.text
|
||||
glabel func4
|
||||
lui $at, %hi(rv)
|
||||
jr $ra
|
||||
lwc1 $f0, %lo(rv)($at)
|
||||
jr $ra
|
||||
nop
|
||||
jr $ra
|
||||
nop
|
||||
)
|
||||
```
|
||||
|
||||
To compile the file, run `./compile.sh file.c`, or invoke the `asm_processor.py` script in a similar manner. (`compile.sh` is mostly just intended to describe example usage.)
|
||||
|
||||
Reading assembly from file is also supported, e.g. `GLOBAL_ASM("file.s")`.
|
||||
|
||||
### What is supported?
|
||||
|
||||
`.text`, `.data`, `.bss` and `.rodata` sections, `.word`/`.incbin`, `.ascii`/`.asciz`, and `-g`, `-g3`, `-O1`, `-O2` and `-framepointer` flags to the IDO compiler.
|
||||
|
||||
### What is not supported?
|
||||
|
||||
* complicated assembly (.ifdef, macro declarations/calls other than `glabel`, pseudo-instructions that expand to several real instructions)
|
||||
* non-IDO compilers
|
||||
* `-mips1` (`-mips3` may also not work fully)
|
||||
|
||||
C `#ifdef`s only work outside of `GLOBAL_ASM` calls, but is otherwise able to replace `.ifdef`.
|
||||
|
||||
### What's up with "late rodata"?
|
||||
|
||||
The IDO compiler emits rodata in two passes: first array/string contents, then large literals/switch jump tables.
|
||||
|
||||
Data declared within `.rdata`/`.section .rodata` will end up in the first half, and `.late_rodata`/`.section .late_rodata` in the second half.
|
||||
|
||||
### How does it work?
|
||||
|
||||
It's a bit of a hack!
|
||||
The basic idea is replace `GLOBAL_ASM` blocks with dummy C functions/global vars of the same sections sizes as the assembly.
|
||||
Then the C file gets compiled, and the dummy contents overwritten with the injected assembly.
|
||||
|
||||
To accomplish this, asm-processor has logic for guessing the size of assembly contents
|
||||
(which assumes the assembly isn't too complicated, e.g. no macros),
|
||||
and for emitting C code of exact sizes for a bunch of different IDO compiler flags.
|
||||
|
||||
The assembler code is padded with nops to line it up with its correct position in the C;
|
||||
this allows C and asm ELF files to be merged easily without having to fix up e.g. symbol addresses.
|
||||
|
||||
The most difficulty part is `late_rodata`, which is hard to create programmatically.
|
||||
asm-processor does that by emitting code that uses dummy float literals/double literals/jump tables,
|
||||
assembles the late_rodata at another location of the .rodata section, then overwrites the dummy rodata.
|
||||
This does require some movement of symbols and relocations, and quite a bit of care in what code to
|
||||
emit and how to preserve .double alignment.
|
||||
|
||||
It's worth noting some alternative ways in which asm-processor would have been implemented:
|
||||
- One idea to get rid of the C/asm size estimations is to emit arbitrary code, and then move code,
|
||||
symbols and relocations to the correct place after the sizes are known.
|
||||
Given the machinery for `late_rodata` this wouldn't have been too difficult, and it would have the upside of improved portability.
|
||||
There is a big downside, however: using dummy code of incorrect size throws off alignment and can introduce unintended padding.
|
||||
Fixing this would require running multiple passes of asm-processor, with one compile per `ASM_GLOBAL`.
|
||||
- Another idea is to run the compiler with -S to emit assembly, modify the emitted assembly, then run the assembler
|
||||
(which in IDO's case may perform additional instruction reordering etc.).
|
||||
This option has not been investigated in much detail, and would perhaps be superior to the current implementation.
|
||||
It does have a few unknowns to it, e.g. instruction encoding differences between GNU `as` and IDO's assembler,
|
||||
how to avoid reordering the injected assembly, and how .rodata/.late_rodata are implemented.
|
||||
|
||||
### Testing
|
||||
|
||||
There are a few tests to ensure you don't break anything when hacking on asm-processor: `./run-tests.sh` should exit without output if they pass, or else output a diff from previous to new version.
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
for A in "$@"; do
|
||||
./compile.sh "$A" && mips-linux-gnu-objdump -s "${A%.c}.o" > "${A%.c}.objdump"
|
||||
done
|
||||
@@ -380,7 +380,7 @@ class Failure(Exception):
|
||||
|
||||
|
||||
class GlobalState:
|
||||
def __init__(self, min_instr_count, skip_instr_count, use_jtbl_for_rodata, mips1):
|
||||
def __init__(self, min_instr_count, skip_instr_count, use_jtbl_for_rodata):
|
||||
# A value that hopefully never appears as a 32-bit rodata constant (or we
|
||||
# miscompile late rodata). Increases by 1 in each step.
|
||||
self.late_rodata_hex = 0xE0123456
|
||||
@@ -388,7 +388,6 @@ class GlobalState:
|
||||
self.min_instr_count = min_instr_count
|
||||
self.skip_instr_count = skip_instr_count
|
||||
self.use_jtbl_for_rodata = use_jtbl_for_rodata
|
||||
self.mips1 = mips1
|
||||
|
||||
def next_late_rodata_hex(self):
|
||||
dummy_bytes = struct.pack('>I', self.late_rodata_hex)
|
||||
@@ -609,13 +608,12 @@ class GlobalAsmBlock:
|
||||
size = self.fn_section_sizes['.late_rodata'] // 4
|
||||
skip_next = False
|
||||
needs_double = (self.late_rodata_alignment != 0)
|
||||
extra_mips1_nop = False
|
||||
for i in range(size):
|
||||
if skip_next:
|
||||
skip_next = False
|
||||
continue
|
||||
# Jump tables give 9 instructions (11 with -mips1) for >= 5 words of rodata,
|
||||
# and should be emitted when:
|
||||
# Jump tables give 9 instructions for >= 5 words of rodata, and should be
|
||||
# emitted when:
|
||||
# - -O2 or -O2 -g3 are used, which give the right codegen
|
||||
# - we have emitted our first .float/.double (to ensure that we find the
|
||||
# created rodata in the binary)
|
||||
@@ -625,14 +623,12 @@ class GlobalAsmBlock:
|
||||
# generate a jump table)
|
||||
# - we have at least 10 more instructions to go in this function (otherwise our
|
||||
# function size computation will be wrong since the delay slot goes unused)
|
||||
jtbl_size = 11 if state.mips1 else 9
|
||||
if (not needs_double and state.use_jtbl_for_rodata and i >= 1 and
|
||||
size - i >= 5 and num_instr - len(late_rodata_fn_output) >= jtbl_size + 1):
|
||||
size - i >= 5 and num_instr - len(late_rodata_fn_output) >= 10):
|
||||
cases = " ".join("case {}:".format(case) for case in range(size - i))
|
||||
late_rodata_fn_output.append("switch (*(volatile int*)0) { " + cases + " ; }")
|
||||
late_rodata_fn_output.extend([""] * (jtbl_size - 1))
|
||||
late_rodata_fn_output.extend([""] * 8)
|
||||
jtbl_rodata_size = (size - i) * 4
|
||||
extra_mips1_nop = True
|
||||
break
|
||||
dummy_bytes = state.next_late_rodata_hex()
|
||||
late_rodata_dummy_bytes.append(dummy_bytes)
|
||||
@@ -642,20 +638,12 @@ class GlobalAsmBlock:
|
||||
fval, = struct.unpack('>d', dummy_bytes + dummy_bytes2)
|
||||
late_rodata_fn_output.append('*(volatile double*)0 = {};'.format(fval))
|
||||
skip_next = True
|
||||
needs_double = False
|
||||
if state.mips1:
|
||||
# mips1 does not have ldc1/sdc1
|
||||
late_rodata_fn_output.append('')
|
||||
late_rodata_fn_output.append('')
|
||||
extra_mips1_nop = False
|
||||
needs_double = True
|
||||
else:
|
||||
fval, = struct.unpack('>f', dummy_bytes)
|
||||
late_rodata_fn_output.append('*(volatile float*)0 = {}f;'.format(fval))
|
||||
extra_mips1_nop = True
|
||||
late_rodata_fn_output.append('')
|
||||
late_rodata_fn_output.append('')
|
||||
if state.mips1 and extra_mips1_nop:
|
||||
late_rodata_fn_output.append('')
|
||||
|
||||
text_name = None
|
||||
if self.fn_section_sizes['.text'] > 0 or late_rodata_fn_output:
|
||||
@@ -734,7 +722,7 @@ float_regexpr = re.compile(r"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?f")
|
||||
def repl_float_hex(m):
|
||||
return str(struct.unpack(">I", struct.pack(">f", float(m.group(0).strip().rstrip("f"))))[0])
|
||||
|
||||
def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_dependencies, print_source=None):
|
||||
def parse_source(f, opt, framepointer, input_enc, output_enc, out_dependencies, print_source=None):
|
||||
if opt in ['O2', 'O1']:
|
||||
if framepointer:
|
||||
min_instr_count = 6
|
||||
@@ -763,7 +751,7 @@ def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_depende
|
||||
if opt in ['O2', 'g3'] and not framepointer:
|
||||
use_jtbl_for_rodata = True
|
||||
|
||||
state = GlobalState(min_instr_count, skip_instr_count, use_jtbl_for_rodata, mips1)
|
||||
state = GlobalState(min_instr_count, skip_instr_count, use_jtbl_for_rodata)
|
||||
|
||||
global_asm = None
|
||||
asm_functions = []
|
||||
@@ -815,7 +803,7 @@ def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_depende
|
||||
out_dependencies.append(fname)
|
||||
include_src = StringIO()
|
||||
with open(fname, encoding=input_enc) as include_file:
|
||||
parse_source(include_file, opt, framepointer, mips1, input_enc, output_enc, out_dependencies, include_src)
|
||||
parse_source(include_file, opt, framepointer, input_enc, output_enc, out_dependencies, include_src)
|
||||
include_src.write('#line ' + str(line_no + 1) + ' "' + f.name + '"')
|
||||
output_lines[-1] = include_src.getvalue()
|
||||
include_src.close()
|
||||
@@ -1191,7 +1179,6 @@ def run_wrapped(argv, outfile, functions):
|
||||
parser.add_argument('--input-enc', default='latin1', help="Input encoding (default: latin1)")
|
||||
parser.add_argument('--output-enc', default='latin1', help="Output encoding (default: latin1)")
|
||||
parser.add_argument('-framepointer', dest='framepointer', action='store_true')
|
||||
parser.add_argument('-mips1', dest='mips1', action='store_true')
|
||||
parser.add_argument('-g3', dest='g3', action='store_true')
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('-O1', dest='opt', action='store_const', const='O1')
|
||||
@@ -1203,20 +1190,18 @@ def run_wrapped(argv, outfile, functions):
|
||||
if opt != 'O2':
|
||||
raise Failure("-g3 is only supported together with -O2")
|
||||
opt = 'g3'
|
||||
if args.mips1 and (opt != 'O2' or args.framepointer):
|
||||
raise Failure("-mips1 is only supported together with -O2")
|
||||
|
||||
if args.objfile is None:
|
||||
with open(args.filename, encoding=args.input_enc) as f:
|
||||
deps = []
|
||||
functions = parse_source(f, opt=opt, framepointer=args.framepointer, mips1=args.mips1, input_enc=args.input_enc, output_enc=args.output_enc, out_dependencies=deps, print_source=outfile)
|
||||
functions = parse_source(f, opt=opt, framepointer=args.framepointer, input_enc=args.input_enc, output_enc=args.output_enc, out_dependencies=deps, print_source=outfile)
|
||||
return functions, deps
|
||||
else:
|
||||
if args.assembler is None:
|
||||
raise Failure("must pass assembler command")
|
||||
if functions is None:
|
||||
with open(args.filename, encoding=args.input_enc) as f:
|
||||
functions = parse_source(f, opt=opt, framepointer=args.framepointer, mips1=args.mips1, input_enc=args.input_enc, out_dependencies=[], output_enc=args.output_enc)
|
||||
functions = parse_source(f, opt=opt, framepointer=args.framepointer, input_enc=args.input_enc, out_dependencies=[], output_enc=args.output_enc)
|
||||
if not functions:
|
||||
return
|
||||
asm_prelude = b''
|
||||
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
import asm_processor
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
prelude = os.path.join(dir_path, "prelude.inc")
|
||||
|
||||
all_args = sys.argv[1:]
|
||||
sep1 = all_args.index('--')
|
||||
sep2 = all_args.index('--', sep1+1)
|
||||
|
||||
compiler = all_args[:sep1]
|
||||
|
||||
assembler = all_args[sep1+1:sep2]
|
||||
assembler_sh = ' '.join(shlex.quote(x) for x in assembler)
|
||||
|
||||
compile_args = all_args[sep2+1:]
|
||||
in_file = compile_args[-1]
|
||||
out_ind = compile_args.index('-o')
|
||||
out_file = compile_args[out_ind + 1]
|
||||
del compile_args[-1]
|
||||
del compile_args[out_ind + 1]
|
||||
del compile_args[out_ind]
|
||||
|
||||
in_dir = os.path.split(os.path.realpath(in_file))[0]
|
||||
opt_flags = [x for x in compile_args if x in ['-g3', '-g', '-O1', '-O2', '-framepointer']]
|
||||
|
||||
preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c', delete=False)
|
||||
|
||||
try:
|
||||
asmproc_flags = opt_flags + [in_file, '--input-enc', 'utf-8', '--output-enc', 'euc-jp']
|
||||
compile_cmdline = compiler + compile_args + ['-I', in_dir, '-o', out_file, preprocessed_file.name]
|
||||
|
||||
functions, deps = asm_processor.run(asmproc_flags, outfile=preprocessed_file)
|
||||
try:
|
||||
subprocess.check_call(compile_cmdline)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Failed to compile file " + in_file + ". Command line:")
|
||||
print()
|
||||
print(' '.join(shlex.quote(x) for x in compile_cmdline))
|
||||
print()
|
||||
sys.exit(55)
|
||||
# To keep the preprocessed file:
|
||||
# os._exit(1)
|
||||
|
||||
asm_processor.run(asmproc_flags + ['--post-process', out_file, '--assembler', assembler_sh, '--asm-prelude', prelude], functions=functions)
|
||||
|
||||
deps_file = out_file[:-2] + ".asmproc.d"
|
||||
if deps:
|
||||
with open(deps_file, "w") as f:
|
||||
f.write(out_file + ": " + " \\\n ".join(deps) + "\n")
|
||||
for dep in deps:
|
||||
f.write("\n" + dep + ":\n")
|
||||
else:
|
||||
try:
|
||||
os.remove(deps_file)
|
||||
except OSError:
|
||||
pass
|
||||
finally:
|
||||
os.remove(preprocessed_file.name)
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
INPUT="$1"
|
||||
OUTPUT="${INPUT%.c}.o"
|
||||
|
||||
CC="$QEMU_IRIX -silent -L $IRIX_ROOT $IRIX_ROOT/usr/bin/cc"
|
||||
CFLAGS="-Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -fullwarn -wlint -woff 819,820,852,821 -signed -DVERSION_JP=1" # -I include
|
||||
AS="mips-linux-gnu-as"
|
||||
ASFLAGS="-march=vr4300 -mabi=32 --defsym VERSION_JP=1" # -I include
|
||||
set +e
|
||||
OPTFLAGS=$(grep '^// COMPILE-FLAGS: ' $INPUT | sed 's#^// COMPILE-FLAGS: ##')
|
||||
ISET=$(grep '^// COMPILE-ISET: ' $INPUT | sed 's#^// COMPILE-ISET: ##')
|
||||
set -e
|
||||
if [[ -z "$OPTFLAGS" ]]; then
|
||||
OPTFLAGS="-g"
|
||||
fi
|
||||
if [[ -z "$ISET" ]]; then
|
||||
CFLAGS="$CFLAGS -mips2"
|
||||
fi
|
||||
|
||||
python3 asm_processor.py $OPTFLAGS $ISET "$INPUT" | $CC -c $CFLAGS include-stdin.c -o "$OUTPUT" $OPTFLAGS
|
||||
python3 asm_processor.py $OPTFLAGS $ISET "$INPUT" --post-process "$OUTPUT" --assembler "$AS $ASFLAGS" --asm-prelude prelude.s
|
||||
@@ -1,2 +0,0 @@
|
||||
// (this is used for piping input to the IRIX compiler without needing to make a temporary .c file)
|
||||
#include "/dev/stdin"
|
||||
@@ -0,0 +1,5 @@
|
||||
.set noat
|
||||
.set noreorder
|
||||
.set gp=64
|
||||
.include "macro.inc"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
.set noat
|
||||
.set noreorder
|
||||
.set gp=64
|
||||
.macro glabel label
|
||||
.global \label
|
||||
\label:
|
||||
.endm
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
for A in tests/*.c; do
|
||||
OBJDUMPFLAGS=$(grep '^// OBJDUMP-FLAGS: ' "$A" | sed 's#^// OBJDUMP-FLAGS: ##')
|
||||
if [[ -z "$OBJDUMPFLAGS" ]]; then
|
||||
OBJDUMPFLAGS="-s"
|
||||
fi
|
||||
./compile.sh "$A" && mips-linux-gnu-objdump $OBJDUMPFLAGS "${A%.c}.o" | diff - "${A%.c}.objdump" || echo FAIL "$A"
|
||||
done
|
||||
@@ -1,19 +0,0 @@
|
||||
void foo(void) { "abcdef"; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.ascii "AB"
|
||||
.ascii "CD", "EF"
|
||||
.ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK"
|
||||
)
|
||||
|
||||
void bar(void) { "hello"; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.asciiz "12"
|
||||
.asciiz "34", "56"
|
||||
.asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A"
|
||||
)
|
||||
|
||||
void baz(void) { "ghijkl"; }
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
tests/ascii.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 03e00008 00000000 03e00008 00000000 ................
|
||||
0010 03e00008 00000000 03e00008 00000000 ................
|
||||
0020 03e00008 00000000 03e00008 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH
|
||||
0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ
|
||||
0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3
|
||||
0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$
|
||||
0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl..
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000000 00000000 . ..............
|
||||
0010 00000000 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 80000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,6 +0,0 @@
|
||||
const char before[] = "^";
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.asciz "aaaa /* bbbb */ # cccc" /**//**//**//**/ /*/ "xxxx" /*/ /* dddd " eeee */ "# ffff" # gggg "hhhh" /* iiii */
|
||||
)
|
||||
const char after[] = "$";
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
tests/comments.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .rodata:
|
||||
0000 5e000000 61616161 202f2a20 62626262 ^...aaaa /* bbbb
|
||||
0010 202a2f20 23206363 63630023 20666666 */ # cccc.# fff
|
||||
0020 66000000 24000000 00000000 00000000 f...$...........
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 00000000 00000000 . ..............
|
||||
0010 00000000 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 00000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,7 +0,0 @@
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.word 0x12345678
|
||||
glabel blah
|
||||
.word blah2
|
||||
/*a*/ blah2: /*b*/ .word blah /*c*/
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
tests/label-sameline.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .rodata:
|
||||
0000 12345678 00000008 00000000 00000000 .4Vx............
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 00000000 00000000 . ..............
|
||||
0010 00000000 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 00000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,164 +0,0 @@
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel test
|
||||
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
addiu $sp, $sp, -24
|
||||
sw $zero, 4($sp)
|
||||
lw $t6, 4($sp)
|
||||
addu $t7, $a0, $t6
|
||||
sb $zero, ($t7)
|
||||
lw $t8, 4($sp)
|
||||
addiu $t9, $t8, 1
|
||||
slt $at, $t9, $a1
|
||||
sw $t9, 4($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, $sp, 24
|
||||
|
||||
)
|
||||
|
||||
void foo(void) {}
|
||||
@@ -1,50 +0,0 @@
|
||||
|
||||
tests/large.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0010 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0020 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0030 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0040 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0050 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0060 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0070 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0080 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0090 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
00a0 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
00b0 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
00c0 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
00d0 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
00e0 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
00f0 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0100 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0110 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0120 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0130 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0140 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0150 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0160 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0170 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0180 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0190 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
01a0 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
01b0 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
01c0 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
01d0 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
01e0 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
01f0 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0200 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0210 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0220 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0230 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0240 27bdffe8 afa00004 8fae0004 008e7821 '.............x!
|
||||
0250 a1e00000 8fb80004 27190001 0325082a ........'....%.*
|
||||
0260 afb90004 00000000 03e00008 27bd0018 ............'...
|
||||
0270 03e00008 00000000 03e00008 00000000 ................
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000000 00000000 . ..............
|
||||
0010 00000000 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 a300c032 00000000 00000000 00000000 ...2............
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,80 +0,0 @@
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.1
|
||||
.float 4.2
|
||||
.float 4.3
|
||||
.float 4.4
|
||||
.text
|
||||
glabel a
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float foo(void) { "foo"; return 1.1f; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.late_rodata_alignment 4
|
||||
.float 5.1
|
||||
.float 5.2
|
||||
.float 5.3
|
||||
.float 5.4
|
||||
.text
|
||||
glabel b
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float bar(void) { "bar"; return 1.2f; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.late_rodata_alignment 8
|
||||
.float 6.1
|
||||
.float 6.2
|
||||
.float 6.3
|
||||
.float 6.4
|
||||
.float 6.5
|
||||
.text
|
||||
glabel c
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
tests/late_rodata_align.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 00000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00000000 00000000 00000000 ................
|
||||
0020 00000000 00000000 00000000 00000000 ................
|
||||
0030 00000000 00000000 00000000 00000000 ................
|
||||
0040 3c010000 03e00008 c4200018 03e00008 <........ ......
|
||||
0050 00000000 03e00008 00000000 00000000 ................
|
||||
0060 00000000 00000000 00000000 00000000 ................
|
||||
0070 00000000 00000000 00000000 00000000 ................
|
||||
0080 00000000 00000000 00000000 00000000 ................
|
||||
0090 3c010000 03e00008 c420002c 03e00008 <........ .,....
|
||||
00a0 00000000 03e00008 00000000 00000000 ................
|
||||
00b0 00000000 00000000 00000000 00000000 ................
|
||||
00c0 00000000 00000000 00000000 00000000 ................
|
||||
00d0 00000000 00000000 00000000 00000000 ................
|
||||
00e0 00000000 00000000 00000000 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 666f6f00 62617200 40833333 40866666 foo.bar.@.33@.ff
|
||||
0010 4089999a 408ccccd 3f8ccccd 40a33333 @...@...?...@.33
|
||||
0020 40a66666 40a9999a 40accccd 3f99999a @.ff@...@...?...
|
||||
0030 40c33333 40c66666 40c9999a 40cccccd @.33@.ff@...@...
|
||||
0040 40d00000 00000000 00000000 00000000 @...............
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000002 00000000 . ..............
|
||||
0010 000005f1 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 80000002 00000000 000005f1 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,83 +0,0 @@
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.1
|
||||
.text
|
||||
glabel a
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float foo(void) {
|
||||
return 4.15f;
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.2
|
||||
.word 0
|
||||
.double 4.3
|
||||
.text
|
||||
glabel b
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float bar(void) {
|
||||
return 4.4f;
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.55
|
||||
.double 4.6
|
||||
.text
|
||||
glabel c
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float baz(void) {
|
||||
return 4.6f;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
tests/late_rodata_doubles.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 00000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00000000 00000000 00000000 ................
|
||||
0020 00000000 00000000 00000000 00000000 ................
|
||||
0030 00000000 00000000 00000000 00000000 ................
|
||||
0040 3c010000 03e00008 c4200004 03e00008 <........ ......
|
||||
0050 00000000 03e00008 00000000 00000000 ................
|
||||
0060 00000000 00000000 00000000 00000000 ................
|
||||
0070 00000000 00000000 00000000 00000000 ................
|
||||
0080 00000000 00000000 00000000 00000000 ................
|
||||
0090 00000000 00000000 00000000 3c010000 ............<...
|
||||
00a0 03e00008 c4200018 03e00008 00000000 ..... ..........
|
||||
00b0 03e00008 00000000 00000000 00000000 ................
|
||||
00c0 00000000 00000000 00000000 00000000 ................
|
||||
00d0 00000000 00000000 00000000 00000000 ................
|
||||
00e0 00000000 00000000 00000000 00000000 ................
|
||||
00f0 00000000 00000000 3c010000 03e00008 ........<.......
|
||||
0100 c4200028 03e00008 00000000 03e00008 . .(............
|
||||
0110 00000000 00000000 00000000 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff....
|
||||
0010 40113333 33333333 408ccccd 4091999a @.333333@...@...
|
||||
0020 40126666 66666666 40933333 00000000 @.ffffff@.33....
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000002 00000000 . ..............
|
||||
0010 000000f1 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 80000002 00000000 000000f1 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,86 +0,0 @@
|
||||
// COMPILE-FLAGS: -O2
|
||||
// COMPILE-ISET: -mips1
|
||||
// exact copy of late_rodata_doubles.c except for the -mips1 -O2 additions
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.1
|
||||
.text
|
||||
glabel a
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float foo(void) {
|
||||
return 4.15f;
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.2
|
||||
.word 0
|
||||
.double 4.3
|
||||
.text
|
||||
glabel b
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float bar(void) {
|
||||
return 4.4f;
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.55
|
||||
.double 4.6
|
||||
.text
|
||||
glabel c
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
float baz(void) {
|
||||
return 4.6f;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
|
||||
tests/late_rodata_doubles_mips1.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 00000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00000000 00000000 00000000 ................
|
||||
0020 00000000 00000000 00000000 00000000 ................
|
||||
0030 00000000 00000000 00000000 00000000 ................
|
||||
0040 3c010000 c4200004 03e00008 00000000 <.... ..........
|
||||
0050 00000000 00000000 00000000 00000000 ................
|
||||
0060 00000000 00000000 00000000 00000000 ................
|
||||
0070 00000000 00000000 00000000 00000000 ................
|
||||
0080 00000000 00000000 00000000 00000000 ................
|
||||
0090 3c010000 c4200018 03e00008 00000000 <.... ..........
|
||||
00a0 00000000 00000000 00000000 00000000 ................
|
||||
00b0 00000000 00000000 00000000 00000000 ................
|
||||
00c0 00000000 00000000 00000000 00000000 ................
|
||||
00d0 00000000 00000000 00000000 00000000 ................
|
||||
00e0 3c010000 c4200028 03e00008 00000000 <.... .(........
|
||||
Contents of section .rodata:
|
||||
0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff....
|
||||
0010 40113333 33333333 408ccccd 4091999a @.333333@...@...
|
||||
0020 40126666 66666666 40933333 00000000 @.ffffff@.33....
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000002 00000000 . ..............
|
||||
0010 000c0011 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 80000002 00000000 000c0011 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,77 +0,0 @@
|
||||
// COMPILE-FLAGS: -O2
|
||||
float a(void) { return 1.1f; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel a2
|
||||
move $a0, $a0
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
jr $ra
|
||||
move $a0, $a0
|
||||
)
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
|
||||
glabel jtbl
|
||||
.word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10
|
||||
.word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20
|
||||
.word case21, case22, case23, case24, case25, case26
|
||||
|
||||
.text
|
||||
glabel foo
|
||||
sltiu $at, $a0, 0xa
|
||||
beqz $at, .L756E659B
|
||||
sll $t7, $a0, 2
|
||||
lui $at, %hi(jtbl)
|
||||
addu $at, $at, $t7
|
||||
lw $t7, %lo(jtbl)($at)
|
||||
jr $t7
|
||||
nop
|
||||
case0: addiu $a0, $a0, 1
|
||||
case1: addiu $a0, $a0, 1
|
||||
case2: addiu $a0, $a0, 1
|
||||
case3: addiu $a0, $a0, 1
|
||||
case4: addiu $a0, $a0, 1
|
||||
case5: addiu $a0, $a0, 1
|
||||
case6: addiu $a0, $a0, 1
|
||||
case7: addiu $a0, $a0, 1
|
||||
case8: addiu $a0, $a0, 1
|
||||
case9: addiu $a0, $a0, 1
|
||||
case10: addiu $a0, $a0, 1
|
||||
case11: addiu $a0, $a0, 1
|
||||
case12: addiu $a0, $a0, 1
|
||||
case13: addiu $a0, $a0, 1
|
||||
case14: addiu $a0, $a0, 1
|
||||
case15: addiu $a0, $a0, 1
|
||||
case16: addiu $a0, $a0, 1
|
||||
case17: addiu $a0, $a0, 1
|
||||
case18: addiu $a0, $a0, 1
|
||||
case19: addiu $a0, $a0, 1
|
||||
case20: addiu $a0, $a0, 1
|
||||
case21: addiu $a0, $a0, 1
|
||||
case22: addiu $a0, $a0, 1
|
||||
case23: addiu $a0, $a0, 1
|
||||
case24: addiu $a0, $a0, 1
|
||||
case25: addiu $a0, $a0, 1
|
||||
case26:
|
||||
jr $ra
|
||||
addiu $v0, $a0, 1
|
||||
|
||||
.L756E659B:
|
||||
addiu $v0, $zero, 2
|
||||
jr $ra
|
||||
nop
|
||||
)
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel b2
|
||||
move $a0, $a0
|
||||
nop
|
||||
nop
|
||||
jr $ra
|
||||
move $a0, $a0
|
||||
)
|
||||
|
||||
float b(void) { return 1.2f; }
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
tests/late_rodata_jtbl.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 3c010000 03e00008 c4200000 00802025 <........ .... %
|
||||
0010 00000000 00000000 00000000 03e00008 ................
|
||||
0020 00802025 2c81000a 10200022 00047880 .. %,.... ."..x.
|
||||
0030 3c010000 002f0821 8c2f0000 01e00008 <..../.!./......
|
||||
0040 00000000 24840001 24840001 24840001 ....$...$...$...
|
||||
0050 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0060 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0070 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0080 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0090 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
00a0 24840001 24840001 24840001 03e00008 $...$...$.......
|
||||
00b0 24820001 24020002 03e00008 00000000 $...$...........
|
||||
00c0 00802025 00000000 00000000 03e00008 .. %............
|
||||
00d0 00802025 3c010000 03e00008 c4200070 .. %<........ .p
|
||||
Contents of section .rodata:
|
||||
0000 3f8ccccd 00000044 00000048 0000004c ?......D...H...L
|
||||
0010 00000050 00000054 00000058 0000005c ...P...T...X...\
|
||||
0020 00000060 00000064 00000068 0000006c ...`...d...h...l
|
||||
0030 00000070 00000074 00000078 0000007c ...p...t...x...|
|
||||
0040 00000080 00000084 00000088 0000008c ................
|
||||
0050 00000090 00000094 00000098 0000009c ................
|
||||
0060 000000a0 000000a4 000000a8 000000ac ................
|
||||
0070 3f99999a 00000000 00000000 00000000 ?...............
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80004002 00000000 . ........@.....
|
||||
0010 00000011 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 8000c016 00000000 00000011 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,79 +0,0 @@
|
||||
// COMPILE-FLAGS: -O2
|
||||
// COMPILE-ISET: -mips1
|
||||
// exact copy of late_rodata_jtbl.c except for the -mips1 addition
|
||||
float a(void) { return 1.1f; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel a2
|
||||
move $a0, $a0
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
jr $ra
|
||||
move $a0, $a0
|
||||
)
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
|
||||
glabel jtbl
|
||||
.word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10
|
||||
.word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20
|
||||
.word case21, case22, case23, case24, case25, case26
|
||||
|
||||
.text
|
||||
glabel foo
|
||||
sltiu $at, $a0, 0xa
|
||||
beqz $at, .L756E659B
|
||||
sll $t7, $a0, 2
|
||||
lui $at, %hi(jtbl)
|
||||
addu $at, $at, $t7
|
||||
lw $t7, %lo(jtbl)($at)
|
||||
jr $t7
|
||||
nop
|
||||
case0: addiu $a0, $a0, 1
|
||||
case1: addiu $a0, $a0, 1
|
||||
case2: addiu $a0, $a0, 1
|
||||
case3: addiu $a0, $a0, 1
|
||||
case4: addiu $a0, $a0, 1
|
||||
case5: addiu $a0, $a0, 1
|
||||
case6: addiu $a0, $a0, 1
|
||||
case7: addiu $a0, $a0, 1
|
||||
case8: addiu $a0, $a0, 1
|
||||
case9: addiu $a0, $a0, 1
|
||||
case10: addiu $a0, $a0, 1
|
||||
case11: addiu $a0, $a0, 1
|
||||
case12: addiu $a0, $a0, 1
|
||||
case13: addiu $a0, $a0, 1
|
||||
case14: addiu $a0, $a0, 1
|
||||
case15: addiu $a0, $a0, 1
|
||||
case16: addiu $a0, $a0, 1
|
||||
case17: addiu $a0, $a0, 1
|
||||
case18: addiu $a0, $a0, 1
|
||||
case19: addiu $a0, $a0, 1
|
||||
case20: addiu $a0, $a0, 1
|
||||
case21: addiu $a0, $a0, 1
|
||||
case22: addiu $a0, $a0, 1
|
||||
case23: addiu $a0, $a0, 1
|
||||
case24: addiu $a0, $a0, 1
|
||||
case25: addiu $a0, $a0, 1
|
||||
case26:
|
||||
jr $ra
|
||||
addiu $v0, $a0, 1
|
||||
|
||||
.L756E659B:
|
||||
addiu $v0, $zero, 2
|
||||
jr $ra
|
||||
nop
|
||||
)
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel b2
|
||||
move $a0, $a0
|
||||
nop
|
||||
nop
|
||||
jr $ra
|
||||
move $a0, $a0
|
||||
)
|
||||
|
||||
float b(void) { return 1.2f; }
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
tests/late_rodata_jtbl_mips1.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 3c010000 c4200000 03e00008 00000000 <.... ..........
|
||||
0010 00802025 00000000 00000000 00000000 .. %............
|
||||
0020 03e00008 00802025 2c81000a 10200022 ...... %,.... ."
|
||||
0030 00047880 3c010000 002f0821 8c2f0000 ..x.<..../.!./..
|
||||
0040 01e00008 00000000 24840001 24840001 ........$...$...
|
||||
0050 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0060 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0070 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0080 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
0090 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
00a0 24840001 24840001 24840001 24840001 $...$...$...$...
|
||||
00b0 03e00008 24820001 24020002 03e00008 ....$...$.......
|
||||
00c0 00000000 00802025 00000000 00000000 ...... %........
|
||||
00d0 03e00008 00802025 3c010000 c4200070 ...... %<.... .p
|
||||
00e0 03e00008 00000000 00000000 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 3f8ccccd 00000048 0000004c 00000050 ?......H...L...P
|
||||
0010 00000054 00000058 0000005c 00000060 ...T...X...\...`
|
||||
0020 00000064 00000068 0000006c 00000070 ...d...h...l...p
|
||||
0030 00000074 00000078 0000007c 00000080 ...t...x...|....
|
||||
0040 00000084 00000088 0000008c 00000090 ................
|
||||
0050 00000094 00000098 0000009c 000000a0 ................
|
||||
0060 000000a4 000000a8 000000ac 000000b0 ................
|
||||
0070 3f99999a 00000000 00000000 00000000 ?...............
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80004002 00000000 . ........@.....
|
||||
0010 00000011 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 8000c016 00000000 00000011 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,77 +0,0 @@
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.01
|
||||
.word 0
|
||||
.double 4.02
|
||||
.text
|
||||
glabel a
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
double foo(void) { return 4.03; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 4.04
|
||||
.double 4.05
|
||||
.text
|
||||
glabel b
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
double bar(void) { return 4.06; }
|
||||
float baz(void) { return 4.07f; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.double 4.08
|
||||
.text
|
||||
glabel c
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
tests/late_rodata_misaligned_doubles.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 00000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00000000 00000000 00000000 ................
|
||||
0020 00000000 00000000 00000000 00000000 ................
|
||||
0030 00000000 00000000 00000000 00000000 ................
|
||||
0040 3c010000 03e00008 d4200010 03e00008 <........ ......
|
||||
0050 00000000 03e00008 00000000 00000000 ................
|
||||
0060 00000000 00000000 00000000 00000000 ................
|
||||
0070 00000000 00000000 00000000 00000000 ................
|
||||
0080 00000000 00000000 00000000 00000000 ................
|
||||
0090 00000000 00000000 00000000 3c010000 ............<...
|
||||
00a0 03e00008 d4200028 03e00008 00000000 ..... .(........
|
||||
00b0 03e00008 00000000 3c010000 03e00008 ........<.......
|
||||
00c0 c4200030 03e00008 00000000 03e00008 . .0............
|
||||
00d0 00000000 00000000 00000000 00000000 ................
|
||||
00e0 00000000 00000000 00000000 00000000 ................
|
||||
00f0 00000000 00000000 00000000 00000000 ................
|
||||
0100 00000000 00000000 00000000 00000000 ................
|
||||
0110 00000000 00000000 00000000 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 408051ec 00000000 4010147a e147ae14 @.Q.....@..z.G..
|
||||
0010 40101eb8 51eb851f 00000000 408147ae @...Q.......@.G.
|
||||
0020 40103333 33333333 40103d70 a3d70a3d @.333333@.=p...=
|
||||
0030 40823d71 00000000 401051eb 851eb852 @.=q....@.Q....R
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000002 00000000 . ..............
|
||||
0010 000000f3 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 80000002 00000000 000000f3 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,4 +0,0 @@
|
||||
.rdata
|
||||
label: .asciiz "1\n\
|
||||
2" \
|
||||
"34", "56"
|
||||
@@ -1,22 +0,0 @@
|
||||
void foo(void) { "abcdef"; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.ascii "AB" \
|
||||
"CD", "EF"
|
||||
.ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK"
|
||||
)
|
||||
|
||||
void bar(void) { "hello"; }
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.asciiz "1\
|
||||
2"
|
||||
.asciiz "34", "56"
|
||||
.asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A"
|
||||
)
|
||||
|
||||
void baz(void) { "ghijkl"; }
|
||||
|
||||
GLOBAL_ASM("tests/line-continuation-separate-file.s")
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
tests/line-continuation.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 03e00008 00000000 03e00008 00000000 ................
|
||||
0010 03e00008 00000000 03e00008 00000000 ................
|
||||
0020 03e00008 00000000 03e00008 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH
|
||||
0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ
|
||||
0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3
|
||||
0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$
|
||||
0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl..
|
||||
0050 310a3200 33340035 36000000 00000000 1.2.34.56.......
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000000 00000000 . ..............
|
||||
0010 00000000 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 80000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,26 +0,0 @@
|
||||
// COMPILE-FLAGS: -O2
|
||||
|
||||
int a(void) { return 1; }
|
||||
GLOBAL_ASM(
|
||||
glabel foo
|
||||
addiu $a0, $a0, 1
|
||||
addiu $a0, $a0, 2
|
||||
addiu $a0, $a0, 3
|
||||
jr $ra
|
||||
addiu $a0, $a0, 4
|
||||
)
|
||||
float b(void) { return 1.2f; }
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
glabel float1
|
||||
.float 12.34
|
||||
|
||||
.text
|
||||
glabel bar
|
||||
addiu $a0, $a0, 5
|
||||
addiu $a0, $a0, 6
|
||||
lui $v0, %hi(float1 + 1)
|
||||
jr $ra
|
||||
addiu $v0, $v0, %lo(float1 + 1)
|
||||
)
|
||||
float c(void) { return 1.3f; }
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
tests/o2.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 03e00008 24020001 24840001 24840002 ....$...$...$...
|
||||
0010 24840003 03e00008 24840004 3c010000 $.......$...<...
|
||||
0020 03e00008 c4200000 24840005 24840006 ..... ..$...$...
|
||||
0030 3c020000 03e00008 24420001 3c010000 <.......$B..<...
|
||||
0040 03e00008 c4200008 00000000 00000000 ..... ..........
|
||||
Contents of section .rodata:
|
||||
0000 3f99999a 414570a4 3fa66666 00000000 ?...AEp.?.ff....
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80000006 00000000 . ..............
|
||||
0010 00000011 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 80000016 00000000 00000011 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,33 +0,0 @@
|
||||
// COMPILE-FLAGS: -O2
|
||||
// OBJDUMP-FLAGS: -srt
|
||||
static int xtext(int a, int b, int c);
|
||||
const int rodata1[] = {1};
|
||||
static const int rodata2[] = {2};
|
||||
int data1[] = {3};
|
||||
static int data2[] = {4};
|
||||
int bss1;
|
||||
static int bss2;
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel bar
|
||||
lui $a0, %hi(rodata2)
|
||||
lw $a0, %lo(rodata2)($a0)
|
||||
lui $a1, %hi(data2)
|
||||
lw $a1, %lo(data2)($a0)
|
||||
lui $a2, %hi(bss2)
|
||||
lw $a2, %lo(bss2)($a0)
|
||||
jal xtext
|
||||
nop
|
||||
jr $ra
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
)
|
||||
|
||||
static int xtext(int a, int b, int c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void baz(void) {
|
||||
xtext(bss2, rodata2[0], data2[0]);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
|
||||
tests/static.o: file format elf32-tradbigmips
|
||||
|
||||
SYMBOL TABLE:
|
||||
00000000 l d .text 00000080 .text
|
||||
00000000 l d .rodata 00000010 .rodata
|
||||
00000000 l d .data 00000010 .data
|
||||
00000000 l d .bss 00000010 .bss
|
||||
00000004 l O .rodata 00000000 rodata2
|
||||
00000004 l O .data 00000000 data2
|
||||
00000004 l O .bss 00000000 bss2
|
||||
00000030 l F .text 00000000 xtext
|
||||
00000000 g O .rodata 00000004 rodata1
|
||||
00000000 g O .data 00000004 data1
|
||||
00000000 g O .bss 00000004 bss1
|
||||
00000044 g F .text 00000034 baz
|
||||
00000000 g F .text 00000030 bar
|
||||
|
||||
|
||||
RELOCATION RECORDS FOR [.text]:
|
||||
OFFSET TYPE VALUE
|
||||
0000004c R_MIPS_HI16 .bss
|
||||
00000064 R_MIPS_LO16 .bss
|
||||
00000050 R_MIPS_HI16 .rodata
|
||||
0000005c R_MIPS_LO16 .rodata
|
||||
00000054 R_MIPS_HI16 .data
|
||||
00000058 R_MIPS_LO16 .data
|
||||
00000060 R_MIPS_26 .text
|
||||
00000000 R_MIPS_HI16 rodata2
|
||||
00000004 R_MIPS_LO16 rodata2
|
||||
00000008 R_MIPS_HI16 data2
|
||||
0000000c R_MIPS_LO16 data2
|
||||
00000010 R_MIPS_HI16 bss2
|
||||
00000014 R_MIPS_LO16 bss2
|
||||
00000018 R_MIPS_26 xtext
|
||||
|
||||
|
||||
Contents of section .text:
|
||||
0000 3c040000 8c840000 3c050000 8c850000 <.......<.......
|
||||
0010 3c060000 8c860000 0c000000 00000000 <...............
|
||||
0020 03e00008 00000000 00000000 00000000 ................
|
||||
0030 afa40000 afa50004 afa60008 03e00008 ................
|
||||
0040 24020001 27bdffe8 afbf0014 3c040000 $...'.......<...
|
||||
0050 3c050000 3c060000 8cc60004 8ca50004 <...<...........
|
||||
0060 0c00000c 8c840004 8fbf0014 27bd0018 ............'...
|
||||
0070 03e00008 00000000 00000000 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 00000001 00000002 00000000 00000000 ................
|
||||
Contents of section .data:
|
||||
0000 00000003 00000004 00000000 00000000 ................
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 a0000074 00000000 . .........t....
|
||||
0010 00000000 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 a0000074 00000000 00000000 00000000 ...t............
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.word 0x1212
|
||||
)
|
||||
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.word 0x123123
|
||||
.text
|
||||
glabel test
|
||||
/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24
|
||||
/* 000094 00400094 18A00009 */ blez $a1, .L004000BC
|
||||
/* 000098 00400098 AFA00004 */ sw $zero, 4($sp)
|
||||
.L0040009C:
|
||||
/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp)
|
||||
/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6
|
||||
/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7)
|
||||
/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp)
|
||||
/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1
|
||||
/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1
|
||||
/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C
|
||||
/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp)
|
||||
.L004000BC:
|
||||
/* 0000BC 004000BC 10000001 */ b .L004000C4
|
||||
/* 0000C0 004000C0 00000000 */ nop
|
||||
.L004000C4:
|
||||
/* 0000C4 004000C4 03E00008 */ jr $ra
|
||||
/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24
|
||||
)
|
||||
|
||||
char bss1[3];
|
||||
GLOBAL_ASM(
|
||||
.bss
|
||||
bss2:
|
||||
.space 3
|
||||
)
|
||||
char bss3[3];
|
||||
char bss4[3];
|
||||
const int rodata1[2] = {1};
|
||||
extern int some_rodata;
|
||||
|
||||
unsigned g(float, int);
|
||||
unsigned f(void) {
|
||||
return g(1.1f, some_rodata);
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
glabel some_rodata
|
||||
.word 0x1313
|
||||
.text
|
||||
.late_rodata
|
||||
.word 0x321321
|
||||
.text
|
||||
glabel g
|
||||
/* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4
|
||||
/* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100)
|
||||
/* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at)
|
||||
/* 0000D4 004000D4 0C10002C */ jal func_004000B0
|
||||
/* 0000D8 004000D8 00000000 */ nop
|
||||
/* 0000DC 004000DC 10000001 */ b .L004000E4
|
||||
/* 0000E0 004000E0 00000000 */ nop
|
||||
.L004000E4:
|
||||
/* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
/* 0000EC 004000EC 03E00008 */ jr $ra
|
||||
/* 0000F0 004000F0 00000000 */ nop
|
||||
)
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
tests/test1.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 27bdffe8 18a00009 afa00004 8fae0004 '...............
|
||||
0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'...
|
||||
0020 0325082a 1420fff9 afb90004 10000001 .%.*. ..........
|
||||
0030 00000000 03e00008 27bd0018 27bdffe8 ........'...'...
|
||||
0040 afbf0014 3c010000 3c050000 8ca50000 ....<...<.......
|
||||
0050 0c000000 c42c0014 10000003 00000000 .....,..........
|
||||
0060 10000001 00000000 8fbf0014 27bd0018 ............'...
|
||||
0070 03e00008 00000000 27bdffe8 afbf0014 ........'.......
|
||||
0080 240e0004 3c010000 ac2e0000 0c000000 $...<...........
|
||||
0090 00000000 10000001 00000000 8fbf0014 ................
|
||||
00a0 27bd0018 03e00008 00000000 00000000 '...............
|
||||
Contents of section .rodata:
|
||||
0000 00001212 00000001 00000000 00001313 ................
|
||||
0010 00123123 3f8ccccd 00321321 00000000 ..1#?....2.!....
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 a0000022 00000000 . ........."....
|
||||
0010 00001010 00000000 00000000 00007ff0 ................
|
||||
Contents of section .reginfo:
|
||||
0000 a300c032 00000000 00001010 00000000 ...2............
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,69 +0,0 @@
|
||||
const char buf1[1] = {1};
|
||||
float func1(void) {
|
||||
"func1";
|
||||
return 0.1f;
|
||||
}
|
||||
const char buf2[1] = {2};
|
||||
void func2(void) {
|
||||
*(volatile float*)0 = -3.5792360305786133f;
|
||||
*(volatile float*)0 = -3.5792362689971924f;
|
||||
// "func2";
|
||||
// return 0.2f;
|
||||
}
|
||||
const char buf3[1] = {3};
|
||||
int func3(int x) {
|
||||
switch(x) {
|
||||
case 0:
|
||||
return 1;
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
return 3;
|
||||
case 3:
|
||||
return 4;
|
||||
case 4:
|
||||
return 5;
|
||||
case 5:
|
||||
return 4;
|
||||
case 6:
|
||||
return 4;
|
||||
case 7:
|
||||
return 4;
|
||||
default:
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.word 0x66756e63 # func
|
||||
.word 0x34000000 # 4\0\0\0
|
||||
.word jumptarget
|
||||
|
||||
.late_rodata
|
||||
glabel rv
|
||||
.word 0x3e4ccccd # 0.2f
|
||||
.word jumptarget
|
||||
|
||||
.text
|
||||
glabel func4
|
||||
lui $at, %hi(rv)
|
||||
jumptarget:
|
||||
jr $ra
|
||||
lwc1 $f0, %lo(rv)($at)
|
||||
jr $ra
|
||||
nop
|
||||
jr $ra
|
||||
nop
|
||||
jr $ra
|
||||
nop
|
||||
jr $ra
|
||||
nop
|
||||
)
|
||||
#else
|
||||
float func4(void) {
|
||||
"func4";
|
||||
return 0.2f;
|
||||
}
|
||||
#endif
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
tests/test2.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 3c010000 03e00008 c4200020 03e00008 <........ . ....
|
||||
0010 00000000 03e00008 00000000 3c010000 ............<...
|
||||
0020 c4240024 e4040000 3c010000 c4260028 .$.$....<....&.(
|
||||
0030 e4060000 03e00008 00000000 03e00008 ................
|
||||
0040 00000000 2c810008 10200017 00000000 ....,.... ......
|
||||
0050 00047080 3c010000 002e0821 8c2e002c ..p.<......!...,
|
||||
0060 01c00008 00000000 03e00008 24020001 ............$...
|
||||
0070 03e00008 24020002 03e00008 24020003 ....$.......$...
|
||||
0080 03e00008 24020004 03e00008 24020005 ....$.......$...
|
||||
0090 03e00008 24020004 03e00008 24020004 ....$.......$...
|
||||
00a0 03e00008 24020004 03e00008 24020003 ....$.......$...
|
||||
00b0 03e00008 00000000 03e00008 00000000 ................
|
||||
00c0 3c010000 03e00008 c4200000 03e00008 <........ ......
|
||||
00d0 00000000 03e00008 00000000 03e00008 ................
|
||||
00e0 00000000 03e00008 00000000 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 01000000 66756e63 31000000 02000000 ....func1.......
|
||||
0010 03000000 66756e63 34000000 000000c4 ....func4.......
|
||||
0020 3dcccccd c0651234 c0651235 00000068 =....e.4.e.5...h
|
||||
0030 00000070 00000078 00000080 00000088 ...p...x........
|
||||
0040 00000090 00000098 000000a0 3e4ccccd ............>L..
|
||||
0050 000000c4 00000000 00000000 00000000 ................
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 80004016 00000000 . ........@.....
|
||||
0010 00000051 00000000 00000000 00007ff0 ...Q............
|
||||
Contents of section .reginfo:
|
||||
0000 80004016 00000000 00000051 00000000 ..@........Q....
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,70 +0,0 @@
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.word 321321
|
||||
.text
|
||||
glabel test
|
||||
/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24
|
||||
/* 000094 00400094 18A00009 */ blez $a1, .L004000BC
|
||||
/* 000098 00400098 AFA00004 */ sw $zero, 4($sp)
|
||||
.L0040009C:
|
||||
/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp)
|
||||
/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6
|
||||
/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7)
|
||||
/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp)
|
||||
/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1
|
||||
/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1
|
||||
/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C
|
||||
/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp)
|
||||
.L004000BC:
|
||||
/* 0000BC 004000BC 10000001 */ b .L004000C4
|
||||
/* 0000C0 004000C0 00000000 */ nop
|
||||
.L004000C4:
|
||||
/* 0000C4 004000C4 03E00008 */ jr $ra
|
||||
/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24
|
||||
)
|
||||
|
||||
// static -> no symbols
|
||||
// bss
|
||||
char globalBuf[4];
|
||||
const char constBuf[4];
|
||||
|
||||
// data
|
||||
char globalBufInit[4] = {1};
|
||||
|
||||
// rodata
|
||||
const char constBufInit[4] = {1};
|
||||
const char constBufInit2[1] = {2};
|
||||
const char constBufInit3[1] = {3};
|
||||
|
||||
unsigned g(void);
|
||||
unsigned f(void) {
|
||||
// aligns to 4 or 8 byte boundary (char -> 4, double -> 8)
|
||||
double x = 5.1;
|
||||
float y = 5.2f;
|
||||
float z = 5.3f;
|
||||
"Hello ";
|
||||
"World";
|
||||
return g();
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.word 123123
|
||||
.text
|
||||
glabel g
|
||||
/* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4
|
||||
/* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100)
|
||||
/* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at)
|
||||
/* 0000D4 004000D4 0C10002C */ jal func_004000B0
|
||||
/* 0000D8 004000D8 00000000 */ nop
|
||||
/* 0000DC 004000DC 10000001 */ b .L004000E4
|
||||
/* 0000E0 004000E0 00000000 */ nop
|
||||
.L004000E4:
|
||||
/* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
/* 0000EC 004000EC 03E00008 */ jr $ra
|
||||
/* 0000F0 004000F0 00000000 */ nop
|
||||
)
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
tests/test3.o: file format elf32-tradbigmips
|
||||
|
||||
Contents of section .text:
|
||||
0000 27bdffe8 18a00009 afa00004 8fae0004 '...............
|
||||
0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'...
|
||||
0020 0325082a 1420fff9 afb90004 10000001 .%.*. ..........
|
||||
0030 00000000 03e00008 27bd0018 27bdffd8 ........'...'...
|
||||
0040 afbf0014 3c010000 d4240028 f7a40020 ....<....$.(...
|
||||
0050 3c010000 c4260030 e7a6001c 3c010000 <....&.0....<...
|
||||
0060 c4280034 e7a80018 0c000000 00000000 .(.4............
|
||||
0070 10000003 00000000 10000001 00000000 ................
|
||||
0080 8fbf0014 27bd0028 03e00008 00000000 ....'..(........
|
||||
0090 27bdffe8 afbf0014 240e0004 3c010000 '.......$...<...
|
||||
00a0 ac2e0000 0c000000 00000000 10000001 ................
|
||||
00b0 00000000 8fbf0014 27bd0018 03e00008 ........'.......
|
||||
00c0 00000000 00000000 00000000 00000000 ................
|
||||
Contents of section .rodata:
|
||||
0000 0004e729 01000000 02000000 03000000 ...)............
|
||||
0010 48656c6c 6f202000 576f726c 64000000 Hello .World...
|
||||
0020 0001e0f3 00000000 40146666 66666666 ........@.ffffff
|
||||
0030 40a66666 40a9999a 00000000 00000000 @.ff@...........
|
||||
Contents of section .data:
|
||||
0000 01000000 00000000 00000000 00000000 ................
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 a0000002 00000000 . ..............
|
||||
0010 00000170 00000000 00000000 00007ff0 ...p............
|
||||
Contents of section .reginfo:
|
||||
0000 a300c032 00000000 00000170 00000000 ...2.......p....
|
||||
0010 00000000 00007ff0 ........
|
||||
Reference in New Issue
Block a user