Add -lrt on Solaris
gcc/cp: * g++spec.c (TIMELIB): Define. (WITHLIBC, SKIPOPT): Adjust values. (lang_specific_driver): Add TIME_LIBRARY if not passed explicitly. gcc: * config/sol2.h (TIME_LIBRARY): Define. From-SVN: r205483
This commit is contained in:
parent
049558ed48
commit
ff082cab81
|
@ -1,3 +1,7 @@
|
||||||
|
2013-11-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
|
* config/sol2.h (TIME_LIBRARY): Define.
|
||||||
|
|
||||||
2013-11-28 Richard Biener <rguenther@suse.de>
|
2013-11-28 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
PR lto/59323
|
PR lto/59323
|
||||||
|
|
|
@ -163,6 +163,9 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#undef LINK_ARCH_SPEC
|
#undef LINK_ARCH_SPEC
|
||||||
#define LINK_ARCH_SPEC LINK_ARCH32_SPEC
|
#define LINK_ARCH_SPEC LINK_ARCH32_SPEC
|
||||||
|
|
||||||
|
/* C++11 programs need -lrt for nanosleep. */
|
||||||
|
#define TIME_LIBRARY "rt"
|
||||||
|
|
||||||
#ifndef USE_GLD
|
#ifndef USE_GLD
|
||||||
/* With Sun ld, -rdynamic is a no-op. */
|
/* With Sun ld, -rdynamic is a no-op. */
|
||||||
#define RDYNAMIC_SPEC ""
|
#define RDYNAMIC_SPEC ""
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2013-11-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
|
* g++spec.c (TIMELIB): Define.
|
||||||
|
(WITHLIBC, SKIPOPT): Adjust values.
|
||||||
|
(lang_specific_driver): Add TIME_LIBRARY if not passed explicitly.
|
||||||
|
|
||||||
2013-11-28 Jakub Jelinek <jakub@redhat.com>
|
2013-11-28 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR c/59310
|
PR c/59310
|
||||||
|
|
|
@ -28,10 +28,12 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#define LANGSPEC (1<<1)
|
#define LANGSPEC (1<<1)
|
||||||
/* This bit is set if they did `-lm' or `-lmath'. */
|
/* This bit is set if they did `-lm' or `-lmath'. */
|
||||||
#define MATHLIB (1<<2)
|
#define MATHLIB (1<<2)
|
||||||
|
/* This bit is set if they did `-lrt' or equivalent. */
|
||||||
|
#define TIMELIB (1<<3)
|
||||||
/* This bit is set if they did `-lc'. */
|
/* This bit is set if they did `-lc'. */
|
||||||
#define WITHLIBC (1<<3)
|
#define WITHLIBC (1<<4)
|
||||||
/* Skip this option. */
|
/* Skip this option. */
|
||||||
#define SKIPOPT (1<<4)
|
#define SKIPOPT (1<<5)
|
||||||
|
|
||||||
#ifndef MATH_LIBRARY
|
#ifndef MATH_LIBRARY
|
||||||
#define MATH_LIBRARY "m"
|
#define MATH_LIBRARY "m"
|
||||||
|
@ -40,6 +42,10 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#define MATH_LIBRARY_PROFILE MATH_LIBRARY
|
#define MATH_LIBRARY_PROFILE MATH_LIBRARY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TIME_LIBRARY
|
||||||
|
#define TIME_LIBRARY ""
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LIBSTDCXX
|
#ifndef LIBSTDCXX
|
||||||
#define LIBSTDCXX "stdc++"
|
#define LIBSTDCXX "stdc++"
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,16 +89,22 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
|
||||||
/* "-lm" or "-lmath" if it appears on the command line. */
|
/* "-lm" or "-lmath" if it appears on the command line. */
|
||||||
const struct cl_decoded_option *saw_math = NULL;
|
const struct cl_decoded_option *saw_math = NULL;
|
||||||
|
|
||||||
|
/* "-lrt" or eqivalent if it appears on the command line. */
|
||||||
|
const struct cl_decoded_option *saw_time = NULL;
|
||||||
|
|
||||||
/* "-lc" if it appears on the command line. */
|
/* "-lc" if it appears on the command line. */
|
||||||
const struct cl_decoded_option *saw_libc = NULL;
|
const struct cl_decoded_option *saw_libc = NULL;
|
||||||
|
|
||||||
/* An array used to flag each argument that needs a bit set for
|
/* An array used to flag each argument that needs a bit set for
|
||||||
LANGSPEC, MATHLIB, or WITHLIBC. */
|
LANGSPEC, MATHLIB, TIMELIB, or WITHLIBC. */
|
||||||
int *args;
|
int *args;
|
||||||
|
|
||||||
/* By default, we throw on the math library if we have one. */
|
/* By default, we throw on the math library if we have one. */
|
||||||
int need_math = (MATH_LIBRARY[0] != '\0');
|
int need_math = (MATH_LIBRARY[0] != '\0');
|
||||||
|
|
||||||
|
/* By default, we throw on the time library if we have one. */
|
||||||
|
int need_time = (TIME_LIBRARY[0] != '\0');
|
||||||
|
|
||||||
/* True if we saw -static. */
|
/* True if we saw -static. */
|
||||||
int static_link = 0;
|
int static_link = 0;
|
||||||
|
|
||||||
|
@ -136,6 +148,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
|
||||||
args[i] |= MATHLIB;
|
args[i] |= MATHLIB;
|
||||||
need_math = 0;
|
need_math = 0;
|
||||||
}
|
}
|
||||||
|
else if (strcmp (arg, TIME_LIBRARY) == 0)
|
||||||
|
{
|
||||||
|
args[i] |= TIMELIB;
|
||||||
|
need_time = 0;
|
||||||
|
}
|
||||||
else if (strcmp (arg, "c") == 0)
|
else if (strcmp (arg, "c") == 0)
|
||||||
args[i] |= WITHLIBC;
|
args[i] |= WITHLIBC;
|
||||||
else
|
else
|
||||||
|
@ -268,6 +285,12 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
|
||||||
saw_math = &decoded_options[i];
|
saw_math = &decoded_options[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!saw_time && (args[i] & TIMELIB) && library > 0)
|
||||||
|
{
|
||||||
|
--j;
|
||||||
|
saw_time = &decoded_options[i];
|
||||||
|
}
|
||||||
|
|
||||||
if (!saw_libc && (args[i] & WITHLIBC) && library > 0)
|
if (!saw_libc && (args[i] & WITHLIBC) && library > 0)
|
||||||
{
|
{
|
||||||
--j;
|
--j;
|
||||||
|
@ -352,6 +375,15 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
|
||||||
added_libraries++;
|
added_libraries++;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
if (saw_time)
|
||||||
|
new_decoded_options[j++] = *saw_time;
|
||||||
|
else if (library > 0 && need_time)
|
||||||
|
{
|
||||||
|
generate_option (OPT_l, TIME_LIBRARY, 1, CL_DRIVER,
|
||||||
|
&new_decoded_options[j]);
|
||||||
|
added_libraries++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
if (saw_libc)
|
if (saw_libc)
|
||||||
new_decoded_options[j++] = *saw_libc;
|
new_decoded_options[j++] = *saw_libc;
|
||||||
if (shared_libgcc && !static_link)
|
if (shared_libgcc && !static_link)
|
||||||
|
|
Loading…
Reference in New Issue