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

Reply via email to