You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Remove asm processor
This commit is contained in:
2
tools/asm-processor/.gitignore
vendored
2
tools/asm-processor/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*.o
|
||||
*.py[cod]
|
||||
@@ -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,112 +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 `python3 build.py $CC -- $AS $ASFLAGS -- $CFLAGS -o out.o in.c`, where $CC points to an IDO binary (5.3/7.1 and recomp/qemu all supported), $AS is e.g. `mips-linux-gnu-as`, $ASFLAGS e.g. `-march=vr4300 -mabi=32` and $CFLAGS e.g. `-Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -g`. build.py may be customized as needed.
|
||||
|
||||
In addition to an .o file, build.py also generates a .d file with Makefile dependencies for .s files referenced by the input .c file.
|
||||
This functionality may be removed if not needed.
|
||||
|
||||
Reading assembly from file is also supported, by either `GLOBAL_ASM("file.s")` or `#pragma GLOBAL_ASM("file.s")`.
|
||||
|
||||
### What is supported?
|
||||
|
||||
`.text`, `.data`, `.bss` and `.rodata` sections, `.word`/`.incbin`, `.ascii`/`.asciz`, and `-g`, `-g3`, `-O1`, `-O2`, `-framepointer` and `-mips1`/`-mips2` 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
|
||||
* `-O3` (due to function reordering)
|
||||
|
||||
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 difficult 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.
|
||||
|
||||
Tests need the environment variable `MIPS_CC` set to point to the IDO 7.1 compiler, with Pascal support enabled.
|
||||
|
||||
For example if asm-processor is cloned in the same directory as [ido static recomp](https://github.com/decompals/ido-static-recomp) and the working directory is asm-processor, tests can be run using:
|
||||
|
||||
```sh
|
||||
MIPS_CC=../ido-static-recomp/build/7.1/out/cc ./run-tests.sh
|
||||
```
|
||||
|
||||
Or using [qemu-irix](https://github.com/zeldaret/oot/releases/tag/0.1q) (don't forget `chmod u+x qemu-irix`) to emulate IDO:
|
||||
|
||||
```sh
|
||||
MIPS_CC='./qemu-irix -silent -L ../ido-static-recomp/ido/7.1/ ../ido-static-recomp/ido/7.1/usr/bin/cc' ./run-tests.sh
|
||||
```
|
||||
|
||||
To skip running Pascal tests, remove the `tests/*.p` glob from `run-tests.sh`.
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
for A in "$@"; do
|
||||
OBJDUMPFLAGS="-srt"
|
||||
./compile-test.sh "$A" && mips-linux-gnu-objdump $OBJDUMPFLAGS "${A%.*}.o" > "${A%.*}.objdump"
|
||||
done
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,114 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
import uuid
|
||||
import asm_processor
|
||||
|
||||
# Boolean for debugging purposes
|
||||
# Preprocessed files are temporary, set to True to keep a copy
|
||||
keep_preprocessed_files = False
|
||||
|
||||
dir_path = Path(__file__).resolve().parent
|
||||
asm_prelude_path = dir_path / "prelude.inc"
|
||||
|
||||
all_args = sys.argv[1:]
|
||||
sep0 = next(index for index, arg in enumerate(all_args) if not arg.startswith("-"))
|
||||
sep1 = all_args.index("--")
|
||||
sep2 = all_args.index("--", sep1 + 1)
|
||||
|
||||
asmproc_flags = all_args[:sep0]
|
||||
compiler = all_args[sep0:sep1]
|
||||
|
||||
assembler_args = all_args[sep1 + 1 : sep2]
|
||||
assembler_sh = " ".join(shlex.quote(x) for x in assembler_args)
|
||||
|
||||
|
||||
compile_args = all_args[sep2 + 1 :]
|
||||
|
||||
in_file = Path(compile_args[-1])
|
||||
del compile_args[-1]
|
||||
|
||||
out_ind = compile_args.index("-o")
|
||||
out_file = Path(compile_args[out_ind + 1])
|
||||
del compile_args[out_ind + 1]
|
||||
del compile_args[out_ind]
|
||||
|
||||
|
||||
in_dir = in_file.resolve().parent
|
||||
opt_flags = [
|
||||
x for x in compile_args if x in {"-g3", "-g", "-O0", "-O1", "-O2", "-framepointer", "-KPIC"}
|
||||
]
|
||||
if "-mips2" not in compile_args:
|
||||
opt_flags.append("-mips1")
|
||||
|
||||
asmproc_flags += opt_flags + [str(in_file)]
|
||||
|
||||
# Drop .mdebug and .gptab sections from resulting binaries. This makes
|
||||
# resulting .o files much smaller and speeds up builds, but loses line
|
||||
# number debug data.
|
||||
# asmproc_flags += ["--drop-mdebug-gptab"]
|
||||
|
||||
# Convert encoding before compiling.
|
||||
# asmproc_flags += ["--input-enc", "utf-8", "--output-enc", "euc-jp"]
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="asm_processor") as tmpdirname:
|
||||
tmpdir_path = Path(tmpdirname)
|
||||
preprocessed_filename = "preprocessed_" + uuid.uuid4().hex + in_file.suffix
|
||||
preprocessed_path = tmpdir_path / preprocessed_filename
|
||||
|
||||
with preprocessed_path.open("wb") as f:
|
||||
functions, deps = asm_processor.run(asmproc_flags, outfile=f)
|
||||
|
||||
if keep_preprocessed_files:
|
||||
import shutil
|
||||
|
||||
keep_output_dir = Path("./asm_processor_preprocessed")
|
||||
keep_output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
shutil.copy(
|
||||
preprocessed_path,
|
||||
keep_output_dir / (in_file.stem + "_" + preprocessed_filename),
|
||||
)
|
||||
|
||||
compile_cmdline = (
|
||||
compiler
|
||||
+ compile_args
|
||||
+ ["-I", str(in_dir), "-o", str(out_file), str(preprocessed_path)]
|
||||
)
|
||||
|
||||
try:
|
||||
subprocess.check_call(compile_cmdline)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Failed to compile file " + str(in_file) + ". Command line:")
|
||||
print()
|
||||
print(" ".join(shlex.quote(x) for x in compile_cmdline))
|
||||
print()
|
||||
sys.exit(55)
|
||||
|
||||
asm_processor.run(
|
||||
asmproc_flags
|
||||
+ [
|
||||
"--post-process",
|
||||
str(out_file),
|
||||
"--assembler",
|
||||
assembler_sh,
|
||||
"--asm-prelude",
|
||||
str(asm_prelude_path),
|
||||
],
|
||||
functions=functions,
|
||||
)
|
||||
|
||||
deps_file = out_file.with_suffix(".asmproc.d")
|
||||
if deps:
|
||||
with deps_file.open("w") as f:
|
||||
f.write(str(out_file) + ": " + " \\\n ".join(deps) + "\n")
|
||||
for dep in deps:
|
||||
f.write("\n" + dep + ":\n")
|
||||
else:
|
||||
try:
|
||||
deps_file.unlink()
|
||||
except OSError:
|
||||
pass
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -o pipefail
|
||||
INPUT="$1"
|
||||
OUTPUT="${INPUT%.*}.o"
|
||||
|
||||
rm -f "$OUTPUT"
|
||||
|
||||
CC="$MIPS_CC" # ido 7.1 via recomp or qemu-irix
|
||||
AS="mips-linux-gnu-as"
|
||||
ASFLAGS="-march=vr4300 -mabi=32"
|
||||
OPTFLAGS=$(grep 'COMPILE-FLAGS: ' $INPUT | sed 's#^.*COMPILE-FLAGS: ##' | sed 's#}$##')
|
||||
ASMPFLAGS=$(grep 'ASMP-FLAGS: ' $INPUT | sed 's#^.*ASMP-FLAGS: ##' | sed 's#}$##')
|
||||
ISET=$(grep 'COMPILE-ISET: ' $INPUT | sed 's#^.*COMPILE-ISET: ##' | sed 's#}$##')
|
||||
if [[ -z "$OPTFLAGS" ]]; then
|
||||
OPTFLAGS="-g"
|
||||
fi
|
||||
CFLAGS="-Wab,-r4300_mul -G 0 -Xcpluscomm -fullwarn -wlint -woff 819,820,852,821 -signed -c"
|
||||
if [[ -z "$ISET" ]]; then
|
||||
CFLAGS="$CFLAGS -mips2"
|
||||
fi
|
||||
if [[ "$OPTFLAGS" != *-KPIC* ]]; then
|
||||
CFLAGS="$CFLAGS -non_shared"
|
||||
fi
|
||||
|
||||
set -e
|
||||
python3 build.py --drop-mdebug-gptab $ASMPFLAGS $CC -- $AS $ASFLAGS -- $CFLAGS $OPTFLAGS $ISET -o "$OUTPUT" "$INPUT"
|
||||
@@ -1,43 +0,0 @@
|
||||
.set noat
|
||||
.set noreorder
|
||||
.set gp=64
|
||||
.macro glabel label
|
||||
.global \label
|
||||
\label:
|
||||
.endm
|
||||
|
||||
|
||||
# Float register aliases (o32 ABI, odd ones are rarely used)
|
||||
|
||||
.set $fv0, $f0
|
||||
.set $fv0f, $f1
|
||||
.set $fv1, $f2
|
||||
.set $fv1f, $f3
|
||||
.set $ft0, $f4
|
||||
.set $ft0f, $f5
|
||||
.set $ft1, $f6
|
||||
.set $ft1f, $f7
|
||||
.set $ft2, $f8
|
||||
.set $ft2f, $f9
|
||||
.set $ft3, $f10
|
||||
.set $ft3f, $f11
|
||||
.set $fa0, $f12
|
||||
.set $fa0f, $f13
|
||||
.set $fa1, $f14
|
||||
.set $fa1f, $f15
|
||||
.set $ft4, $f16
|
||||
.set $ft4f, $f17
|
||||
.set $ft5, $f18
|
||||
.set $ft5f, $f19
|
||||
.set $fs0, $f20
|
||||
.set $fs0f, $f21
|
||||
.set $fs1, $f22
|
||||
.set $fs1f, $f23
|
||||
.set $fs2, $f24
|
||||
.set $fs2f, $f25
|
||||
.set $fs3, $f26
|
||||
.set $fs3f, $f27
|
||||
.set $fs4, $f28
|
||||
.set $fs4f, $f29
|
||||
.set $fs5, $f30
|
||||
.set $fs5f, $f31
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
for A in tests/*.c tests/*.p; do
|
||||
OBJDUMPFLAGS=-srt
|
||||
echo $A
|
||||
./compile-test.sh "$A" && mips-linux-gnu-objdump $OBJDUMPFLAGS "${A%.*}.o" | diff - "${A%.*}.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,29 +0,0 @@
|
||||
|
||||
tests/ascii.o: file format elf32-tradbigmips
|
||||
|
||||
SYMBOL TABLE:
|
||||
00000000 l d .text 00000030 .text
|
||||
00000000 l d .rodata 00000050 .rodata
|
||||
00000000 g F .text 00000010 foo
|
||||
00000010 g F .text 00000010 bar
|
||||
00000020 g F .text 00000010 baz
|
||||
|
||||
|
||||
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 ................
|
||||
0020 07100000 00000000 00000000 00000000 ................
|
||||
0030 08100000 00000000 00000000 00000000 ................
|
||||
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,21 +0,0 @@
|
||||
|
||||
tests/comments.o: file format elf32-tradbigmips
|
||||
|
||||
SYMBOL TABLE:
|
||||
00000000 l d .rodata 00000030 .rodata
|
||||
00000000 g O .rodata 00000002 before
|
||||
00000024 g O .rodata 00000002 after
|
||||
|
||||
|
||||
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 ................
|
||||
0020 07100000 00000000 00000000 00000000 ................
|
||||
0030 08100000 00000000 00000000 00000000 ................
|
||||
Contents of section .reginfo:
|
||||
0000 00000000 00000000 00000000 00000000 ................
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,17 +0,0 @@
|
||||
// COMPILE-FLAGS: -O2
|
||||
// ASMP-FLAGS: --convert-statics=global-with-filename --force
|
||||
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;
|
||||
|
||||
static int xtext(int a, int b, int c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void baz(void) {
|
||||
xtext(bss2, rodata2[0], data2[0]);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
|
||||
tests/force.o: file format elf32-tradbigmips
|
||||
|
||||
SYMBOL TABLE:
|
||||
00000000 l d .text 00000050 .text
|
||||
00000000 l d .rodata 00000010 .rodata
|
||||
00000000 l d .data 00000010 .data
|
||||
00000000 l d .bss 00000010 .bss
|
||||
00000000 g O .rodata 00000004 rodata1
|
||||
00000000 g O .data 00000004 data1
|
||||
00000000 g O .bss 00000004 bss1
|
||||
00000014 g F .text 00000034 baz
|
||||
00000004 g O .rodata 00000000 tests/force.o:rodata2
|
||||
00000004 g O .data 00000000 tests/force.o:data2
|
||||
00000004 g O .bss 00000000 tests/force.o:bss2
|
||||
00000000 g F .text 00000000 tests/force.o:xtext
|
||||
|
||||
|
||||
RELOCATION RECORDS FOR [.text]:
|
||||
OFFSET TYPE VALUE
|
||||
0000001c R_MIPS_HI16 .bss
|
||||
00000034 R_MIPS_LO16 .bss
|
||||
00000020 R_MIPS_HI16 .rodata
|
||||
0000002c R_MIPS_LO16 .rodata
|
||||
00000024 R_MIPS_HI16 .data
|
||||
00000028 R_MIPS_LO16 .data
|
||||
00000030 R_MIPS_26 .text
|
||||
|
||||
|
||||
Contents of section .text:
|
||||
0000 afa40000 afa50004 afa60008 03e00008 ................
|
||||
0010 24020001 27bdffe8 afbf0014 3c040000 $...'.......<...
|
||||
0020 3c050000 3c060000 8cc60004 8ca50004 <...<...........
|
||||
0030 0c000000 8c840004 8fbf0014 27bd0018 ............'...
|
||||
0040 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 ................
|
||||
0020 07100000 00000000 00000000 00000000 ................
|
||||
0030 08100000 00000000 00000000 00000000 ................
|
||||
Contents of section .reginfo:
|
||||
0000 a0000074 00000000 00000000 00000000 ...t............
|
||||
0010 00000000 00007ff0 ........
|
||||
@@ -1,93 +0,0 @@
|
||||
// COMPILE-FLAGS: -O1 -KPIC
|
||||
GLOBAL_ASM(
|
||||
glabel foo
|
||||
addiu $a0, $a0, 1
|
||||
addiu $a0, $a0, 2
|
||||
addiu $a0, $a0, 3
|
||||
addiu $a0, $a0, 4
|
||||
addiu $a0, $a0, 5
|
||||
addiu $a0, $a0, 6
|
||||
addiu $a0, $a0, 7
|
||||
addiu $a0, $a0, 8
|
||||
addiu $a0, $a0, 9
|
||||
addiu $a0, $a0, 10
|
||||
addiu $a0, $a0, 11
|
||||
addiu $a0, $a0, 12
|
||||
)
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 1
|
||||
.text
|
||||
glabel float_fn
|
||||
addiu $a0, $a0, 13
|
||||
addiu $a0, $a0, 14
|
||||
addiu $a0, $a0, 15
|
||||
addiu $a0, $a0, 16
|
||||
addiu $a0, $a0, 17
|
||||
addiu $a0, $a0, 18
|
||||
addiu $a0, $a0, 19
|
||||
addiu $a0, $a0, 20
|
||||
addiu $a0, $a0, 21
|
||||
addiu $a0, $a0, 22
|
||||
addiu $a0, $a0, 23
|
||||
addiu $a0, $a0, 24
|
||||
addiu $a0, $a0, 25
|
||||
addiu $a0, $a0, 26
|
||||
addiu $a0, $a0, 27
|
||||
addiu $a0, $a0, 28
|
||||
addiu $a0, $a0, 29
|
||||
addiu $a0, $a0, 30
|
||||
)
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.late_rodata_alignment 4
|
||||
.float 2
|
||||
.double 1
|
||||
.double 2
|
||||
.double 3
|
||||
.double 4
|
||||
.double 5
|
||||
.double 6
|
||||
.double 7
|
||||
.double 8
|
||||
.text
|
||||
glabel doubles
|
||||
addiu $a0, $a0, 31
|
||||
addiu $a0, $a0, 32
|
||||
addiu $a0, $a0, 33
|
||||
addiu $a0, $a0, 34
|
||||
addiu $a0, $a0, 35
|
||||
addiu $a0, $a0, 36
|
||||
addiu $a0, $a0, 37
|
||||
addiu $a0, $a0, 38
|
||||
addiu $a0, $a0, 39
|
||||
addiu $a0, $a0, 40
|
||||
addiu $a0, $a0, 41
|
||||
addiu $a0, $a0, 42
|
||||
addiu $a0, $a0, 43
|
||||
addiu $a0, $a0, 44
|
||||
addiu $a0, $a0, 45
|
||||
addiu $a0, $a0, 46
|
||||
addiu $a0, $a0, 47
|
||||
addiu $a0, $a0, 48
|
||||
addiu $a0, $a0, 49
|
||||
addiu $a0, $a0, 50
|
||||
addiu $a0, $a0, 51
|
||||
addiu $a0, $a0, 52
|
||||
addiu $a0, $a0, 53
|
||||
addiu $a0, $a0, 54
|
||||
addiu $a0, $a0, 55
|
||||
addiu $a0, $a0, 56
|
||||
addiu $a0, $a0, 57
|
||||
addiu $a0, $a0, 58
|
||||
addiu $a0, $a0, 59
|
||||
addiu $a0, $a0, 60
|
||||
addiu $a0, $a0, 61
|
||||
addiu $a0, $a0, 62
|
||||
addiu $a0, $a0, 63
|
||||
addiu $a0, $a0, 64
|
||||
addiu $a0, $a0, 65
|
||||
addiu $a0, $a0, 66
|
||||
addiu $a0, $a0, 67
|
||||
addiu $a0, $a0, 68
|
||||
)
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
tests/kpic-o1.o: file format elf32-tradbigmips
|
||||
|
||||
SYMBOL TABLE:
|
||||
00000000 l d .text 00000110 .text
|
||||
00000000 l d .rodata 00000050 .rodata
|
||||
00000000 g F .text 00000030 foo
|
||||
00000030 g F .text 00000048 float_fn
|
||||
00000078 g F .text 00000098 doubles
|
||||
00000000 O *UND* 00000000 _gp_disp
|
||||
|
||||
|
||||
RELOCATION RECORDS FOR [.text]: (none)
|
||||
|
||||
Contents of section .text:
|
||||
0000 24840001 24840002 24840003 24840004 $...$...$...$...
|
||||
0010 24840005 24840006 24840007 24840008 $...$...$...$...
|
||||
0020 24840009 2484000a 2484000b 2484000c $...$...$...$...
|
||||
0030 2484000d 2484000e 2484000f 24840010 $...$...$...$...
|
||||
0040 24840011 24840012 24840013 24840014 $...$...$...$...
|
||||
0050 24840015 24840016 24840017 24840018 $...$...$...$...
|
||||
0060 24840019 2484001a 2484001b 2484001c $...$...$...$...
|
||||
0070 2484001d 2484001e 2484001f 24840020 $...$...$...$..
|
||||
0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$
|
||||
0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..(
|
||||
00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$..,
|
||||
00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0
|
||||
00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4
|
||||
00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8
|
||||
00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..<
|
||||
00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@
|
||||
0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D
|
||||
Contents of section .rodata:
|
||||
0000 3f800000 40000000 3ff00000 00000000 ?...@...?.......
|
||||
0010 40000000 00000000 40080000 00000000 @.......@.......
|
||||
0020 40100000 00000000 40140000 00000000 @.......@.......
|
||||
0030 40180000 00000000 401c0000 00000000 @.......@.......
|
||||
0040 40200000 00000000 00000000 00000000 @ ..............
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 92000002 00000000 . ..............
|
||||
0010 000f0ff0 00000000 00000000 00000000 ................
|
||||
0020 07100000 00000000 00000000 00000000 ................
|
||||
0030 08100000 00000000 00000000 00000000 ................
|
||||
Contents of section .reginfo:
|
||||
0000 92000012 00000000 000f0ff0 00000000 ................
|
||||
0010 00000000 00000000 ........
|
||||
@@ -1,92 +0,0 @@
|
||||
// COMPILE-FLAGS: -O2 -KPIC
|
||||
GLOBAL_ASM(
|
||||
glabel foo
|
||||
addiu $a0, $a0, 1
|
||||
addiu $a0, $a0, 2
|
||||
addiu $a0, $a0, 3
|
||||
addiu $a0, $a0, 4
|
||||
addiu $a0, $a0, 5
|
||||
addiu $a0, $a0, 6
|
||||
addiu $a0, $a0, 7
|
||||
addiu $a0, $a0, 8
|
||||
addiu $a0, $a0, 9
|
||||
addiu $a0, $a0, 10
|
||||
addiu $a0, $a0, 11
|
||||
addiu $a0, $a0, 12
|
||||
)
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 1
|
||||
.text
|
||||
glabel float_fn
|
||||
addiu $a0, $a0, 13
|
||||
addiu $a0, $a0, 14
|
||||
addiu $a0, $a0, 15
|
||||
addiu $a0, $a0, 16
|
||||
addiu $a0, $a0, 17
|
||||
addiu $a0, $a0, 18
|
||||
addiu $a0, $a0, 19
|
||||
addiu $a0, $a0, 20
|
||||
addiu $a0, $a0, 21
|
||||
addiu $a0, $a0, 22
|
||||
addiu $a0, $a0, 23
|
||||
addiu $a0, $a0, 24
|
||||
addiu $a0, $a0, 25
|
||||
addiu $a0, $a0, 26
|
||||
addiu $a0, $a0, 27
|
||||
addiu $a0, $a0, 28
|
||||
addiu $a0, $a0, 29
|
||||
addiu $a0, $a0, 30
|
||||
)
|
||||
GLOBAL_ASM(
|
||||
.late_rodata
|
||||
.float 2
|
||||
.double 1
|
||||
.double 2
|
||||
.double 3
|
||||
.double 4
|
||||
.double 5
|
||||
.double 6
|
||||
.double 7
|
||||
.double 8
|
||||
.text
|
||||
glabel doubles
|
||||
addiu $a0, $a0, 31
|
||||
addiu $a0, $a0, 32
|
||||
addiu $a0, $a0, 33
|
||||
addiu $a0, $a0, 34
|
||||
addiu $a0, $a0, 35
|
||||
addiu $a0, $a0, 36
|
||||
addiu $a0, $a0, 37
|
||||
addiu $a0, $a0, 38
|
||||
addiu $a0, $a0, 39
|
||||
addiu $a0, $a0, 40
|
||||
addiu $a0, $a0, 41
|
||||
addiu $a0, $a0, 42
|
||||
addiu $a0, $a0, 43
|
||||
addiu $a0, $a0, 44
|
||||
addiu $a0, $a0, 45
|
||||
addiu $a0, $a0, 46
|
||||
addiu $a0, $a0, 47
|
||||
addiu $a0, $a0, 48
|
||||
addiu $a0, $a0, 49
|
||||
addiu $a0, $a0, 50
|
||||
addiu $a0, $a0, 51
|
||||
addiu $a0, $a0, 52
|
||||
addiu $a0, $a0, 53
|
||||
addiu $a0, $a0, 54
|
||||
addiu $a0, $a0, 55
|
||||
addiu $a0, $a0, 56
|
||||
addiu $a0, $a0, 57
|
||||
addiu $a0, $a0, 58
|
||||
addiu $a0, $a0, 59
|
||||
addiu $a0, $a0, 60
|
||||
addiu $a0, $a0, 61
|
||||
addiu $a0, $a0, 62
|
||||
addiu $a0, $a0, 63
|
||||
addiu $a0, $a0, 64
|
||||
addiu $a0, $a0, 65
|
||||
addiu $a0, $a0, 66
|
||||
addiu $a0, $a0, 67
|
||||
addiu $a0, $a0, 68
|
||||
)
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
tests/kpic-o2.o: file format elf32-tradbigmips
|
||||
|
||||
SYMBOL TABLE:
|
||||
00000000 l d .text 00000110 .text
|
||||
00000000 l d .rodata 00000050 .rodata
|
||||
00000000 g F .text 00000030 foo
|
||||
00000030 g F .text 00000048 float_fn
|
||||
00000078 g F .text 00000098 doubles
|
||||
00000000 O *UND* 00000000 _gp_disp
|
||||
|
||||
|
||||
RELOCATION RECORDS FOR [.text]: (none)
|
||||
|
||||
Contents of section .text:
|
||||
0000 24840001 24840002 24840003 24840004 $...$...$...$...
|
||||
0010 24840005 24840006 24840007 24840008 $...$...$...$...
|
||||
0020 24840009 2484000a 2484000b 2484000c $...$...$...$...
|
||||
0030 2484000d 2484000e 2484000f 24840010 $...$...$...$...
|
||||
0040 24840011 24840012 24840013 24840014 $...$...$...$...
|
||||
0050 24840015 24840016 24840017 24840018 $...$...$...$...
|
||||
0060 24840019 2484001a 2484001b 2484001c $...$...$...$...
|
||||
0070 2484001d 2484001e 2484001f 24840020 $...$...$...$..
|
||||
0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$
|
||||
0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..(
|
||||
00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$..,
|
||||
00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0
|
||||
00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4
|
||||
00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8
|
||||
00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..<
|
||||
00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@
|
||||
0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D
|
||||
Contents of section .rodata:
|
||||
0000 3f800000 40000000 3ff00000 00000000 ?...@...?.......
|
||||
0010 40000000 00000000 40080000 00000000 @.......@.......
|
||||
0020 40100000 00000000 40140000 00000000 @.......@.......
|
||||
0030 40180000 00000000 401c0000 00000000 @.......@.......
|
||||
0040 40200000 00000000 00000000 00000000 @ ..............
|
||||
Contents of section .options:
|
||||
0000 01200000 00000000 92000002 00000000 . ..............
|
||||
0010 000f0ff0 00000000 00000000 00000000 ................
|
||||
0020 07100000 00000000 00000000 00000000 ................
|
||||
0030 08100000 00000000 00000000 00000000 ................
|
||||
Contents of section .reginfo:
|
||||
0000 92000012 00000000 000f0ff0 00000000 ................
|
||||
0010 00000000 00000000 ........
|
||||
@@ -1,7 +0,0 @@
|
||||
GLOBAL_ASM(
|
||||
.rdata
|
||||
.word 0x12345678
|
||||
glabel blah
|
||||
.word blah2
|
||||
/*a*/ blah2: /*b*/ .word blah /*c*/
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user