public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix bootstrap for non linux powerpc targets
@ 2018-12-12 20:33 Andreas Tobler
  2018-12-16 18:46 ` [patch] Fix bootstrap powerpc*-*-freebsd* targets Andreas Tobler
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Tobler @ 2018-12-12 20:33 UTC (permalink / raw)
  To: GCC Patches

Hi all,

this patch fixes bootstrap for my powerpc*-unknown-freebsd* targets.
The definition of GNU_USER_DYNAMIC_LINKER was recently moved to linux.h.

But the GNU_USER_DYNAMIC_LINKER is still used in rs6000/sysv4.h.
So I add an empty definition with guard to cure the bootstrap issue.

Ok for trunk?

TIA,
Andreas

2018-12-12  Andreas Tobler  <andreast@gcc.gnu.org>

	* config/rs6000/sysv4.h: Add an empty definition for
	GNU_USER_DYNAMIC_LINKER for all targets which do not include
	linux.h where GNU_USER_DYNAMIC_LINKER is defined.

Index: sysv4.h
===================================================================
--- sysv4.h	(revision 267063)
+++ sysv4.h	(working copy)
@@ -761,6 +761,9 @@
  #define MUSL_DYNAMIC_LINKER \
    "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"

+#ifndef GNU_USER_DYNAMIC_LINKER
+#define GNU_USER_DYNAMIC_LINKER ""
+#endif
  #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
    %{rdynamic:-export-dynamic} \
    -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-12 20:33 [patch] Fix bootstrap for non linux powerpc targets Andreas Tobler
@ 2018-12-16 18:46 ` Andreas Tobler
  2018-12-17  0:10   ` Alan Modra
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Tobler @ 2018-12-16 18:46 UTC (permalink / raw)
  To: GCC Patches, Segher Boessenkool

On 12.12.18 21:32, Andreas Tobler wrote:

> this patch fixes bootstrap for my powerpc*-unknown-freebsd* targets.
> The definition of GNU_USER_DYNAMIC_LINKER was recently moved to linux.h.
> 
> But the GNU_USER_DYNAMIC_LINKER is still used in rs6000/sysv4.h.
> So I add an empty definition with guard to cure the bootstrap issue.
> 
> Ok for trunk?

This is another attemtp to fix bootstrap on powerpc*-unknown-freebsd* only.

This one is only for FreeBSD and so I can approve and apply myself.

Objections?

TIA,
Andreas

2018-12-16  Andreas Tobler  <andreast@gcc.gnu.org>

	* config/rs6000/freebsd.h: Add an empty definition for
	GNU_USER_DYNAMIC_LINKER.
	* config/rs6000/freebsd64.h: Likewise.

Index: freebsd.h
===================================================================
--- freebsd.h	(revision 267190)
+++ freebsd.h	(working copy)
@@ -72,4 +72,8 @@
  /* Use standard DWARF numbering for DWARF debugging information.  */
  #define RS6000_USE_DWARF_NUMBERING

+#ifndef GNU_USER_DYNAMIC_LINKER
+#define GNU_USER_DYNAMIC_LINKER ""
+#endif
+
  #define POWERPC_FREEBSD
Index: freebsd64.h
===================================================================
--- freebsd64.h	(revision 267190)
+++ freebsd64.h	(working copy)
@@ -421,4 +421,8 @@
  #define USE_LD_AS_NEEDED 1
  #endif

+#ifndef GNU_USER_DYNAMIC_LINKER
+#define GNU_USER_DYNAMIC_LINKER ""
+#endif
+
  #define POWERPC_FREEBSD

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-16 18:46 ` [patch] Fix bootstrap powerpc*-*-freebsd* targets Andreas Tobler
@ 2018-12-17  0:10   ` Alan Modra
  2018-12-17 17:06     ` Segher Boessenkool
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Modra @ 2018-12-17  0:10 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: GCC Patches, Segher Boessenkool

On Sun, Dec 16, 2018 at 07:46:18PM +0100, Andreas Tobler wrote:
> On 12.12.18 21:32, Andreas Tobler wrote:
> 
> > this patch fixes bootstrap for my powerpc*-unknown-freebsd* targets.
> > The definition of GNU_USER_DYNAMIC_LINKER was recently moved to linux.h.

Sorry about the breakage.

> > But the GNU_USER_DYNAMIC_LINKER is still used in rs6000/sysv4.h.
> > So I add an empty definition with guard to cure the bootstrap issue.
> > 
> > Ok for trunk?
> 
> This is another attemtp to fix bootstrap on powerpc*-unknown-freebsd* only.
> 
> This one is only for FreeBSD and so I can approve and apply myself.
> 
> Objections?

It's not the best fix.  An empty string for something that is an
argument of -dynamic-linker will result in the linker eating the next
command line string for -dynamic-linker.  That will break -mcall-linux
on freebsd, if anyone should try to use that option.  (Chances are
that most of the -mcall options are broken anyway, but let's not break
them further.)

Since I broke powerpc*-freebsd and the other non-linux powerpc
targets, I guess I ought to fix them.  The following is a variation on
your first patch, that results in -mcall-linux for powerpc-freebsd*
providing the 32-bit powerpc-linux dynamic linker.

Tested with x86_64-linux to powerpc-linux, powerpc64le-linux and
powerpc-freebsd12.0 crosses, observing the effect of -muclibc, -mmusl
etc. on powerpc*-linux and -mcall-linux on powerpc-freebsd.  I'll also
do a full native powerpc64le-linux bootstrap and regression test.

	* config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Define.

diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 0d84f4f3f57..598da25269e 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -761,6 +761,10 @@ GNU_USER_TARGET_CC1_SPEC
 #define MUSL_DYNAMIC_LINKER \
   "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
 
+#ifndef GNU_USER_DYNAMIC_LINKER
+#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
+#endif
+
 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
   %{rdynamic:-export-dynamic} \
   -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-17  0:10   ` Alan Modra
@ 2018-12-17 17:06     ` Segher Boessenkool
  2018-12-18  0:09       ` Alan Modra
  0 siblings, 1 reply; 9+ messages in thread
From: Segher Boessenkool @ 2018-12-17 17:06 UTC (permalink / raw)
  To: Alan Modra; +Cc: Andreas Tobler, GCC Patches

Hi!

On Mon, Dec 17, 2018 at 10:40:01AM +1030, Alan Modra wrote:
> Since I broke powerpc*-freebsd and the other non-linux powerpc
> targets, I guess I ought to fix them.  The following is a variation on
> your first patch, that results in -mcall-linux for powerpc-freebsd*
> providing the 32-bit powerpc-linux dynamic linker.

That, like the first patch, abuses that header file.  Please do it
somewhere sane instead, not in a random subtarget file?


Segher


> 	* config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Define.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-17 17:06     ` Segher Boessenkool
@ 2018-12-18  0:09       ` Alan Modra
  2018-12-18  9:20         ` Segher Boessenkool
  2018-12-19  8:36         ` Segher Boessenkool
  0 siblings, 2 replies; 9+ messages in thread
From: Alan Modra @ 2018-12-18  0:09 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Andreas Tobler, GCC Patches

On Mon, Dec 17, 2018 at 11:05:57AM -0600, Segher Boessenkool wrote:
> Hi!
> 
> On Mon, Dec 17, 2018 at 10:40:01AM +1030, Alan Modra wrote:
> > Since I broke powerpc*-freebsd and the other non-linux powerpc
> > targets, I guess I ought to fix them.  The following is a variation on
> > your first patch, that results in -mcall-linux for powerpc-freebsd*
> > providing the 32-bit powerpc-linux dynamic linker.
> 
> That, like the first patch, abuses that header file.  Please do it
> somewhere sane instead, not in a random subtarget file?

Is there is a better place, currently?  sysv4.h contains a mess of OS
related defines already, to support various -mcall options.  If those
stay in sysv4.h I can't see a better place for the fall-back
GNU_USER_DYNAMIC_LINKER define.

Here's the problem:
powerpc*-*-linux* uses tm_file="rs6000/rs6000.h dbxelf.h elfos.h
gnu-user.h linux.h freebsd-spec.h rs6000/sysv4.h" plus a few more.
linux.h contains the proper GNU_USER_DYNAMIC_LINKER define for linux.
Fairly obviously we can't put a fallback define in rs6000/rs6000.h
for those targets that don't include linux.h (and including linux.h
for non-linux targets is probably not a good idea).

Besides rs6000/sysv4.h, you could put the fallback in rs6000/freebsd.h
to fix powerpc*-freebsd*, but then you'd need to put it in
rs6000/netbsd.h, rs6000/eabi.h, rs6000/rtems.h, rs6000/vxworks.h,
rs6000/lynx.h to fix those targets.  That would be horrible.  And it
would leave powerpc-elf broken.

> 
> > 	* config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Define.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-18  0:09       ` Alan Modra
@ 2018-12-18  9:20         ` Segher Boessenkool
  2018-12-18 12:49           ` Alan Modra
  2018-12-19  8:36         ` Segher Boessenkool
  1 sibling, 1 reply; 9+ messages in thread
From: Segher Boessenkool @ 2018-12-18  9:20 UTC (permalink / raw)
  To: Alan Modra; +Cc: Andreas Tobler, GCC Patches

Hi Alan,

On Tue, Dec 18, 2018 at 10:39:27AM +1030, Alan Modra wrote:
> On Mon, Dec 17, 2018 at 11:05:57AM -0600, Segher Boessenkool wrote:
> > On Mon, Dec 17, 2018 at 10:40:01AM +1030, Alan Modra wrote:
> > > Since I broke powerpc*-freebsd and the other non-linux powerpc
> > > targets, I guess I ought to fix them.  The following is a variation on
> > > your first patch, that results in -mcall-linux for powerpc-freebsd*
> > > providing the 32-bit powerpc-linux dynamic linker.
> > 
> > That, like the first patch, abuses that header file.  Please do it
> > somewhere sane instead, not in a random subtarget file?
> 
> Is there is a better place, currently?  sysv4.h contains a mess of OS
> related defines already, to support various -mcall options.  If those
> stay in sysv4.h I can't see a better place for the fall-back
> GNU_USER_DYNAMIC_LINKER define.

I was hoping you would untangle it a bit.  My dastardly plan failed,
apparently.  Drat.

Should anything use GNU_USER_DYNAMIC_LINKER if it isn't defined?  Maybe
it is better if the use in sysv4.h had an #ifdef around it?  For all the
other uses it should be always defined.

Or maybe we should have a linux32.h as well?


Segher

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-18  9:20         ` Segher Boessenkool
@ 2018-12-18 12:49           ` Alan Modra
  2018-12-18 16:14             ` Segher Boessenkool
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Modra @ 2018-12-18 12:49 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Andreas Tobler, GCC Patches

On Tue, Dec 18, 2018 at 03:20:02AM -0600, Segher Boessenkool wrote:
> Hi Alan,
> 
> On Tue, Dec 18, 2018 at 10:39:27AM +1030, Alan Modra wrote:
> > On Mon, Dec 17, 2018 at 11:05:57AM -0600, Segher Boessenkool wrote:
> > > On Mon, Dec 17, 2018 at 10:40:01AM +1030, Alan Modra wrote:
> > > > Since I broke powerpc*-freebsd and the other non-linux powerpc
> > > > targets, I guess I ought to fix them.  The following is a variation on
> > > > your first patch, that results in -mcall-linux for powerpc-freebsd*
> > > > providing the 32-bit powerpc-linux dynamic linker.
> > > 
> > > That, like the first patch, abuses that header file.  Please do it
> > > somewhere sane instead, not in a random subtarget file?
> > 
> > Is there is a better place, currently?  sysv4.h contains a mess of OS
> > related defines already, to support various -mcall options.  If those
> > stay in sysv4.h I can't see a better place for the fall-back
> > GNU_USER_DYNAMIC_LINKER define.
> 
> I was hoping you would untangle it a bit.  My dastardly plan failed,
> apparently.  Drat.

Me untangling some of the linux bits was what caused the problem..

I think that -mcall-linux, -mcall-freebsd, -mcall-netbsd and
-mcall-openbsd should be deprecated.  That would make it possible to
put the OS specific defines where they belong.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-18 12:49           ` Alan Modra
@ 2018-12-18 16:14             ` Segher Boessenkool
  0 siblings, 0 replies; 9+ messages in thread
From: Segher Boessenkool @ 2018-12-18 16:14 UTC (permalink / raw)
  To: Alan Modra; +Cc: Andreas Tobler, GCC Patches

On Tue, Dec 18, 2018 at 11:18:03PM +1030, Alan Modra wrote:
> On Tue, Dec 18, 2018 at 03:20:02AM -0600, Segher Boessenkool wrote:
> > Hi Alan,
> > 
> > On Tue, Dec 18, 2018 at 10:39:27AM +1030, Alan Modra wrote:
> > > On Mon, Dec 17, 2018 at 11:05:57AM -0600, Segher Boessenkool wrote:
> > > > On Mon, Dec 17, 2018 at 10:40:01AM +1030, Alan Modra wrote:
> > > > > Since I broke powerpc*-freebsd and the other non-linux powerpc
> > > > > targets, I guess I ought to fix them.  The following is a variation on
> > > > > your first patch, that results in -mcall-linux for powerpc-freebsd*
> > > > > providing the 32-bit powerpc-linux dynamic linker.
> > > > 
> > > > That, like the first patch, abuses that header file.  Please do it
> > > > somewhere sane instead, not in a random subtarget file?
> > > 
> > > Is there is a better place, currently?  sysv4.h contains a mess of OS
> > > related defines already, to support various -mcall options.  If those
> > > stay in sysv4.h I can't see a better place for the fall-back
> > > GNU_USER_DYNAMIC_LINKER define.
> > 
> > I was hoping you would untangle it a bit.  My dastardly plan failed,
> > apparently.  Drat.
> 
> Me untangling some of the linux bits was what caused the problem..
> 
> I think that -mcall-linux, -mcall-freebsd, -mcall-netbsd and
> -mcall-openbsd should be deprecated.  That would make it possible to
> put the OS specific defines where they belong.

Does anyone still use those options?  A patch to remove them is welcome.


Segher

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] Fix bootstrap powerpc*-*-freebsd* targets
  2018-12-18  0:09       ` Alan Modra
  2018-12-18  9:20         ` Segher Boessenkool
@ 2018-12-19  8:36         ` Segher Boessenkool
  1 sibling, 0 replies; 9+ messages in thread
From: Segher Boessenkool @ 2018-12-19  8:36 UTC (permalink / raw)
  To: Alan Modra; +Cc: Andreas Tobler, GCC Patches

On Tue, Dec 18, 2018 at 10:39:27AM +1030, Alan Modra wrote:
> On Mon, Dec 17, 2018 at 11:05:57AM -0600, Segher Boessenkool wrote:
> > Hi!
> > 
> > On Mon, Dec 17, 2018 at 10:40:01AM +1030, Alan Modra wrote:
> > > Since I broke powerpc*-freebsd and the other non-linux powerpc
> > > targets, I guess I ought to fix them.  The following is a variation on
> > > your first patch, that results in -mcall-linux for powerpc-freebsd*
> > > providing the 32-bit powerpc-linux dynamic linker.
> > 
> > That, like the first patch, abuses that header file.  Please do it
> > somewhere sane instead, not in a random subtarget file?
> 
> Is there is a better place, currently?  sysv4.h contains a mess of OS
> related defines already, to support various -mcall options.  If those
> stay in sysv4.h I can't see a better place for the fall-back
> GNU_USER_DYNAMIC_LINKER define.
> 
> Here's the problem:
> powerpc*-*-linux* uses tm_file="rs6000/rs6000.h dbxelf.h elfos.h
> gnu-user.h linux.h freebsd-spec.h rs6000/sysv4.h" plus a few more.
> linux.h contains the proper GNU_USER_DYNAMIC_LINKER define for linux.
> Fairly obviously we can't put a fallback define in rs6000/rs6000.h
> for those targets that don't include linux.h (and including linux.h
> for non-linux targets is probably not a good idea).
> 
> Besides rs6000/sysv4.h, you could put the fallback in rs6000/freebsd.h
> to fix powerpc*-freebsd*, but then you'd need to put it in
> rs6000/netbsd.h, rs6000/eabi.h, rs6000/rtems.h, rs6000/vxworks.h,
> rs6000/lynx.h to fix those targets.  That would be horrible.  And it
> would leave powerpc-elf broken.
> 
> > 
> > > 	* config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Define.

The patch is okay for now, btw.  Thanks!


Segher

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-12-19  8:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12 20:33 [patch] Fix bootstrap for non linux powerpc targets Andreas Tobler
2018-12-16 18:46 ` [patch] Fix bootstrap powerpc*-*-freebsd* targets Andreas Tobler
2018-12-17  0:10   ` Alan Modra
2018-12-17 17:06     ` Segher Boessenkool
2018-12-18  0:09       ` Alan Modra
2018-12-18  9:20         ` Segher Boessenkool
2018-12-18 12:49           ` Alan Modra
2018-12-18 16:14             ` Segher Boessenkool
2018-12-19  8:36         ` Segher Boessenkool

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).