* [PATCH] More rustspec.cc cleanups
@ 2021-08-05 23:34 Mark Wielaard
2021-08-06 14:58 ` Philip Herron
0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2021-08-05 23:34 UTC (permalink / raw)
To: gcc-rust; +Cc: Mark Wielaard
rustspec.cc was based on the Go frontend gospec.cc. Remove special
handling of math and pthread libraries and profiling option. Handle
.rs files instead of .go files. Keep support for linking with (static)
librust which is currently commented out. Add generic static-librust
option to common.opt.
---
gcc/common.opt | 4 ++
gcc/rust/config-lang.in | 2 +-
gcc/rust/rustspec.cc | 146 ++++++++--------------------------------
3 files changed, 32 insertions(+), 120 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index c75dd36843e..820de1f41b0 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3449,6 +3449,10 @@ static-libgo
Driver
; Documented for Go, but always accepted by driver.
+static-librust
+Driver
+; Documented for Rust, but always accepted by driver.
+
static-libasan
Driver
diff --git a/gcc/rust/config-lang.in b/gcc/rust/config-lang.in
index c50b72153c2..1d61d2afc6b 100644
--- a/gcc/rust/config-lang.in
+++ b/gcc/rust/config-lang.in
@@ -1,4 +1,4 @@
-# config-lang.in -- Top level configure fragment for gcc Go frontend.
+# config-lang.in -- Top level configure fragment for gcc Rust frontend.
# Copyright (C) 2009-2019 Free Software Foundation, Inc.
diff --git a/gcc/rust/rustspec.cc b/gcc/rust/rustspec.cc
index 12ec874d222..806514a9d94 100644
--- a/gcc/rust/rustspec.cc
+++ b/gcc/rust/rustspec.cc
@@ -1,4 +1,4 @@
-/* rustspec.c -- Specific flags and argument handling of the gcc Go front end.
+/* rustspec.c -- Specific flags and argument handling of the gcc Rust front end.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
This file is part of GCC.
@@ -28,24 +28,10 @@ along with GCC; see the file COPYING3. If not see
/* This bit is set if we saw a `-xfoo' language specification. */
#define LANGSPEC (1 << 1)
-/* This bit is set if they did `-lm' or `-lmath'. */
-#define MATHLIB (1 << 2)
-/* This bit is set if they did `-lpthread'. */
-#define THREADLIB (1 << 3)
/* This bit is set if they did `-lc'. */
-#define WITHLIBC (1 << 4)
+#define WITHLIBC (1 << 2)
/* Skip this option. */
-#define SKIPOPT (1 << 5)
-
-#ifndef MATH_LIBRARY
-#define MATH_LIBRARY "m"
-#endif
-#ifndef MATH_LIBRARY_PROFILE
-#define MATH_LIBRARY_PROFILE MATH_LIBRARY
-#endif
-
-#define THREAD_LIBRARY "pthread"
-#define THREAD_LIBRARY_PROFILE THREAD_LIBRARY
+#define SKIPOPT (1 << 3)
void
lang_specific_driver (struct cl_decoded_option **in_decoded_options,
@@ -54,38 +40,23 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
{
unsigned int i, j;
- /* If true, the user gave us the `-p' or `-pg' flag. */
- bool saw_profile_flag = false;
-
/* This is a tristate:
- -1 means we should not link in libgo
- 0 means we should link in libgo if it is needed
- 1 means libgo is needed and should be linked in.
- 2 means libgo is needed and should be linked statically. */
+ -1 means we should not link in librust
+ 0 means we should link in librust if it is needed
+ 1 means librust is needed and should be linked in.
+ 2 means librust is needed and should be linked statically. */
int library = 0;
/* The new argument list will be contained in this. */
struct cl_decoded_option *new_decoded_options;
- /* "-lm" or "-lmath" if it appears on the command line. */
- const struct cl_decoded_option *saw_math = 0;
-
- /* "-lpthread" if it appears on the command line. */
- const struct cl_decoded_option *saw_thread = 0;
-
/* "-lc" if it appears on the command line. */
const struct cl_decoded_option *saw_libc = 0;
/* An array used to flag each argument that needs a bit set for
- LANGSPEC, MATHLIB, or WITHLIBC. */
+ LANGSPEC or WITHLIBC. */
int *args;
- /* Whether we need the thread library. */
- int need_thread = 0;
-
- /* By default, we throw on the math library if we have one. */
- int need_math = (MATH_LIBRARY[0] != '\0');
-
/* True if we saw -static. */
int static_link = 0;
@@ -115,8 +86,8 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
/* Whether the -S option was used. */
bool saw_opt_S = false;
- /* The first input file with an extension of .go. */
- const char *first_go_file = NULL;
+ /* The first input file with an extension of .rs. */
+ const char *first_rust_file = NULL;
argc = *in_decoded_options_count;
decoded_options = *in_decoded_options;
@@ -137,34 +108,22 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
break;
case OPT_l:
- if (strcmp (arg, MATH_LIBRARY) == 0)
- {
- args[i] |= MATHLIB;
- need_math = 0;
- }
- else if (strcmp (arg, THREAD_LIBRARY) == 0)
- args[i] |= THREADLIB;
- else if (strcmp (arg, "c") == 0)
+ if (strcmp (arg, "c") == 0)
args[i] |= WITHLIBC;
else
- /* Unrecognized libraries (e.g. -lfoo) may require libgo. */
+ /* Unrecognized libraries (e.g. -lfoo) may require librust. */
library = (library == 0) ? 1 : library;
break;
- case OPT_pg:
- case OPT_p:
- saw_profile_flag = true;
- break;
-
case OPT_x:
- if (library == 0 && strcmp (arg, "go") == 0)
+ if (library == 0 && strcmp (arg, "rust") == 0)
library = 1;
break;
case OPT_Xlinker:
case OPT_Wl_:
/* Arguments that go directly to the linker might be .o files,
- or something, and so might cause libgo to be needed. */
+ or something, and so might cause librust to be needed. */
if (library == 0)
library = 1;
break;
@@ -197,7 +156,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
shared_libgcc = 0;
break;
- case OPT_static_libgo:
+ case OPT_static_librust:
library = library >= 0 ? 2 : library;
args[i] |= SKIPOPT;
break;
@@ -206,13 +165,13 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
if (library == 0)
library = 1;
- if (first_go_file == NULL)
+ if (first_rust_file == NULL)
{
int len;
len = strlen (arg);
- if (len > 3 && strcmp (arg + len - 3, ".go") == 0)
- first_go_file = arg;
+ if (len > 3 && strcmp (arg + len - 3, ".rs") == 0)
+ first_rust_file = arg;
}
break;
@@ -226,7 +185,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
#endif
/* Make sure to have room for the trailing NULL argument. */
- num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 10;
+ num_args = argc + shared_libgcc + (library > 0) * 5 + 10;
new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
i = 0;
@@ -240,20 +199,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
{
new_decoded_options[j] = decoded_options[i];
- /* Make sure -lgo is before the math library, since libgo itself
- uses those math routines. */
- if (!saw_math && (args[i] & MATHLIB) && library > 0)
- {
- --j;
- saw_math = &decoded_options[i];
- }
-
- if (!saw_thread && (args[i] & THREADLIB) && library > 0)
- {
- --j;
- saw_thread = &decoded_options[i];
- }
-
if (!saw_libc && (args[i] & WITHLIBC) && library > 0)
{
--j;
@@ -268,11 +213,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
}
/* If we didn't see a -o option, add one. This is because we need
- the driver to pass all .go files to go1. Without a -o option the
- driver will invoke go1 separately for each input file. FIXME:
+ the driver to pass all .rs files to rust1. Without a -o option the
+ driver will invoke rust1 separately for each input file. FIXME:
This should probably use some other interface to force the driver
to set combine_inputs. */
- if (first_go_file != NULL && !saw_opt_o)
+ if (first_rust_file != NULL && !saw_opt_o)
{
if (saw_opt_c || saw_opt_S)
{
@@ -281,7 +226,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
int alen;
char *out;
- base = lbasename (first_go_file);
+ base = lbasename (first_rust_file);
baselen = strlen (base) - 3;
alen = baselen + 3;
out = XNEWVEC (char, alen);
@@ -301,7 +246,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
j++;
}
- /* Add `-lgo' if we haven't already done so. */
+ /* Add `-lrust' if we haven't already done so. */
if (library > 0)
{
// generate_option (OPT_l, LIBGOBEGIN, 1, CL_DRIVER,
@@ -318,7 +263,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
}
#endif
- // generate_option (OPT_l, saw_profile_flag ? LIBGO_PROFILE : LIBGO, 1,
+ // generate_option (OPT_l, LIBGO, 1,
// CL_DRIVER, &new_decoded_options[j]);
// added_libraries++;
// j++;
@@ -331,34 +276,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
j++;
}
#endif
-
- /* When linking libgo statically we also need to link with the
- pthread library. */
- if (library > 1 || static_link)
- need_thread = 1;
- }
-
- if (saw_thread)
- new_decoded_options[j++] = *saw_thread;
- else if (library > 0 && need_thread)
- {
- generate_option (OPT_l,
- (saw_profile_flag ? THREAD_LIBRARY_PROFILE
- : THREAD_LIBRARY),
- 1, CL_DRIVER, &new_decoded_options[j]);
- added_libraries++;
- j++;
- }
-
- if (saw_math)
- new_decoded_options[j++] = *saw_math;
- else if (library > 0 && need_math)
- {
- generate_option (OPT_l,
- saw_profile_flag ? MATH_LIBRARY_PROFILE : MATH_LIBRARY,
- 1, CL_DRIVER, &new_decoded_options[j]);
- added_libraries++;
- j++;
}
if (saw_libc)
@@ -367,15 +284,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER,
&new_decoded_options[j++]);
-#if defined(TARGET_SOLARIS) && !defined(USE_GLD)
- /* We use a common symbol for go$zerovalue. On Solaris, when not
- using the GNU linker, the Solaris linker needs an option to not
- warn about this. Everything works without this option, but you
- get unsightly warnings at link time. */
- generate_option (OPT_Wl_, "-t", 1, CL_DRIVER, &new_decoded_options[j]);
- j++;
-#endif
-
*in_decoded_options_count = j;
*in_decoded_options = new_decoded_options;
*in_added_libraries = added_libraries;
@@ -383,10 +291,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
/* Called before linking. Returns 0 on success and -1 on failure. */
int
-lang_specific_pre_link (void) /* Not used for Go. */
+lang_specific_pre_link (void) /* Not used for Rust. */
{
return 0;
}
/* Number of extra output files that lang_specific_pre_link may generate. */
-int lang_specific_extra_outfiles = 0; /* Not used for Go. */
+int lang_specific_extra_outfiles = 0; /* Not used for Rust. */
--
2.32.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] More rustspec.cc cleanups
2021-08-05 23:34 [PATCH] More rustspec.cc cleanups Mark Wielaard
@ 2021-08-06 14:58 ` Philip Herron
2021-08-06 23:08 ` Mark Wielaard
0 siblings, 1 reply; 4+ messages in thread
From: Philip Herron @ 2021-08-06 14:58 UTC (permalink / raw)
To: gcc-rust
[-- Attachment #1.1: Type: text/plain, Size: 12166 bytes --]
On 06/08/2021 00:34, Mark Wielaard wrote:
> rustspec.cc was based on the Go frontend gospec.cc. Remove special
> handling of math and pthread libraries and profiling option. Handle
> .rs files instead of .go files. Keep support for linking with (static)
> librust which is currently commented out. Add generic static-librust
> option to common.opt.
> ---
> gcc/common.opt | 4 ++
> gcc/rust/config-lang.in | 2 +-
> gcc/rust/rustspec.cc | 146 ++++++++--------------------------------
> 3 files changed, 32 insertions(+), 120 deletions(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index c75dd36843e..820de1f41b0 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -3449,6 +3449,10 @@ static-libgo
> Driver
> ; Documented for Go, but always accepted by driver.
>
> +static-librust
> +Driver
> +; Documented for Rust, but always accepted by driver.
> +
> static-libasan
> Driver
>
> diff --git a/gcc/rust/config-lang.in b/gcc/rust/config-lang.in
> index c50b72153c2..1d61d2afc6b 100644
> --- a/gcc/rust/config-lang.in
> +++ b/gcc/rust/config-lang.in
> @@ -1,4 +1,4 @@
> -# config-lang.in -- Top level configure fragment for gcc Go frontend.
> +# config-lang.in -- Top level configure fragment for gcc Rust frontend.
>
> # Copyright (C) 2009-2019 Free Software Foundation, Inc.
>
> diff --git a/gcc/rust/rustspec.cc b/gcc/rust/rustspec.cc
> index 12ec874d222..806514a9d94 100644
> --- a/gcc/rust/rustspec.cc
> +++ b/gcc/rust/rustspec.cc
> @@ -1,4 +1,4 @@
> -/* rustspec.c -- Specific flags and argument handling of the gcc Go front end.
> +/* rustspec.c -- Specific flags and argument handling of the gcc Rust front end.
> Copyright (C) 2009-2020 Free Software Foundation, Inc.
>
> This file is part of GCC.
> @@ -28,24 +28,10 @@ along with GCC; see the file COPYING3. If not see
>
> /* This bit is set if we saw a `-xfoo' language specification. */
> #define LANGSPEC (1 << 1)
> -/* This bit is set if they did `-lm' or `-lmath'. */
> -#define MATHLIB (1 << 2)
> -/* This bit is set if they did `-lpthread'. */
> -#define THREADLIB (1 << 3)
> /* This bit is set if they did `-lc'. */
> -#define WITHLIBC (1 << 4)
> +#define WITHLIBC (1 << 2)
> /* Skip this option. */
> -#define SKIPOPT (1 << 5)
> -
> -#ifndef MATH_LIBRARY
> -#define MATH_LIBRARY "m"
> -#endif
> -#ifndef MATH_LIBRARY_PROFILE
> -#define MATH_LIBRARY_PROFILE MATH_LIBRARY
> -#endif
> -
> -#define THREAD_LIBRARY "pthread"
> -#define THREAD_LIBRARY_PROFILE THREAD_LIBRARY
> +#define SKIPOPT (1 << 3)
>
> void
> lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> @@ -54,38 +40,23 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> {
> unsigned int i, j;
>
> - /* If true, the user gave us the `-p' or `-pg' flag. */
> - bool saw_profile_flag = false;
> -
> /* This is a tristate:
> - -1 means we should not link in libgo
> - 0 means we should link in libgo if it is needed
> - 1 means libgo is needed and should be linked in.
> - 2 means libgo is needed and should be linked statically. */
> + -1 means we should not link in librust
> + 0 means we should link in librust if it is needed
> + 1 means librust is needed and should be linked in.
> + 2 means librust is needed and should be linked statically. */
> int library = 0;
>
> /* The new argument list will be contained in this. */
> struct cl_decoded_option *new_decoded_options;
>
> - /* "-lm" or "-lmath" if it appears on the command line. */
> - const struct cl_decoded_option *saw_math = 0;
> -
> - /* "-lpthread" if it appears on the command line. */
> - const struct cl_decoded_option *saw_thread = 0;
> -
> /* "-lc" if it appears on the command line. */
> const struct cl_decoded_option *saw_libc = 0;
>
> /* An array used to flag each argument that needs a bit set for
> - LANGSPEC, MATHLIB, or WITHLIBC. */
> + LANGSPEC or WITHLIBC. */
> int *args;
>
> - /* Whether we need the thread library. */
> - int need_thread = 0;
> -
> - /* By default, we throw on the math library if we have one. */
> - int need_math = (MATH_LIBRARY[0] != '\0');
> -
> /* True if we saw -static. */
> int static_link = 0;
>
> @@ -115,8 +86,8 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> /* Whether the -S option was used. */
> bool saw_opt_S = false;
>
> - /* The first input file with an extension of .go. */
> - const char *first_go_file = NULL;
> + /* The first input file with an extension of .rs. */
> + const char *first_rust_file = NULL;
>
> argc = *in_decoded_options_count;
> decoded_options = *in_decoded_options;
> @@ -137,34 +108,22 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> break;
>
> case OPT_l:
> - if (strcmp (arg, MATH_LIBRARY) == 0)
> - {
> - args[i] |= MATHLIB;
> - need_math = 0;
> - }
> - else if (strcmp (arg, THREAD_LIBRARY) == 0)
> - args[i] |= THREADLIB;
> - else if (strcmp (arg, "c") == 0)
> + if (strcmp (arg, "c") == 0)
> args[i] |= WITHLIBC;
> else
> - /* Unrecognized libraries (e.g. -lfoo) may require libgo. */
> + /* Unrecognized libraries (e.g. -lfoo) may require librust. */
> library = (library == 0) ? 1 : library;
> break;
>
> - case OPT_pg:
> - case OPT_p:
> - saw_profile_flag = true;
> - break;
> -
> case OPT_x:
> - if (library == 0 && strcmp (arg, "go") == 0)
> + if (library == 0 && strcmp (arg, "rust") == 0)
> library = 1;
> break;
>
> case OPT_Xlinker:
> case OPT_Wl_:
> /* Arguments that go directly to the linker might be .o files,
> - or something, and so might cause libgo to be needed. */
> + or something, and so might cause librust to be needed. */
> if (library == 0)
> library = 1;
> break;
> @@ -197,7 +156,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> shared_libgcc = 0;
> break;
>
> - case OPT_static_libgo:
> + case OPT_static_librust:
> library = library >= 0 ? 2 : library;
> args[i] |= SKIPOPT;
> break;
> @@ -206,13 +165,13 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> if (library == 0)
> library = 1;
>
> - if (first_go_file == NULL)
> + if (first_rust_file == NULL)
> {
> int len;
>
> len = strlen (arg);
> - if (len > 3 && strcmp (arg + len - 3, ".go") == 0)
> - first_go_file = arg;
> + if (len > 3 && strcmp (arg + len - 3, ".rs") == 0)
> + first_rust_file = arg;
> }
>
> break;
> @@ -226,7 +185,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> #endif
>
> /* Make sure to have room for the trailing NULL argument. */
> - num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 10;
> + num_args = argc + shared_libgcc + (library > 0) * 5 + 10;
> new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
>
> i = 0;
> @@ -240,20 +199,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> {
> new_decoded_options[j] = decoded_options[i];
>
> - /* Make sure -lgo is before the math library, since libgo itself
> - uses those math routines. */
> - if (!saw_math && (args[i] & MATHLIB) && library > 0)
> - {
> - --j;
> - saw_math = &decoded_options[i];
> - }
> -
> - if (!saw_thread && (args[i] & THREADLIB) && library > 0)
> - {
> - --j;
> - saw_thread = &decoded_options[i];
> - }
> -
> if (!saw_libc && (args[i] & WITHLIBC) && library > 0)
> {
> --j;
> @@ -268,11 +213,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> }
>
> /* If we didn't see a -o option, add one. This is because we need
> - the driver to pass all .go files to go1. Without a -o option the
> - driver will invoke go1 separately for each input file. FIXME:
> + the driver to pass all .rs files to rust1. Without a -o option the
> + driver will invoke rust1 separately for each input file. FIXME:
> This should probably use some other interface to force the driver
> to set combine_inputs. */
> - if (first_go_file != NULL && !saw_opt_o)
> + if (first_rust_file != NULL && !saw_opt_o)
> {
> if (saw_opt_c || saw_opt_S)
> {
> @@ -281,7 +226,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> int alen;
> char *out;
>
> - base = lbasename (first_go_file);
> + base = lbasename (first_rust_file);
> baselen = strlen (base) - 3;
> alen = baselen + 3;
> out = XNEWVEC (char, alen);
> @@ -301,7 +246,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> j++;
> }
>
> - /* Add `-lgo' if we haven't already done so. */
> + /* Add `-lrust' if we haven't already done so. */
> if (library > 0)
> {
> // generate_option (OPT_l, LIBGOBEGIN, 1, CL_DRIVER,
> @@ -318,7 +263,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> }
> #endif
>
> - // generate_option (OPT_l, saw_profile_flag ? LIBGO_PROFILE : LIBGO, 1,
> + // generate_option (OPT_l, LIBGO, 1,
> // CL_DRIVER, &new_decoded_options[j]);
> // added_libraries++;
> // j++;
> @@ -331,34 +276,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> j++;
> }
> #endif
> -
> - /* When linking libgo statically we also need to link with the
> - pthread library. */
> - if (library > 1 || static_link)
> - need_thread = 1;
> - }
> -
> - if (saw_thread)
> - new_decoded_options[j++] = *saw_thread;
> - else if (library > 0 && need_thread)
> - {
> - generate_option (OPT_l,
> - (saw_profile_flag ? THREAD_LIBRARY_PROFILE
> - : THREAD_LIBRARY),
> - 1, CL_DRIVER, &new_decoded_options[j]);
> - added_libraries++;
> - j++;
> - }
> -
> - if (saw_math)
> - new_decoded_options[j++] = *saw_math;
> - else if (library > 0 && need_math)
> - {
> - generate_option (OPT_l,
> - saw_profile_flag ? MATH_LIBRARY_PROFILE : MATH_LIBRARY,
> - 1, CL_DRIVER, &new_decoded_options[j]);
> - added_libraries++;
> - j++;
> }
>
> if (saw_libc)
> @@ -367,15 +284,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
> generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER,
> &new_decoded_options[j++]);
>
> -#if defined(TARGET_SOLARIS) && !defined(USE_GLD)
> - /* We use a common symbol for go$zerovalue. On Solaris, when not
> - using the GNU linker, the Solaris linker needs an option to not
> - warn about this. Everything works without this option, but you
> - get unsightly warnings at link time. */
> - generate_option (OPT_Wl_, "-t", 1, CL_DRIVER, &new_decoded_options[j]);
> - j++;
> -#endif
> -
> *in_decoded_options_count = j;
> *in_decoded_options = new_decoded_options;
> *in_added_libraries = added_libraries;
> @@ -383,10 +291,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
>
> /* Called before linking. Returns 0 on success and -1 on failure. */
> int
> -lang_specific_pre_link (void) /* Not used for Go. */
> +lang_specific_pre_link (void) /* Not used for Rust. */
> {
> return 0;
> }
>
> /* Number of extra output files that lang_specific_pre_link may generate. */
> -int lang_specific_extra_outfiles = 0; /* Not used for Go. */
> +int lang_specific_extra_outfiles = 0; /* Not used for Rust. */
Great patch, this file has been neglected. This is now being merged
https://github.com/Rust-GCC/gccrs/pull/610
Its not 100% clear but is the compiler driver here automatically adding
in -lc or is it simply checking if it saw_libc?
Thanks
--Phil
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] More rustspec.cc cleanups
2021-08-06 14:58 ` Philip Herron
@ 2021-08-06 23:08 ` Mark Wielaard
2021-08-08 11:48 ` Philip Herron
0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2021-08-06 23:08 UTC (permalink / raw)
To: Philip Herron; +Cc: gcc-rust
Hi Philip,
On Fri, Aug 06, 2021 at 03:58:24PM +0100, Philip Herron wrote:
> Great patch, this file has been neglected. This is now being merged
> https://github.com/Rust-GCC/gccrs/pull/610
>
> Its not 100% clear but is the compiler driver here automatically adding
> in -lc or is it simply checking if it saw_libc?
It does pass -lc (if not saw_libc). You can see what is invoked with
which arguments using -v (e.g. gcc/gccrs -B gcc -v foobar.rs).
One of the things we are using is the crt1.o startup code, which
provides the _start symbol and which relies on libc (in particular
__libc_start_main and abort).
The patch wasn't really meant to change how we currently do
assembling, linking and startup. But just to remove those parts that
were unnecessary because they were go specific.
Cheers,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] More rustspec.cc cleanups
2021-08-06 23:08 ` Mark Wielaard
@ 2021-08-08 11:48 ` Philip Herron
0 siblings, 0 replies; 4+ messages in thread
From: Philip Herron @ 2021-08-08 11:48 UTC (permalink / raw)
To: Mark Wielaard; +Cc: gcc-rust
[-- Attachment #1.1: Type: text/plain, Size: 1186 bytes --]
On 07/08/2021 00:08, Mark Wielaard wrote:
> Hi Philip,
>
> On Fri, Aug 06, 2021 at 03:58:24PM +0100, Philip Herron wrote:
>> Great patch, this file has been neglected. This is now being merged
>> https://github.com/Rust-GCC/gccrs/pull/610
>>
>> Its not 100% clear but is the compiler driver here automatically adding
>> in -lc or is it simply checking if it saw_libc?
> It does pass -lc (if not saw_libc). You can see what is invoked with
> which arguments using -v (e.g. gcc/gccrs -B gcc -v foobar.rs).
>
> One of the things we are using is the crt1.o startup code, which
> provides the _start symbol and which relies on libc (in particular
> __libc_start_main and abort).
>
> The patch wasn't really meant to change how we currently do
> assembling, linking and startup. But just to remove those parts that
> were unnecessary because they were go specific.
>
> Cheers,
>
> Mark
>
Awesome thanks for checking. Agreed that this patch was not meant to
change that behavior but it was a great start at cleaning up the driver.
I am now wondering if rustc reuses the same type of startup code. I'll
go ask more questions about it :)
Thanks
--Phil
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-08 11:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 23:34 [PATCH] More rustspec.cc cleanups Mark Wielaard
2021-08-06 14:58 ` Philip Herron
2021-08-06 23:08 ` Mark Wielaard
2021-08-08 11:48 ` Philip Herron
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).