aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-08-24 20:25:53 +0200
committerTristan Gingold <tgingold@free.fr>2021-08-24 20:26:23 +0200
commita5ff9b623532ef2a15ca0a6ba315f2f463142490 (patch)
tree6c5b293c997089557e01f22aaab401ddc584c336
parent165a59c9fea5168954488dff1622388ef72a22ca (diff)
downloadghdl-a5ff9b623532ef2a15ca0a6ba315f2f463142490.tar.gz
ghdl-a5ff9b623532ef2a15ca0a6ba315f2f463142490.tar.bz2
ghdl-a5ff9b623532ef2a15ca0a6ba315f2f463142490.zip
ghdldrv: handle auxbase option in ortho/gcc. Fix #1845
Remove additional option in ghdldrv.adb, automatically set aux_base_name in ortho-lang-9.c
-rw-r--r--src/ghdldrv/ghdldrv.adb10
-rw-r--r--src/ortho/gcc/ortho-lang-9.c16
2 files changed, 16 insertions, 10 deletions
diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index acd125765..6b49a8df2 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -54,9 +54,6 @@ package body Ghdldrv is
-- "-quiet" option.
Dash_Quiet : constant String_Access := new String'("-quiet");
- -- "-auxbase" option.
- Dash_Auxbase : constant String_Access := new String'("-auxbase");
-
-- "-fpic" option.
Dash_Fpic : constant String_Access := new String'("-fpic");
@@ -173,7 +170,6 @@ package body Ghdldrv is
is
Obj_File : String_Access;
Asm_File : String_Access;
- Aux_File : String_Access;
Post_File : String_Access;
-- Add backend specific options.
@@ -199,10 +195,6 @@ package body Ghdldrv is
P := P + 1;
Args (P) := Dash_Quiet;
end if;
- P := P + 1;
- Args (P) := Dash_Auxbase;
- P := P + 1;
- Args (P) := Aux_File;
when Backend_Llvm =>
P := P + 1;
Args (P) := Dash_c;
@@ -231,7 +223,6 @@ package body Ghdldrv is
case Backend is
when Backend_Gcc =>
Asm_File := Append_Suffix (File, Asm_Suffix, In_Work);
- Aux_File := new String'(Get_Base_Name (File));
when Backend_Llvm
| Backend_Mcode =>
null;
@@ -335,7 +326,6 @@ package body Ghdldrv is
Free (Asm_File);
Free (Obj_File);
- Free (Aux_File);
end Do_Compile;
-- Table of files to be linked.
diff --git a/src/ortho/gcc/ortho-lang-9.c b/src/ortho/gcc/ortho-lang-9.c
index b7dfab4f3..4059e5ac3 100644
--- a/src/ortho/gcc/ortho-lang-9.c
+++ b/src/ortho/gcc/ortho-lang-9.c
@@ -407,6 +407,22 @@ ortho_post_options (const char **pfilename)
{
if (*pfilename == NULL || strcmp (*pfilename, "-") == 0)
*pfilename = "*stdin*";
+ else if (aux_base_name == NULL)
+ {
+ /* Define auxbase. The default mechanism in toplev.c doesn't
+ handle extensions longer than 3 characters. */
+ char *name = xstrdup (lbasename (main_input_filename));
+ int len;
+
+ /* Remove extension. */
+ for (len = strlen (name) - 1; len > 1; len--)
+ if (name[len] == '.')
+ {
+ name[len] = 0;
+ break;
+ }
+ aux_base_name = name;
+ }
/* Default hook. */
lhd_post_options (pfilename);