Message ID | b8cac7ab-14c7-1fa8-b658-4e7e246edbf5@fgznet.ch |
---|---|
State | New |
Headers | show |
Series | Fix bootstrap for non linux powerpc targets | expand |
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
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 "}}"
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.
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.
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
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.
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
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
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 "}}"