Patchwork [14/25] Specs cleanup: MIPS -call_shared -non_shared

login
register
mail settings
Submitter Joseph S. Myers
Date Jan. 14, 2011, 12:12 a.m.
Message ID <Pine.LNX.4.64.1101140011290.6059@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/78842/
State New
Headers show

Comments

Joseph S. Myers - Jan. 14, 2011, 12:12 a.m.
In addition to the specs mentioned in patch 13, various MIPS targets
have specs passing -call_shared and -non_shared to the linker.  While
these options do exist with the GNU linker, there is nothing
MIPS-specific about them and there should be nothing MIPS-specific
about such options being accepted by the driver; the appropriate
dependence is on the target operating system.  Thus, this patch
removes them also from specs for non-IRIX targets.  OK to commit?

2011-01-13  Joseph Myers  <joseph@codesourcery.com>

	* config/mips/linux64.h (LINK_SPEC): Remove %{non_shared}
	%{call_shared}.
	* config/mips/mips.h (LINK_SPEC): Remove %{non_shared}.
	* config/mips/netbsd.h (LINK_SPEC): Remove %{call_shared}.
	* config/mips/openbsd.h (LINK_SPEC): Remove %{non_shared}
	%{call_shared} and conditionals on these options not being passed.
	* config/mips/sde.h (LINK_SPEC): Remove %{non_shared}
	%{call_shared}.
Richard Sandiford - Jan. 14, 2011, 12:06 p.m.
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> In addition to the specs mentioned in patch 13, various MIPS targets
> have specs passing -call_shared and -non_shared to the linker.  While
> these options do exist with the GNU linker, there is nothing
> MIPS-specific about them and there should be nothing MIPS-specific
> about such options being accepted by the driver; the appropriate
> dependence is on the target operating system.  Thus, this patch
> removes them also from specs for non-IRIX targets.  OK to commit?

I'm not sure this is a good idea.  I'd agree with your logic if we
were starting from scratch, but I don't see the need to change from
historical precendent now.

Richard
Joseph S. Myers - Jan. 14, 2011, 6:18 p.m.
On Fri, 14 Jan 2011, Richard Sandiford wrote:

> "Joseph S. Myers" <joseph@codesourcery.com> writes:
> > In addition to the specs mentioned in patch 13, various MIPS targets
> > have specs passing -call_shared and -non_shared to the linker.  While
> > these options do exist with the GNU linker, there is nothing
> > MIPS-specific about them and there should be nothing MIPS-specific
> > about such options being accepted by the driver; the appropriate
> > dependence is on the target operating system.  Thus, this patch
> > removes them also from specs for non-IRIX targets.  OK to commit?
> 
> I'm not sure this is a good idea.  I'd agree with your logic if we
> were starting from scratch, but I don't see the need to change from
> historical precendent now.

The immediate motivation is getting all options into .opt files so that 
the driver can (in 4.7) start rejecting options not known in a .opt file 
rather than accepting them if matched by some spec.

While of course these options can be added to a .opt file or files (it's 
fairly harmless for a .opt file to list some options that are not in fact 
accepted by specs for all targets using that .opt file), there seems to be 
very little logic about which are accepted where.  mips/linux64.h accepts 
both, mips/linux.h accepts neither, mips/mips.h accepts only -non_shared, 
mips/netbsd.h accepts only -call_shared - so there is no consistency of 
design even for MIPS targets here.  And since a strength of GCC is 
consistency between different targets, making things consistent by 
removing them from specs where they are accepted for MIPS but not other 
targets with same OS seems natural.

(In general I think it would be a good idea for much more spec content to 
be shared between targets.  The main content of LINK_SPEC for 
GNU-userspace targets, for example, could go in a $(gnu_user_link_spec) 
(or even $(gnu_ld_elf_link_spec)) whose contents are exactly those of the 
i386/linux.h LINK_SPEC (after my patch 05); each target architecture would 
define link_emulation and dynamic_linker specs to go along with this, and 
LINK_SPEC would be defined in <arch>/linux.h to contain 
$(gnu_user_link_spec) plus such other pieces as are genuinely 
architecture-specific.)
Richard Sandiford - Jan. 15, 2011, 11:02 a.m.
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> On Fri, 14 Jan 2011, Richard Sandiford wrote:
>> "Joseph S. Myers" <joseph@codesourcery.com> writes:
>> > In addition to the specs mentioned in patch 13, various MIPS targets
>> > have specs passing -call_shared and -non_shared to the linker.  While
>> > these options do exist with the GNU linker, there is nothing
>> > MIPS-specific about them and there should be nothing MIPS-specific
>> > about such options being accepted by the driver; the appropriate
>> > dependence is on the target operating system.  Thus, this patch
>> > removes them also from specs for non-IRIX targets.  OK to commit?
>> 
>> I'm not sure this is a good idea.  I'd agree with your logic if we
>> were starting from scratch, but I don't see the need to change from
>> historical precendent now.
>
> The immediate motivation is getting all options into .opt files so that 
> the driver can (in 4.7) start rejecting options not known in a .opt file 
> rather than accepting them if matched by some spec.
>
> While of course these options can be added to a .opt file or files (it's 
> fairly harmless for a .opt file to list some options that are not in fact 
> accepted by specs for all targets using that .opt file), there seems to be 
> very little logic about which are accepted where.  mips/linux64.h accepts 
> both, mips/linux.h accepts neither, mips/mips.h accepts only -non_shared, 
> mips/netbsd.h accepts only -call_shared - so there is no consistency of 
> design even for MIPS targets here.

OK, that's a convincing argument.  I hadn't realised that linux.h and
linux64.h did different things here.  Since linux.h doesn't have them,
I agree there's very little to worry about.

I'll echo Eric's OK.

Richard

Patch

diff -rupN --exclude=.svn gcc-mainline-13/gcc/config/mips/linux64.h gcc-mainline/gcc/config/mips/linux64.h
--- gcc-mainline-13/gcc/config/mips/linux64.h	2011-01-12 14:28:26.000000000 -0800
+++ gcc-mainline/gcc/config/mips/linux64.h	2011-01-12 14:33:23.000000000 -0800
@@ -47,8 +47,7 @@  along with GCC; see the file COPYING3.  
 #undef LINK_SPEC
 #define LINK_SPEC "\
 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
-%{shared} %{non_shared} \
-%{call_shared} \
+%{shared} \
  %(endian_spec) \
   %{!shared: \
     %{!static: \
diff -rupN --exclude=.svn gcc-mainline-13/gcc/config/mips/mips.h gcc-mainline/gcc/config/mips/mips.h
--- gcc-mainline-13/gcc/config/mips/mips.h	2011-01-12 14:28:43.000000000 -0800
+++ gcc-mainline/gcc/config/mips/mips.h	2011-01-12 14:33:44.000000000 -0800
@@ -1150,7 +1150,7 @@  enum mips_code_readable_setting {
 #define LINK_SPEC "\
 %(endian_spec) \
 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \
-%{shared} %{non_shared}"
+%{shared}"
 #endif  /* LINK_SPEC defined */
 
 
diff -rupN --exclude=.svn gcc-mainline-13/gcc/config/mips/netbsd.h gcc-mainline/gcc/config/mips/netbsd.h
--- gcc-mainline-13/gcc/config/mips/netbsd.h	2011-01-12 14:29:00.000000000 -0800
+++ gcc-mainline/gcc/config/mips/netbsd.h	2011-01-12 14:33:35.000000000 -0800
@@ -148,7 +148,6 @@  along with GCC; see the file COPYING3.  
    %{EB:-m elf32bmip} \
    %(endian_spec) \
    %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
-   %{call_shared} \
    %(netbsd_link_spec)"
 
 #define NETBSD_ENTRY_POINT "__start"
diff -rupN --exclude=.svn gcc-mainline-13/gcc/config/mips/openbsd.h gcc-mainline/gcc/config/mips/openbsd.h
--- gcc-mainline-13/gcc/config/mips/openbsd.h	2011-01-12 14:29:13.000000000 -0800
+++ gcc-mainline/gcc/config/mips/openbsd.h	2011-01-12 14:34:15.000000000 -0800
@@ -77,9 +77,8 @@  along with GCC; see the file COPYING3.  
 #undef LINK_SPEC
 #define LINK_SPEC \
   "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-   %{shared} %{non_shared} \
-   %{call_shared} \
-   %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
+   %{shared} \
+   %{!shared: -non_shared} \
    -dynamic-linker /usr/libexec/ld.so \
    %{!nostdlib:%{!r:%{!e*:-e __start}}} -dc -dp \
    %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
diff -rupN --exclude=.svn gcc-mainline-13/gcc/config/mips/sde.h gcc-mainline/gcc/config/mips/sde.h
--- gcc-mainline-13/gcc/config/mips/sde.h	2011-01-12 14:29:25.000000000 -0800
+++ gcc-mainline/gcc/config/mips/sde.h	2011-01-12 14:34:25.000000000 -0800
@@ -59,7 +59,7 @@  along with GCC; see the file COPYING3.  
 #define LINK_SPEC "\
 %(endian_spec) \
 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \
-%{shared} %{non_shared} %{call_shared} \
+%{shared} \
 %{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
 %{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
 %{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}"