Skip to content

Commit efb19c8

Browse files
committed
Disallow -asm for non-x86[_64] targets
(cherry picked from commit edf9c15)
1 parent c565a1a commit efb19c8

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Version 1.02.1
1515
- Windows API binding: DirectX headers missed some declarations and some didn't compile
1616
- crt/string.bi, crt/mem.bi: Added CONSTs to function declarations
1717
- #767: Illegal byref result assignments will now cause a proper error message, not just a warning
18+
- Using the -asm att|intel option for non-x86[_64] targets now triggers an error
1819

1920

2021
Version 1.02.0

src/compiler/error.bas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ declare function hMakeParamDesc _
399399
@"CONST used on destructor (not needed)", _
400400
@"Byref function result not set", _
401401
@"Function result assignment outside of the function", _
402-
@"Type mismatch in byref function result assignment" _
402+
@"Type mismatch in byref function result assignment", _
403+
@"-asm att|intel option given, but not supported for this target (only x86 or x86_64)" _
403404
}
404405

405406

src/compiler/error.bi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ enum FB_ERRMSG
321321
FB_ERRMSG_NOBYREFFUNCTIONRESULT
322322
FB_ERRMSG_RESULTASSIGNOUTSIDEFUNCTION
323323
FB_ERRMSG_TYPEMISMATCHINBYREFRESULTASSIGN
324+
FB_ERRMSG_ASMOPTIONGIVENFORNONX86
324325

325326
FB_ERRMSGS
326327
end enum

src/compiler/fbc.bas

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,13 +2230,21 @@ private sub hParseArgs( byval argc as integer, byval argv as zstring ptr ptr )
22302230
end if
22312231
end select
22322232

2233-
'' -asm overrides the target's default
22342233
if( fbc.asmsyntax >= 0 ) then
2234+
'' -asm only applies to x86 and x86_64
2235+
select case( fbGetCpuFamily( ) )
2236+
case FB_CPUFAMILY_X86, FB_CPUFAMILY_X86_64
2237+
case else
2238+
errReportEx( FB_ERRMSG_ASMOPTIONGIVENFORNONX86, fbGetTargetId( ), -1 )
2239+
end select
2240+
22352241
'' -gen gas only supports -asm intel
22362242
if( (fbGetOption( FB_COMPOPT_BACKEND ) = FB_BACKEND_GAS) and _
22372243
(fbc.asmsyntax <> FB_ASMSYNTAX_INTEL) ) then
22382244
errReportEx( FB_ERRMSG_GENGASWITHOUTINTEL, "", -1 )
22392245
end if
2246+
2247+
'' -asm overrides the target's default
22402248
fbSetOption( FB_COMPOPT_ASMSYNTAX, fbc.asmsyntax )
22412249
end if
22422250

@@ -3231,7 +3239,7 @@ private sub hPrintOptions( )
32313239
print " @<file> Read more command line arguments from a file"
32323240
print " -a <file> Treat file as .o/.a input file"
32333241
print " -arch <type> Set target architecture (default: 486)"
3234-
print " -asm att|intel Set asm format (-gen gcc)"
3242+
print " -asm att|intel Set asm format (-gen gcc|llvm, x86 or x86_64 only)"
32353243
print " -b <file> Treat file as .bas input file"
32363244
print " -c Compile only, do not link"
32373245
print " -C Preserve temporary .o files"

0 commit comments

Comments
 (0)