The option has existed and been working for years,
make sure it implies the right extra options, and list
it in the documentation.
2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
gcc/
* gcc.c (LINK_COMMAND_SPEC): Handle -r like -nostdlib.
(VTABLE_VERIFICATION_SPEC): Likewise.
(SANITIZER_EARLY_SPEC): Likewise.
(SANITIZER_SPEC): Likewise.
* config/darwin.h (LINK_COMMAND_SPEC): Likewise.
* doc/invoke.texi (Link Options): Document -r.
gcc/cp/
* g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
gcc/fortran/
* gfortranspec.c (lang_specific_driver): Handle -r like -nostdlib.
gcc/go/
* gospec.c (lang_specific_driver): Handle -r like -nostdlib.
gcc/testsuite/
* g++.dg/ipa/pr64059.C: Removed now redundant -nostdlib.
* g++.dg/lto/
20081109-1_0.C: Likewise.
* g++.dg/lto/20090302_0.C: Likewise.
* g++.dg/lto/pr45621_0.C: Likewise.
* g++.dg/lto/pr60567_0.C: Likewise.
* g++.dg/lto/pr62026.C: Likewise.
* gcc.dg/lto/pr45736_0.c: Likewise.
* gcc.dg/lto/pr52634_0.c: Likewise.
* gfortran.dg/lto/
20091016-1_0.f90: Likewise.
* gfortran.dg/lto/pr79108_0.f90: Likewise.
From-SVN: r264451
+2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
+
+ * gcc.c (LINK_COMMAND_SPEC): Handle -r like -nostdlib.
+ (VTABLE_VERIFICATION_SPEC): Likewise.
+ (SANITIZER_EARLY_SPEC): Likewise.
+ (SANITIZER_SPEC): Likewise.
+ * config/darwin.h (LINK_COMMAND_SPEC): Likewise.
+ * doc/invoke.texi (Link Options): Document -r.
+
2018-09-20 Richard Biener <rguenther@suse.de>
PR middle-end/87054
"%X %{s} %{t} %{Z} %{u*} \
%{e*} %{r} \
%{o*}%{!o:-o a.out} \
- %{!nostdlib:%{!nostartfiles:%S}} \
+ %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
%{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
%{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
%{fgnu-tm: \
%{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
- %{!nostdlib:%{!nodefaultlibs:\
+ %{!nostdlib:%{!r:%{!nodefaultlibs:\
%{%:sanitize(address): -lasan } \
%{%:sanitize(undefined): -lubsan } \
%(link_ssp) \
" DARWIN_EXPORT_DYNAMIC " %<rdynamic \
%(link_gcc_c_sequence) \
- }}\
- %{!nostdlib:%{!nostartfiles:%E}} %{T*} %{F*} }}}}}}}"
+ }}}\
+ %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}"
#define DSYMUTIL "\ndsymutil"
+2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
+
+ * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
+
2018-09-20 Jason Merrill <jason@redhat.com>
PR c++/87075 - ICE with constexpr array initialization.
break;
case OPT_c:
+ case OPT_r:
case OPT_S:
case OPT_E:
case OPT_M:
@xref{Link Options,,Options for Linking}.
@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
-nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
--pie -pthread -rdynamic @gol
+-pie -pthread -r -rdynamic @gol
-s -static -static-pie -static-libgcc -static-libstdc++ @gol
-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
-shared -shared-libgcc -symbolic @gol
flags for the preprocessor, so it should be used consistently for both
compilation and linking.
+@item -r
+@opindex r
+Produce a relocatable object as output. This is also known as partial
+linking.
+
@item -rdynamic
@opindex rdynamic
Pass the flag @option{-export-dynamic} to the ELF linker, on targets
+2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
+
+ * gfortranspec.c (lang_specific_driver): Handle -r like -nostdlib.
+
2018-09-20 Janus Weil <janus@gcc.gnu.org>
* gfortran.h (gfc_str_startswith): New macro.
case OPT_nostdlib:
case OPT_nodefaultlibs:
case OPT_c:
+ case OPT_r:
case OPT_S:
case OPT_fsyntax_only:
case OPT_E:
/* Linker command line options for -fsanitize= early on the command line. */
#ifndef SANITIZER_EARLY_SPEC
#define SANITIZER_EARLY_SPEC "\
-%{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \
+%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \
%{%:sanitize(thread):" LIBTSAN_EARLY_SPEC "} \
- %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}"
+ %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}}"
#endif
/* Linker command line options for -fsanitize= late on the command line. */
#ifndef SANITIZER_SPEC
#define SANITIZER_SPEC "\
-%{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\
+%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\
%{static:%ecannot specify -static with -fsanitize=address}}\
%{%:sanitize(thread):" LIBTSAN_SPEC "\
%{static:%ecannot specify -static with -fsanitize=thread}}\
%{%:sanitize(undefined):" LIBUBSAN_SPEC "}\
- %{%:sanitize(leak):" LIBLSAN_SPEC "}}}"
+ %{%:sanitize(leak):" LIBLSAN_SPEC "}}}}"
#endif
#ifndef POST_LINK_SPEC
#ifndef VTABLE_VERIFICATION_SPEC
#if ENABLE_VTABLE_VERIFY
#define VTABLE_VERIFICATION_SPEC "\
-%{!nostdlib:%{fvtable-verify=std: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}\
- %{fvtable-verify=preinit: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}}"
+%{!nostdlib:%{!r:%{fvtable-verify=std: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}\
+ %{fvtable-verify=preinit: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}}}"
#else
#define VTABLE_VERIFICATION_SPEC "\
%{fvtable-verify=none:} \
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
- %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
%{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
%(mflib) " STACK_SPLIT_SPEC "\
%{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
- %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
- %{!nostdlib:%{!nostartfiles:%E}} %{T*} \n%(post_link) }}}}}}"
+ %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\
+ %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}"
#endif
#ifndef LINK_LIBGCC_SPEC
+2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
+
+ * gospec.c (lang_specific_driver): Handle -r like -nostdlib.
+
2018-08-27 Martin Liska <mliska@suse.cz>
* go-gcc.cc (Gcc_backend::call_expression): Use new function
switch (decoded_options[i].opt_index)
{
+ case OPT_r:
case OPT_nostdlib:
case OPT_nodefaultlibs:
library = -1;
+2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
+
+ * g++.dg/ipa/pr64059.C: Removed now redundant -nostdlib.
+ * g++.dg/lto/20081109-1_0.C: Likewise.
+ * g++.dg/lto/20090302_0.C: Likewise.
+ * g++.dg/lto/pr45621_0.C: Likewise.
+ * g++.dg/lto/pr60567_0.C: Likewise.
+ * g++.dg/lto/pr62026.C: Likewise.
+ * gcc.dg/lto/pr45736_0.c: Likewise.
+ * gcc.dg/lto/pr52634_0.c: Likewise.
+ * gfortran.dg/lto/20091016-1_0.f90: Likewise.
+ * gfortran.dg/lto/pr79108_0.f90: Likewise.
+
2018-09-20 Alexandre Oliva <oliva@adacore.com>
PR middle-end/87054
-// { dg-options "-r -nostdlib -O2 -flto -fno-devirtualize" }
+// { dg-options "-r -O2 -flto -fno-devirtualize" }
// { dg-require-effective-target lto }
class A;
// { dg-lto-do link }
// { dg-require-effective-target fpic }
// { dg-lto-options {{-fPIC -flto -flto-partition=1to1}} }
-// { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -nostdlib -fno-exceptions -flinker-output=nolto-rel" }
+// { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -fno-exceptions -flinker-output=nolto-rel" }
void func(); class Foo { };
void bar() { try { func(); } catch (Foo) { } };
/* { dg-lto-do link } */
/* { dg-require-effective-target fpic } */
-/* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r -nostdlib}} } */
+/* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r}} } */
/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
struct Foo {
bool Mumble();
// { dg-lto-do assemble }
-// { dg-extra-ld-options "-O2 -fipa-cp-clone -flto -nostdlib -r -flinker-output=nolto-rel" }
+// { dg-extra-ld-options "-O2 -fipa-cp-clone -flto -r -flinker-output=nolto-rel" }
#include "pr45621.h"
void
// PR lto/60567
// { dg-lto-do link }
// { dg-lto-options { { -flto -fno-use-linker-plugin } } }
-// { dg-extra-ld-options "-r -nostdlib" }
+// { dg-extra-ld-options "-r" }
#pragma implementation
struct S {};
// { dg-lto-do link }
-// { dg-lto-options {{-flto -O3 -r -nostdlib}} }
+// { dg-lto-options {{-flto -O3 -r}} }
class C;
class F {
virtual C m_fn1();
/* { dg-lto-do link } */
-/* { dg-lto-options {{-flto -r -nostdlib -O}} } */
+/* { dg-lto-options {{-flto -r -O}} } */
/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
extern void baz (void);
/* { dg-require-weak "" } */
/* { dg-require-alias "" } */
/* { dg-lto-do link } */
-/* { dg-lto-options {{-flto -r -nostdlib -flto-partition=1to1}} */
+/* { dg-lto-options {{-flto -r -flto-partition=1to1}} */
/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
extern int cfliteValueCallBacks;
void baz (int *);
! { dg-lto-do link }
-! { dg-lto-options {{-flto -g -fPIC -r -nostdlib} {-O -flto -g -fPIC -r -nostdlib}} }
+! { dg-lto-options {{-flto -g -fPIC -r} {-O -flto -g -fPIC -r}} }
! { dg-extra-ld-options "-flinker-output=nolto-rel" }
FUNCTION makenumberstring(x)
! { dg-lto-do link }
! { dg-lto-options {{ -Ofast -flto --param ggc-min-expand=0 --param ggc-min-heapsize=0 }} }
-! { dg-extra-ld-options "-r -nostdlib" }
+! { dg-extra-ld-options "-r" }
MODULE Errorcheck_mod
CONTAINS