summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-17 13:22:28 +0000
committeriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-17 13:22:28 +0000
commit8127ab5d0f776e36ccac421e711bf66a73a73641 (patch)
treebab5c0bd0898b585bfbdc2cef1cac677a2b6ad2f
parent5ae7e0a539110352e344788f8fed6675a004df94 (diff)
downloadppe42-gcc-8127ab5d0f776e36ccac421e711bf66a73a73641.tar.gz
ppe42-gcc-8127ab5d0f776e36ccac421e711bf66a73a73641.zip
2010-08-17 Jack Howarth <howarth@bromo.med.uc.edu>
* gcc.c (spec_function): Add remove-outfile. (remove_outfile_spec_function): New function. * config/darwin.h (LINK_SPEC): Add removal of -ldl, -lm and -lpthread. * invoke.texi (replace-outfile): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163305 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/darwin.h3
-rw-r--r--gcc/doc/invoke.texi9
-rw-r--r--gcc/gcc.c23
4 files changed, 43 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29e5007c162..ff72674c46b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-17 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * gcc.c (spec_function): Add remove-outfile.
+ (remove_outfile_spec_function): New function.
+ * config/darwin.h (LINK_SPEC): Add removal of
+ -ldl, -lm and -lpthread.
+ * invoke.texi (replace-outfile): Document.
+
2010-08-17 Uros Bizjak <ubizjak@gmail.com>
PR target/45296
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index feb57c9feb7..c9354344e3b 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -303,6 +303,9 @@ extern GTY(()) int darwin_ms_struct;
so put a * after their names so all of them get passed. */
#define LINK_SPEC \
"%{static}%{!static:-dynamic} \
+ %:remove-outfile(-ldl) \
+ %:remove-outfile(-lm) \
+ %:remove-outfile(-lpthread) \
%{fgnu-runtime: %{static|static-libgcc: \
%:replace-outfile(-lobjc libobjc-gnu.a%s); \
:%:replace-outfile(-lobjc -lobjc-gnu ) } }\
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index b321ccee951..b2d72d9a9d0 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9629,6 +9629,15 @@ is a small example of its usage:
%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
@end smallexample
+@item @code{remove-outfile}
+The @code{remove-outfile} spec function takes one argument. It looks for the
+first argument in the outfiles array and removes it. Here is a small example
+its usage:
+
+@smallexample
+%:remove-outfile(-lm)
+@end smallexample
+
@item @code{print-asm-header}
The @code{print-asm-header} function takes no arguments and simply
prints a banner like:
diff --git a/gcc/gcc.c b/gcc/gcc.c
index c2c87fe0d85..a96d49785b2 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -317,6 +317,7 @@ static const char *getenv_spec_function (int, const char **);
static const char *if_exists_spec_function (int, const char **);
static const char *if_exists_else_spec_function (int, const char **);
static const char *replace_outfile_spec_function (int, const char **);
+static const char *remove_outfile_spec_function (int, const char **);
static const char *version_compare_spec_function (int, const char **);
static const char *include_spec_function (int, const char **);
static const char *find_file_spec_function (int, const char **);
@@ -1615,6 +1616,7 @@ static const struct spec_function static_spec_functions[] =
{ "if-exists", if_exists_spec_function },
{ "if-exists-else", if_exists_else_spec_function },
{ "replace-outfile", replace_outfile_spec_function },
+ { "remove-outfile", remove_outfile_spec_function },
{ "version-compare", version_compare_spec_function },
{ "include", include_spec_function },
{ "find-file", find_file_spec_function },
@@ -8274,6 +8276,27 @@ replace_outfile_spec_function (int argc, const char **argv)
return NULL;
}
+/* remove-outfile built-in spec function.
+ *
+ * This looks for the first argument in the outfiles array's name and
+ * removes it. */
+
+static const char *
+remove_outfile_spec_function (int argc, const char **argv)
+{
+ int i;
+ /* Must have exactly one argument. */
+ if (argc != 1)
+ abort ();
+
+ for (i = 0; i < n_infiles; i++)
+ {
+ if (outfiles[i] && !strcmp (outfiles[i], argv[0]))
+ outfiles[i] = NULL;
+ }
+ return NULL;
+}
+
/* Given two version numbers, compares the two numbers.
A version number must match the regular expression
([1-9][0-9]*|0)(\.([1-9][0-9]*|0))*
OpenPOWER on IntegriCloud