-
Notifications
You must be signed in to change notification settings - Fork 155
Fix compilation error on/for aarch64 (arm64) #144
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
Conversation
|
arm8-a is the first ARM version to introduce the AArch64 instruction set, so that's correct. BUT arm8-a does not imply 64 bit, while aarch64 does. Both gcc and llvm backends apparently rely on the Also, this patch changes only -march flag passed to llvm, not gcc. The latter is in cputypeinfo() in fb.bas. |
|
Well I was a little hasty in saying this patch is wrong, because passing |
|
OK I was too hurry with the patch. -march flag passed to GCC must be repaired too. But something must be done with it becouse -march=aarch64 is wrong and doesn't work. |
|
New commit looks good. |
|
Agreed, the gcc option in fb.bas (the entry in the cputypeinfo table) needs to be updated too. Using |
|
Ok i am happy that second commit looks good. I did some tests with default settings of GCC on different platforms. so -march= flag is not set by default on arm64. then I tried: -mabi=lp64 The default depends on the specific target configuration. Note that the LP64 and ILP32 ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries. https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/AArch64-Options.html#AArch64-Options |
|
You should pass To replace existing commits in a github pull request, do a forced push to the branch on github that you're requesting a pull from. E.g. |
|
@czsgaba, is this ready to merge? As @rversteegen mentioned, if you want to replace your commits for this pull request, you must make the changes on your local branch, and then force push your branch; it will overwrite the commits. I'm not in any position to test this; so I will simply trust you that it is ready to merge in. As @dkl pointed out, this change is OK for now, but needs more work down the road. |
|
Sorry but had too much work to rebuild (reconstruct) my house. So I think thet this is ready to merge. Becouse it solves the problem with compiling fbc on aarch64 (#include <sys/io.h>). |
…options to gcc/LLVM - aarch64 is not a permissible value for -march passed to gcc/LLVM - fbc will accept aarch64, then map to '-march=armv8-a' when calling the backend - comments in fbc.bas:hCompileStage2Module() listing permissible values
- fix rtlib compilation error on/for aarch64 (arm64) or other platforms - use of sys/io.h is only to call ioperm(), and determine permission for direct use out in/out instructions - sys/io.h is used only for x86, x86_64 and is unnecessary for all other linux targets (armhf ,arm64, mips ....)
|
@czsgaba, I have cleaned up this pull request.
My apologies for the force push on your master. I was really curious to see if github would actually allow it, and it did. If you have continued work on your local repo master branch, take care to create another branch name for it before force pulling from your github repo. My opinion is to always create an alternate branch for development and publish that one for pull requests. Additional aarch64 options to be solved some other time. |
aarch64 is not a permissible value for -march
From the GCC manual:
-march=name
Specify the name of the target architecture and, optionally, one or more feature
modifiers. This option has the form ‘-march=arch{+[no]feature}*’.
The permissible values for arch are ‘armv8-a’, ‘armv8.1-a’, ‘armv8.2-a’,
‘armv8.3-a’, ‘armv8.4-a’, ‘armv8.5-a’ or native.
The value ‘armv8.5-a’ implies ‘armv8.4-a’ and enables compiler support for
the ARMv8.5-A architecture extensions.
The value ‘armv8.4-a’ implies ‘armv8.3-a’ and enables compiler support for
the ARMv8.4-A architecture extensions.
The value ‘armv8.3-a’ implies ‘armv8.2-a’ and enables compiler support for
the ARMv8.3-A architecture extensions.
The value ‘armv8.2-a’ implies ‘armv8.1-a’ and enables compiler support for
the ARMv8.2-A architecture extensions.
The value ‘armv8.1-a’ implies ‘armv8-a’ and enables compiler support for the
ARMv8.1-A architecture extension. In particular, it enables the ‘+crc’, ‘+lse’,
and ‘+rdma’ features.
The value ‘native’ is available on native AArch64 GNU/Linux and causes the
compiler to pick the architecture of the host system. This option has no effect
if the compiler is unable to recognize the architecture of the host system,
The permissible values for feature are listed in the sub-section on [‘-march’ and
‘-mcpu’ Feature Modifiers], page 250. Where conflicting feature modifiers are
specified, the right-most feature is used.
GCC uses name to determine what kind of instructions it can emit when generating assembly code. If ‘-march’ is specified without either of ‘-mtune’ or
‘-mcpu’ also being specified, the code is tuned to perform well across a range of
target processors implementing the target architecture.