Skip to content

Commit ae68913

Browse files
authored
Merge pull request #144 from czsgaba/master
Fix compilation error on/for aarch64 (arm64) - 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 ....)
2 parents 27832b2 + d388b04 commit ae68913

File tree

4 files changed

+51
-4
lines changed

4 files changed

+51
-4
lines changed

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Version 1.07.0
33
[changed]
44
- SADD/STRPTR(wstring) returns WSTRING PTR
55
- '-v' be verbose command line option affects '-help' output
6+
- fbc aarch64 target by default maps to '-march=armv8-a' when passing options to gcc/LLVM (czsgaba)
67

78
[added]
89
- CVA_LIST type, CVA_START(), CVA_COPY() CVA_END(), CVA_ARG() macros will map to gcc's __builtin_va_list and __builtin_va_* macros in gcc backend
@@ -46,6 +47,8 @@ Version 1.07.0
4647
- github #116: Fix optimizations in [L/R]TrimAny rtlib functions (SkyFish)
4748
- github #145: WSTRING concat and assign buffer (&=) overrun
4849
- sf.net #893: 'Suffixes are only valid in -lang' error message showing incorrect -lang options allowed
50+
- fbc uses '-march=armv8-a' instead of invalid option '-march=aarch64' when passing options to gcc/LLVM (czsgaba)
51+
- rtlib: sys/io.h incorrectly included on systems that do not provide it. It is used only for x86, x86_64 and is unnecessary for all other linux targets (armhf ,arm64, mips ....)
4952

5053

5154
Version 1.06.0

src/compiler/fb.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ dim shared as FBCPUTYPEINFO cputypeinfo(0 to FB_CPUTYPE__COUNT-1) = _
232232
( NULL , @"x86-64" , FB_CPUFAMILY_X86_64 , 64 ), _ '' FB_CPUTYPE_X86_64
233233
( NULL , @"armv6" , FB_CPUFAMILY_ARM , 32 ), _ '' FB_CPUTYPE_ARMV6
234234
( NULL , @"armv7-a" , FB_CPUFAMILY_ARM , 32 ), _ '' FB_CPUTYPE_ARMV7A
235-
( NULL , @"aarch64" , FB_CPUFAMILY_AARCH64, 64 ) _ '' FB_CPUTYPE_AARCH64
235+
( @"armv8-a" , @"aarch64" , FB_CPUFAMILY_AARCH64, 64 ) _ '' FB_CPUTYPE_AARCH64
236236
}
237237

238238
''::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

src/compiler/fbc.bas

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2961,7 +2961,39 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
29612961
case FB_CPUFAMILY_ARM
29622962
ln += "-march=arm "
29632963
case FB_CPUFAMILY_AARCH64
2964-
ln += "-march=aarch64 "
2964+
'' From the GCC manual:
2965+
'' -march=name
2966+
'' Specify the name of the target architecture and,
2967+
'' optionally, one or more feature modifiers. This option
2968+
'' has the form ‘-march=arch{+[no]feature}*’.
2969+
''
2970+
'' The permissible values for arch are
2971+
'' 'armv8-a'
2972+
'' 'armv8.1-a' = 'armv8-a' + ARMv8.1-A
2973+
'' 'armv8.2-a' = 'armv8.1-a' + ARMv8.2-A
2974+
'' 'armv8.3-a' = 'armv8.2-a' + ARMv8.3-A
2975+
'' 'armv8.4-a' = 'armv8.3-a' + ARMv8.4-A
2976+
'' 'armv8.5-a' = 'armv8.4-a' + ARMv8.5-A
2977+
'' 'native' = architecture of the host system
2978+
''
2979+
'' It enables the '+crc', '+lse', and '+rdma' features.
2980+
''
2981+
'' The value 'native' is available on native AArch64
2982+
'' GNU/Linux and causes the compiler to pick the
2983+
'' architecture of the host system. This option has no
2984+
'' effect if the compiler is unable to recognize the
2985+
'' architecture of the host system, The permissible
2986+
'' values for feature are listed in the sub-section on
2987+
'' ['-march' and '-mcpu' Feature Modifiers]. Where
2988+
'' conflicting feature modifiers are specified, the
2989+
'' right-most feature is used. GCC uses name to determine
2990+
'' what kind of instructions it can emit when generating
2991+
'' assembly code. If '-march' is specified without either
2992+
'' of '-mtune' or '-mcpu' also being specified, the code
2993+
'' is tuned to perform well across a range of target
2994+
'' processors implementing the target architecture.
2995+
2996+
ln += "-march=armv8-a "
29652997
end select
29662998

29672999
if( fbGetOption( FB_COMPOPT_PIC ) ) then

src/rtlib/unix/hinit.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,21 @@
88
#include "../fb_private_thread.h"
99
#include <signal.h>
1010
#include <termcap.h>
11-
#ifdef HOST_LINUX
12-
#include <sys/io.h>
11+
12+
#if defined HOST_LINUX && (defined HOST_X86 || defined HOST_X86_64)
13+
/*
14+
The sys/ headers are architecture and OS dependent. They
15+
do not exist across all targets and io.h in particular
16+
is intended for very low-level non-portable uses often
17+
in coordination with the kernel. The only targets that
18+
provide sys/io.h are x86*, Alpha, IA64, and 32-bit ARM.
19+
No other systems provide it.
20+
From https://bugzilla.redhat.com/show_bug.cgi?id=1116162
21+
or http://www.hep.by/gnu/gnulib/ioperm.html#ioperm
22+
*/
23+
#include <sys/io.h>
1324
#endif
25+
1426
#include <sys/ioctl.h>
1527
#include <fcntl.h>
1628

0 commit comments

Comments
 (0)