* [Ada] Cannot process -S -o with GNAT LLVM
@ 2020-11-24 10:17 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-11-24 10:17 UTC (permalink / raw)
To: gcc-patches; +Cc: Arnaud Charlet
[-- Attachment #1: Type: text/plain, Size: 357 bytes --]
This is fixed by recognizing -S in Scan_Compiler_Args and taking it into
account in Set_Output_Object_File_Name.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* opt.ads (Generate_Asm): New flag.
* osint-c.adb (Set_Output_Object_File_Name): Accept any
extension when generating assembly.
* adabkend.adb (Scan_Compiler_Args): Recognize -S.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1413 bytes --]
diff --git a/gcc/ada/adabkend.adb b/gcc/ada/adabkend.adb
--- a/gcc/ada/adabkend.adb
+++ b/gcc/ada/adabkend.adb
@@ -218,6 +218,9 @@ package body Adabkend is
end case;
end if;
+ elsif Switch_Chars (First .. Last) = "S" then
+ Generate_Asm := True;
+
-- Ignore all other back-end switches
elsif Is_Back_End_Switch (Switch_Chars) then
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -719,6 +719,10 @@ package Opt is
-- the name is of the form .xxx, then to name.xxx where name is the source
-- file name with extension stripped.
+ Generate_Asm : Boolean := False;
+ -- GNAT
+ -- True if generating assembly instead of an object file, via the -S switch
+
Generate_C_Code : Boolean := False;
-- GNAT, GNATBIND
-- If True, the Cprint circuitry to generate C code output is activated.
diff --git a/gcc/ada/osint-c.adb b/gcc/ada/osint-c.adb
--- a/gcc/ada/osint-c.adb
+++ b/gcc/ada/osint-c.adb
@@ -480,6 +480,7 @@ package body Osint.C is
or else
(Name (NL - EL + Name'First .. Name'Last) /= Ext
and then Name (NL - 2 + Name'First .. Name'Last) /= ".o"
+ and then not Generate_Asm
and then
(not Generate_C_Code
or else Name (NL - 2 + Name'First .. Name'Last) /= ".c"))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-24 10:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 10:17 [Ada] Cannot process -S -o with GNAT LLVM Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).