-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial armv7 support. #162
base: v0_master
Are you sure you want to change the base?
Conversation
Sooo. I essentially copied over the Aarch64 files, added the appropriate machine dependant files and renamed "a couple of structs". Next I ran `gcc -dM -E - < /dev/null` and copied that into `c2mir/armv7/mirc_armv7_linux.h`. I built and ran but I received an error. It did not segfault. I am using a different build tool called xmake, the build file is stashed in my russellhaley/mircVM project.
This is the current message:
Stackoverflow implies this is a 64/32 bit issue: I'll dig again tomorrow or Monday. Cheers! |
Good job |
Went through and aligned the existing defines in the Aarch64 file with the output from gcc on an armv7 board (beaglebone black: https://beagleboard.org/black and https://www.ti.com/product/AM3358).
Followed warnings in gcc and changed int64_t to intptr_t, and uint64_t to uintptr_t.
@@ -5206,7 +5206,7 @@ static void print_code (gen_ctx_t gen_ctx, uint8_t *code, size_t code_len, void | |||
"gcc -c -o %s.o %s 2>&1 && objcopy --update-section .text=%s %s.o && objdump " | |||
"--adjust-vma=0x%llx -d %s.o; rm -f " | |||
"%s.o %s %s", | |||
cfname, cfname, bfname, cfname, (unsigned long long) start_addr, cfname, cfname, cfname, | |||
cfname, cfname, bfname, cfname, (uintptr_t) start_addr, cfname, cfname, cfname, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change causes the following warning on Ubuntu 20 64 bit VM:
osboxes@osboxes ~/g/m/mir ((299fa499…))> make -j 10
gcc -I. -MMD -MP -g -std=gnu11 -Wno-abi -fsigned-char -fno-tree-sra -fno-ipa-cp-clone -O3 -DNDEBUG -DMIR_PARALLEL_GEN -c mir.c -o mir.o
gcc -I. -MMD -MP -g -std=gnu11 -Wno-abi -fsigned-char -fno-tree-sra -fno-ipa-cp-clone -O3 -DNDEBUG -DMIR_PARALLEL_GEN -c mir-gen.c -o mir-gen.o
gcc -I. -MMD -MP -g -std=gnu11 -Wno-abi -fsigned-char -fno-tree-sra -fno-ipa-cp-clone -O3 -DNDEBUG -DMIR_PARALLEL_GEN -c c2mir/c2mir.c -o c2mir/c2mir.o
gcc -I. -MMD -MP -g -std=gnu11 -Wno-abi -fsigned-char -fno-tree-sra -fno-ipa-cp-clone -O3 -DNDEBUG -DMIR_PARALLEL_GEN -c c2mir/c2mir-driver.c -o c2mir/c2mir-driver.o
gcc -I. -MMD -MP -g -std=gnu11 -Wno-abi -fsigned-char -fno-tree-sra -fno-ipa-cp-clone -O3 -DNDEBUG -DMIR_PARALLEL_GEN -c mir-utils/m2b.c -o mir-utils/m2b.o
gcc -I. -MMD -MP -g -std=gnu11 -Wno-abi -fsigned-char -fno-tree-sra -fno-ipa-cp-clone -O3 -DNDEBUG -DMIR_PARALLEL_GEN -c mir-utils/b2m.c -o mir-utils/b2m.o
gcc -I. -MMD -MP -g -std=gnu11 -Wno-abi -fsigned-char -fno-tree-sra -fno-ipa-cp-clone -O3 -DNDEBUG -DMIR_PARALLEL_GEN -c mir-utils/b2ctab.c -o mir-utils/b2ctab.o
mir-gen.c: In function ‘print_code’:
mir-gen.c:5206:12: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 7 has type ‘long unsigned int’ [-Wformat=]
5206 | "gcc -c -o %s.o %s 2>&1 && objcopy --update-section .text=%s %s.o && objdump "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
5209 | cfname, cfname, bfname, cfname, (uintptr_t) start_addr, cfname, cfname, cfname,
| ~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
mir-gen.c:5207:31: note: format string is defined here
5207 | "--adjust-vma=0x%llx -d %s.o; rm -f "
| ~~~^
| |
| long long unsigned int
| %lx
mir-gen.c: In function ‘MIR_gen’:
mir-gen.c:5389:14: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=]
5389 | "Generation of code for %s: %lu MIR insns (addr=%llx, len=%lu) -- time %.2f ms\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
5392 | (uintptr_t) machine_code, (unsigned long) code_len,
| ~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
mir-gen.c:109:29: note: in definition of macro ‘DEBUG’
109 | if (debug_file != NULL) code; \
| ^~~~
mir-gen.c:5389:65: note: format string is defined here
5389 | "Generation of code for %s: %lu MIR insns (addr=%llx, len=%lu) -- time %.2f ms\n",
| ~~~^
| |
| long long unsigned int
| %lx
ar rcs libmir.a mir.o mir-gen.o c2mir/c2mir.o
gcc c2mir/c2mir.o c2mir/c2mir-driver.o libmir.a -lm -ldl -lpthread -o c2m
gcc mir-utils/m2b.o libmir.a -lm -ldl -lpthread -o m2b ./libmir.a
gcc mir-utils/b2m.o libmir.a -lm -ldl -lpthread -o b2m ./libmir.a
gcc mir-utils/b2ctab.o libmir.a -lm -ldl -lpthread -o b2ctab ./libmir.a
@@ -5389,7 +5389,7 @@ void *MIR_gen (MIR_context_t ctx, int gen_num, MIR_item_t func_item) { | |||
"Generation of code for %s: %lu MIR insns (addr=%llx, len=%lu) -- time %.2f ms\n", | |||
MIR_item_name (ctx, func_item), | |||
(long unsigned) DLIST_LENGTH (MIR_insn_t, func_item->u.func->insns), | |||
(unsigned long long) machine_code, (unsigned long) code_len, | |||
(uintptr_t) machine_code, (unsigned long) code_len, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change causes a warning on 64 bit Ubuntu 20. (see comment above)
A surprising number of the tests that build with cmake run correctly. Anyway, I'll leave it at that until you can come up for air. Fun stuff! |
This pull request is just to get comments.
Sooo. I essentially copied over the Aarch64 files, added the appropriate machine dependant files and renamed "a couple of structs".
Next I ran
gcc -dM -E - < /dev/null
and copied that intoc2mir/armv7/mirc_armv7_linux.h
. I built and ran but I received an error. It did not segfault.I am using a different build tool called xmake, the build file is stashed in my russellhaley/mircVM project.
Output: