Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-03-09 Thread Mike Stump
On Mar 8, 2015, at 10:38 AM, Iain Sandoe i...@codesourcery.com wrote:
 +Ian
 + ping

So, all the darwinness of the patch looks fine to me.  One maintainer down, 
just need libiberty approval.

If the work becomes too bothersome, the comment out the line and say, # does’t 
work with libcc1 approach for the config fragment I’ll pre-approve if you want 
to punt at any point.

Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-03-08 Thread Iain Sandoe
+Ian
+ ping

On 11 Feb 2015, at 14:37, Iain Sandoe wrote:

 Hi Jeff,
 
 On 9 Feb 2015, at 14:47, Jeff Law l...@redhat.com wrote:
 
 On 02/01/15 09:42, Iain Sandoe wrote:
 
 This is a GCC5 bootstrap regression on 32bit Darwin hosts ( I can raise a 
 PR if that is considered necessary).
 Has this been addressed or is it still pending?
 
 I believe it's still awaiting review

Dominque has raised PR65351 to track this.
(i can rebase the patch if needed, it's being regularly tested on trunk)

thanks, 
Iain

 
 
 
 
 In fact it is not libcc1, but libiberty that is the cause -
 
 On 26 Jan 2015, at 14:13, Rainer Orth wrote:
 
 FX fxcoud...@gmail.com writes:
 
 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB
 -fPIC _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.
 
 config/mh-darwin says that -mdynamic-no-pic is there because it “speeds
 compiles by 3-5%”. I don’t think we care about speed when the bootstrap
 fails, so can we remove it altogether?
 
 Darwin/i686 still doesn't bootstrap without this patch, I believe.
 Shouldn't it be applied to trunk before GCC 5 ships, rather than leaving
 that target broken?
 
 The PIC variant of libiberty, has never (since it was added, AFAICT) 
 catered for the possibility that non-PIC and PIC options might conflict 
 (and/or that it might not be possible to override non-PIC options simply by 
 appending PIC ones).
 
 This has gone un-noticed until the libcc1 plugin started linking with the 
 pic version of libiberty.
 
 Darwin uses -mdynamic-no-pic as a default flag during bootstrap for 32bit 
 targets, since that gives a stated ~ 3-5% improvement in performance.
 
 It is not possible to override this non-pic option by appending -fPIC (that 
 simply results in a warning that mdynamic-no-pic takes precedence).
 
 I'd rather not pretend that there's no problem and simply penalise 
 performance on m32 darwin by removing the option from the bootflags.
 
 So here's a patch that allows a target to declare incompatible non-pic 
 options (in the same way that we have PIC options already declared as 
 distinct).
 
 The patch is largely mechanical (each of the targets adjusted to use the 
 NONPIC flag for the relevant case).
 
 As an aside, is there a portability reason that we don't make this repeated 
 operation into a make function?
 
 bootstapped on x86_64-linux, x86_64-darwin12, i686-darwin10, 
 powerpc-darwin9,
 cross-compiled x86-64-darwin12 X i686-darwin10 , native X i686-darwin10 
 (x86_64-darwin12 build).
 
 all languages including Ada (note that there's a local patch needed to 
 work-around an Ada bootstrap issue - pr64349)
 
 OK for trunk?
 Iain
 
 libiberty:
 * Makefile.in (NONPICFLAG, NEWCFLAGS, NEWCPPFLAGS): New.
 (COMPILE.c): Adjust to use new flags. (all non-pic targets):
 Adjust to use NONPIC flag.
 * configure.ac (NOPICFLAG): New.
 * configure: Regenerate.
 
 
 
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index f06cc69..8674b4a 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -62,6 +62,7 @@ MAKEINFO = @MAKEINFO@
 PERL = @PERL@
 
 PICFLAG = @PICFLAG@
+NOPICFLAG = @NOPICFLAG@
 NOASANFLAG = @NOASANFLAG@
 
 MAKEOVERRIDES =
@@ -113,7 +114,16 @@ installcheck: installcheck-subdir
 
 INCDIR=$(srcdir)/$(MULTISRCTOP)../include
 
-COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) $(HDEFINES) 
@ac_libiberty_warn_cflags@
+# If the passed CFLAGS or CPPFLAGS include options which are incompatible
+# with PIC code (and cannot be overridden) save them for non-pic code...
+NONPIC = $(filter $(NOPICFLAG), $(CFLAGS))
+NONPIC += $(filter $(NOPICFLAG), $(CPPFLAGS))
+# ... and then remove them from the default.
+NEWCFLAGS = $(filter-out $(NOPICFLAG), $(CFLAGS))
+NEWCPPFLAGS = $(filter-out $(NOPICFLAG), $(CPPFLAGS))
+
+COMPILE.c = $(CC) -c @DEFS@ $(NEWCFLAGS) $(NEWCPPFLAGS) -I. -I$(INCDIR) \
+$(HDEFINES) @ac_libiberty_warn_cflags@
 
 # Just to make sure we don't use a built-in rule with VPATH
 .c.$(objext):
@@ -519,7 +529,7 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
if [ x$(NOASANFLAG) != x ]; then \
  $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/_doprnt.c -o 
noasan/$@; \
else true; fi
-   $(COMPILE.c) $(srcdir)/_doprnt.c $(OUTPUT_OPTION)
+   $(COMPILE.c) $(NONPIC) $(srcdir)/_doprnt.c $(OUTPUT_OPTION)
 
 ./alloca.$(objext): $(srcdir)/alloca.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
@@ -529,7 +539,7 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
if [ x$(NOASANFLAG) != x ]; then \
  $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/alloca.c -o 
noasan/$@; \
else true; fi
-   $(COMPILE.c) $(srcdir)/alloca.c $(OUTPUT_OPTION)
+   $(COMPILE.c) $(NONPIC) $(srcdir)/alloca.c $(OUTPUT_OPTION)
 
 ./argv.$(objext): $(srcdir)/argv.c config.h 

Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-03-08 Thread Ian Lance Taylor
Iain Sandoe i...@codesourcery.com writes:

 +Ian
 + ping

The patch is missing the change to maint-tool to generate the
rules at the bottom of libiberty/Makefile.in.

Right now the libiberty Makefile does not require GNU make, and it's not
clear to me that we want to push that dependency onto all projects that
use libiberty.  It looks feasible to change this patch to not require
GNU make, by using a shell expansion rather than a make expansion, and I
think that would be the conservative thing to do.

 +# If the passed CFLAGS or CPPFLAGS include options which are incompatible
 +# with PIC code (and cannot be overridden) save them for non-pic code...

Is this a likely scenario?  Where would these options be coming from?

 +NONPIC = $(filter $(NOPICFLAG), $(CFLAGS))
 +NONPIC += $(filter $(NOPICFLAG), $(CPPFLAGS))

CPPFLAGS should precede CFLAGS.

Ian


 On 11 Feb 2015, at 14:37, Iain Sandoe wrote:

 Hi Jeff,
 
 On 9 Feb 2015, at 14:47, Jeff Law l...@redhat.com wrote:
 
 On 02/01/15 09:42, Iain Sandoe wrote:
 
 This is a GCC5 bootstrap regression on 32bit Darwin hosts ( I can
 raise a PR if that is considered necessary).
 Has this been addressed or is it still pending?
 
 I believe it's still awaiting review

 Dominque has raised PR65351 to track this.
 (i can rebase the patch if needed, it's being regularly tested on trunk)

 thanks, 
 Iain

 
 
 
 
 In fact it is not libcc1, but libiberty that is the cause -
 
 On 26 Jan 2015, at 14:13, Rainer Orth wrote:
 
 FX fxcoud...@gmail.com writes:
 
 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB
 -fPIC _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.
 
 config/mh-darwin says that -mdynamic-no-pic is there because it “speeds
 compiles by 3-5%”. I don’t think we care about speed when the bootstrap
 fails, so can we remove it altogether?
 
 Darwin/i686 still doesn't bootstrap without this patch, I believe.
 Shouldn't it be applied to trunk before GCC 5 ships, rather than leaving
 that target broken?
 
 The PIC variant of libiberty, has never (since it was added,
 AFAICT) catered for the possibility that non-PIC and PIC options
 might conflict (and/or that it might not be possible to override
 non-PIC options simply by appending PIC ones).
 
 This has gone un-noticed until the libcc1 plugin started linking
 with the pic version of libiberty.
 
 Darwin uses -mdynamic-no-pic as a default flag during bootstrap
 for 32bit targets, since that gives a stated ~ 3-5% improvement in
 performance.
 
 It is not possible to override this non-pic option by appending
 -fPIC (that simply results in a warning that mdynamic-no-pic takes
 precedence).
 
 I'd rather not pretend that there's no problem and simply penalise
 performance on m32 darwin by removing the option from the
 bootflags.
 
 So here's a patch that allows a target to declare incompatible
 non-pic options (in the same way that we have PIC options already
 declared as distinct).
 
 The patch is largely mechanical (each of the targets adjusted to
 use the NONPIC flag for the relevant case).
 
 As an aside, is there a portability reason that we don't make this
 repeated operation into a make function?
 
 bootstapped on x86_64-linux, x86_64-darwin12, i686-darwin10,
 powerpc-darwin9,
 cross-compiled x86-64-darwin12 X i686-darwin10 , native X
 i686-darwin10 (x86_64-darwin12 build).
 
 all languages including Ada (note that there's a local patch
 needed to work-around an Ada bootstrap issue - pr64349)
 
 OK for trunk?
 Iain
 
 libiberty:
* Makefile.in (NONPICFLAG, NEWCFLAGS, NEWCPPFLAGS): New.
(COMPILE.c): Adjust to use new flags. (all non-pic targets):
Adjust to use NONPIC flag.
* configure.ac (NOPICFLAG): New.
* configure: Regenerate.
 
 
 

 diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
 index f06cc69..8674b4a 100644
 --- a/libiberty/Makefile.in
 +++ b/libiberty/Makefile.in
 @@ -62,6 +62,7 @@ MAKEINFO = @MAKEINFO@
  PERL = @PERL@
  
  PICFLAG = @PICFLAG@
 +NOPICFLAG = @NOPICFLAG@
  NOASANFLAG = @NOASANFLAG@
  
  MAKEOVERRIDES =
 @@ -113,7 +114,16 @@ installcheck: installcheck-subdir
  
  INCDIR=$(srcdir)/$(MULTISRCTOP)../include
  
 -COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) 
 $(HDEFINES) @ac_libiberty_warn_cflags@
 +# If the passed CFLAGS or CPPFLAGS include options which are incompatible
 +# with PIC code (and cannot be overridden) save them for non-pic code...
 +NONPIC = $(filter $(NOPICFLAG), $(CFLAGS))
 +NONPIC += $(filter $(NOPICFLAG), $(CPPFLAGS))
 +# ... and then remove them from the default.
 +NEWCFLAGS = $(filter-out $(NOPICFLAG), $(CFLAGS))
 +NEWCPPFLAGS = $(filter-out $(NOPICFLAG), $(CPPFLAGS))
 +
 +COMPILE.c = $(CC) -c @DEFS@ $(NEWCFLAGS) $(NEWCPPFLAGS) -I. -I$(INCDIR) \
 +$(HDEFINES) @ac_libiberty_warn_cflags@
  
  # Just to make sure we don't use a built-in rule with VPATH
  

Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-02-11 Thread Iain Sandoe
Hi Jeff,

On 9 Feb 2015, at 14:47, Jeff Law l...@redhat.com wrote:

 On 02/01/15 09:42, Iain Sandoe wrote:
 
 This is a GCC5 bootstrap regression on 32bit Darwin hosts ( I can raise a PR 
 if that is considered necessary).
 Has this been addressed or is it still pending?

I believe it's still awaiting review - I'm travelling this week, so limited 
access to resources - but will be able to tackle any comments at the weekend.
thanks
Iain

 
 
 
 In fact it is not libcc1, but libiberty that is the cause -
 
 On 26 Jan 2015, at 14:13, Rainer Orth wrote:
 
 FX fxcoud...@gmail.com writes:
 
 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB
 -fPIC _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.
 
 config/mh-darwin says that -mdynamic-no-pic is there because it “speeds
 compiles by 3-5%”. I don’t think we care about speed when the bootstrap
 fails, so can we remove it altogether?
 
 Darwin/i686 still doesn't bootstrap without this patch, I believe.
 Shouldn't it be applied to trunk before GCC 5 ships, rather than leaving
 that target broken?
 
 The PIC variant of libiberty, has never (since it was added, AFAICT) catered 
 for the possibility that non-PIC and PIC options might conflict (and/or that 
 it might not be possible to override non-PIC options simply by appending PIC 
 ones).
 
 This has gone un-noticed until the libcc1 plugin started linking with the 
 pic version of libiberty.
 
 Darwin uses -mdynamic-no-pic as a default flag during bootstrap for 32bit 
 targets, since that gives a stated ~ 3-5% improvement in performance.
 
 It is not possible to override this non-pic option by appending -fPIC (that 
 simply results in a warning that mdynamic-no-pic takes precedence).
 
 I'd rather not pretend that there's no problem and simply penalise 
 performance on m32 darwin by removing the option from the bootflags.
 
 So here's a patch that allows a target to declare incompatible non-pic 
 options (in the same way that we have PIC options already declared as 
 distinct).
 
 The patch is largely mechanical (each of the targets adjusted to use the 
 NONPIC flag for the relevant case).
 
 As an aside, is there a portability reason that we don't make this repeated 
 operation into a make function?
 
 bootstapped on x86_64-linux, x86_64-darwin12, i686-darwin10, powerpc-darwin9,
 cross-compiled x86-64-darwin12 X i686-darwin10 , native X i686-darwin10 
 (x86_64-darwin12 build).
 
 all languages including Ada (note that there's a local patch needed to 
 work-around an Ada bootstrap issue - pr64349)
 
 OK for trunk?
 Iain
 
 libiberty:
  * Makefile.in (NONPICFLAG, NEWCFLAGS, NEWCPPFLAGS): New.
  (COMPILE.c): Adjust to use new flags. (all non-pic targets):
  Adjust to use NONPIC flag.
  * configure.ac (NOPICFLAG): New.
  * configure: Regenerate.
 
 



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-02-09 Thread Jeff Law

On 02/01/15 09:42, Iain Sandoe wrote:


This is a GCC5 bootstrap regression on 32bit Darwin hosts ( I can raise a PR if 
that is considered necessary).

Has this been addressed or is it still pending?




In fact it is not libcc1, but libiberty that is the cause -

On 26 Jan 2015, at 14:13, Rainer Orth wrote:


FX fxcoud...@gmail.com writes:


The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
the libiberty pic build appends: -fno-common (and not even -fPIC) [NB
-fPIC _won't_ override -mdynamic-no-pic, so that's not a simple way out]
This means that the PIC library is being built with non-pic relocs.


config/mh-darwin says that -mdynamic-no-pic is there because it “speeds
compiles by 3-5%”. I don’t think we care about speed when the bootstrap
fails, so can we remove it altogether?


Darwin/i686 still doesn't bootstrap without this patch, I believe.
Shouldn't it be applied to trunk before GCC 5 ships, rather than leaving
that target broken?


The PIC variant of libiberty, has never (since it was added, AFAICT) catered 
for the possibility that non-PIC and PIC options might conflict (and/or that it 
might not be possible to override non-PIC options simply by appending PIC ones).

This has gone un-noticed until the libcc1 plugin started linking with the pic 
version of libiberty.

Darwin uses -mdynamic-no-pic as a default flag during bootstrap for 32bit 
targets, since that gives a stated ~ 3-5% improvement in performance.

It is not possible to override this non-pic option by appending -fPIC (that 
simply results in a warning that mdynamic-no-pic takes precedence).

I'd rather not pretend that there's no problem and simply penalise performance 
on m32 darwin by removing the option from the bootflags.

So here's a patch that allows a target to declare incompatible non-pic options 
(in the same way that we have PIC options already declared as distinct).

The patch is largely mechanical (each of the targets adjusted to use the NONPIC 
flag for the relevant case).

As an aside, is there a portability reason that we don't make this repeated 
operation into a make function?

bootstapped on x86_64-linux, x86_64-darwin12, i686-darwin10, powerpc-darwin9,
cross-compiled x86-64-darwin12 X i686-darwin10 , native X i686-darwin10 
(x86_64-darwin12 build).

all languages including Ada (note that there's a local patch needed to 
work-around an Ada bootstrap issue - pr64349)

OK for trunk?
Iain

libiberty:
* Makefile.in (NONPICFLAG, NEWCFLAGS, NEWCPPFLAGS): New.
(COMPILE.c): Adjust to use new flags. (all non-pic targets):
Adjust to use NONPIC flag.
* configure.ac (NOPICFLAG): New.
* configure: Regenerate.





Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-02-01 Thread Iain Sandoe

This is a GCC5 bootstrap regression on 32bit Darwin hosts ( I can raise a PR if 
that is considered necessary).

In fact it is not libcc1, but libiberty that is the cause - 

On 26 Jan 2015, at 14:13, Rainer Orth wrote:

 FX fxcoud...@gmail.com writes:
 
 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB
 -fPIC _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.
 
 config/mh-darwin says that -mdynamic-no-pic is there because it “speeds
 compiles by 3-5%”. I don’t think we care about speed when the bootstrap
 fails, so can we remove it altogether?
 
 Darwin/i686 still doesn't bootstrap without this patch, I believe.
 Shouldn't it be applied to trunk before GCC 5 ships, rather than leaving
 that target broken?

The PIC variant of libiberty, has never (since it was added, AFAICT) catered 
for the possibility that non-PIC and PIC options might conflict (and/or that it 
might not be possible to override non-PIC options simply by appending PIC ones).

This has gone un-noticed until the libcc1 plugin started linking with the pic 
version of libiberty.

Darwin uses -mdynamic-no-pic as a default flag during bootstrap for 32bit 
targets, since that gives a stated ~ 3-5% improvement in performance.

It is not possible to override this non-pic option by appending -fPIC (that 
simply results in a warning that mdynamic-no-pic takes precedence).

I'd rather not pretend that there's no problem and simply penalise performance 
on m32 darwin by removing the option from the bootflags.

So here's a patch that allows a target to declare incompatible non-pic options 
(in the same way that we have PIC options already declared as distinct).

The patch is largely mechanical (each of the targets adjusted to use the NONPIC 
flag for the relevant case).

As an aside, is there a portability reason that we don't make this repeated 
operation into a make function?

bootstapped on x86_64-linux, x86_64-darwin12, i686-darwin10, powerpc-darwin9,
cross-compiled x86-64-darwin12 X i686-darwin10 , native X i686-darwin10 
(x86_64-darwin12 build).

all languages including Ada (note that there's a local patch needed to 
work-around an Ada bootstrap issue - pr64349)

OK for trunk?
Iain

libiberty:
* Makefile.in (NONPICFLAG, NEWCFLAGS, NEWCPPFLAGS): New.
(COMPILE.c): Adjust to use new flags. (all non-pic targets):
Adjust to use NONPIC flag.
* configure.ac (NOPICFLAG): New.
* configure: Regenerate.

diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index f06cc69..8674b4a 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -62,6 +62,7 @@ MAKEINFO = @MAKEINFO@
 PERL = @PERL@
 
 PICFLAG = @PICFLAG@
+NOPICFLAG = @NOPICFLAG@
 NOASANFLAG = @NOASANFLAG@
 
 MAKEOVERRIDES =
@@ -113,7 +114,16 @@ installcheck: installcheck-subdir
 
 INCDIR=$(srcdir)/$(MULTISRCTOP)../include
 
-COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) $(HDEFINES) 
@ac_libiberty_warn_cflags@
+# If the passed CFLAGS or CPPFLAGS include options which are incompatible
+# with PIC code (and cannot be overridden) save them for non-pic code...
+NONPIC = $(filter $(NOPICFLAG), $(CFLAGS))
+NONPIC += $(filter $(NOPICFLAG), $(CPPFLAGS))
+# ... and then remove them from the default.
+NEWCFLAGS = $(filter-out $(NOPICFLAG), $(CFLAGS))
+NEWCPPFLAGS = $(filter-out $(NOPICFLAG), $(CPPFLAGS))
+
+COMPILE.c = $(CC) -c @DEFS@ $(NEWCFLAGS) $(NEWCPPFLAGS) -I. -I$(INCDIR) \
+$(HDEFINES) @ac_libiberty_warn_cflags@
 
 # Just to make sure we don't use a built-in rule with VPATH
 .c.$(objext):
@@ -519,7 +529,7 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
if [ x$(NOASANFLAG) != x ]; then \
  $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/_doprnt.c -o 
noasan/$@; \
else true; fi
-   $(COMPILE.c) $(srcdir)/_doprnt.c $(OUTPUT_OPTION)
+   $(COMPILE.c) $(NONPIC) $(srcdir)/_doprnt.c $(OUTPUT_OPTION)
 
 ./alloca.$(objext): $(srcdir)/alloca.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h
@@ -529,7 +539,7 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
if [ x$(NOASANFLAG) != x ]; then \
  $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/alloca.c -o 
noasan/$@; \
else true; fi
-   $(COMPILE.c) $(srcdir)/alloca.c $(OUTPUT_OPTION)
+   $(COMPILE.c) $(NONPIC) $(srcdir)/alloca.c $(OUTPUT_OPTION)
 
 ./argv.$(objext): $(srcdir)/argv.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
@@ -539,7 +549,7 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
if [ x$(NOASANFLAG) != x ]; then \
  $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/argv.c -o noasan/$@; \
else true; fi
-   $(COMPILE.c) $(srcdir)/argv.c $(OUTPUT_OPTION)
+   $(COMPILE.c) $(NONPIC) $(srcdir)/argv.c $(OUTPUT_OPTION)
 
 ./asprintf.$(objext): 

Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-01-26 Thread Rainer Orth
FX fxcoud...@gmail.com writes:

 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB
 -fPIC _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.

 config/mh-darwin says that -mdynamic-no-pic is there because it “speeds
 compiles by 3-5%”. I don’t think we care about speed when the bootstrap
 fails, so can we remove it altogether?

Darwin/i686 still doesn't bootstrap without this patch, I believe.
Shouldn't it be applied to trunk before GCC 5 ships, rather than leaving
that target broken?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2015-01-26 Thread Iain Sandoe

On 26 Jan 2015, at 14:13, Rainer Orth wrote:

 FX fxcoud...@gmail.com writes:
 
 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB
 -fPIC _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.
 
 config/mh-darwin says that -mdynamic-no-pic is there because it “speeds
 compiles by 3-5%”. I don’t think we care about speed when the bootstrap
 fails, so can we remove it altogether?
 
 Darwin/i686 still doesn't bootstrap without this patch, I believe.
 Shouldn't it be applied to trunk before GCC 5 ships, rather than leaving
 that target broken?

I'll try and post a patch to fix it properly this week..
Iain



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-13 Thread Paolo Bonzini


On 05/12/2014 23:47, Jakub Jelinek wrote:
 On Fri, Dec 05, 2014 at 11:34:28PM +0100, Dominique Dhumieres wrote:
 As I've tried to explain, that is IMHO wrong though.
 If what you are after is the -B stuff too, then perhaps:
 ...

 Sorry but it does not work:
 
 Sorry, make that (just removed 4x ' in each file):
 
 2014-12-05  Jakub Jelinek  ja...@redhat.com
 
   PR bootstrap/64023
   * Makefile.tpl (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS
   to POSTSTAGE1_LDFLAGS and STAGE1_LIBS to POSTSTAGE1_LIBS.
   Add -B to libstdc++-v3/src/.libs and libstdc++-v3/libsupc++/.libs
   to CXX.
   * Makefile.in: Regenerated.
 
 --- Makefile.tpl.jj   2014-11-12 09:31:59.0 +0100
 +++ Makefile.tpl  2014-12-05 21:12:21.486031062 +0100
 @@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \
   'AS=$(COMPILER_AS_FOR_TARGET)' \
   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
 - 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 + 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
 +  -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
 +  $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 @@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \
   'WINDRES=$$(WINDRES_FOR_TARGET)' \
   'WINDMC=$$(WINDMC_FOR_TARGET)' \
   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
 + 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
 + 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
   TFLAGS=$$TFLAGS
  
  TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
 --- Makefile.in.jj2014-11-28 14:40:52.0 +0100
 +++ Makefile.in   2014-12-05 21:11:48.276616008 +0100
 @@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \
   'AS=$(COMPILER_AS_FOR_TARGET)' \
   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
 - 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 + 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
 +  -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
 +  $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 @@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \
   'WINDRES=$$(WINDRES_FOR_TARGET)' \
   'WINDMC=$$(WINDMC_FOR_TARGET)' \
   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
 + 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
 + 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
   TFLAGS=$$TFLAGS
  
  TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
 
   Jakub
 

If it also works for --disable-bootstrap, this is okay.

Paolo



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-09 Thread Dominique d'Humières
This was for x86_64-apple-darwin14. The patch also works for 
x86_64-apple-darwin10.

Dominique

 Le 6 déc. 2014 à 01:49, Dominique d'Humières domi...@lps.ens.fr a écrit :
 
 Bootstrap just finished with the patch.
 
 Thanks,
 
 Dominique



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-06 Thread Iain Sandoe
Hi Jeff,

On 5 Dec 2014, at 22:40, Jeff Law wrote:

 On 12/05/14 15:34, Dominique Dhumieres wrote:
 As I've tried to explain, that is IMHO wrong though.
 If what you are after is the -B stuff too, then perhaps:
 ...
 
 Sorry but it does not work:
 BTW, thanks for working with Jakub on this.  We're going to be getting a 
 Darwin box for Jakub and other folks in the Red Hat team to use when the need 
 arises to dig into these kind of issues.

That will be most welcome, we Darwin folks have only volunteer cycles to work 
on stuff, and those tend to get used up really quickly.

Iain



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Jakub Jelinek
On Mon, Nov 24, 2014 at 01:06:45AM +0100, FX wrote:
 tl;dr: One question to build maintainers, and one patch submitted to toplevel 
 configure.ac
 
 ---
 
 I’m looked into the issue some more, and am comparing two builds of trunk 
 (exact same source), one configured with system compiler (clang) in PATH, the 
 other with GCC 4.9.2 in PATH.
 At the toplevel configure, the only meaningful difference is that the 
 gcc-based build sets stage1_ldflags='-static-libstdc++ -static-libgcc' while 
 the clang-based has stage1_ldflags='' (clang doesn’t recognized 
 -static-libstdc++).
 
 This is included into the toplevel Makefile as STAGE1_LDFLAGS (the comment 
 appropriately says Linker flags to use on the host, for stage1 or when not 
 bootstrapping”).
 Those are exported by HOST_EXPORTS, which is are then used by 
 configure-libcc1, all-libcc1, etc. Thus, we end up using STAGE1_LDFLAGS, 
 which correspond to the system compiler, instead of the stage3 compiler (as 
 we should).
 
 So, this is “false negative” part of the problem (namely, why we don’t see 
 the failure when bootstrapping with clang): we use STAGE1_LDFLAGS in building 
 libcc1, and with clang as system compiler we don’t use static linking of the 
 C++ library. This part, I don’t know how to fix: it is for the build experts 
 to address. It is a real problem: it leads to libcc1.so being linked 
 dynamically to libstdc++ and libgcc, instead of statically (as it should).
 
 ---
 
 Second part of the question: when the freshly built g++ is used, we need to 
 pass the appropriate -B options. As I understand it, the appropriate place 
 for that is in the toplevel configure.ac, where we already pass down the 
 respective -L options. Indeed, the attached patch restores bootstrap on 
 x86_64-apple-darwin14 with gcc as system compiler (and doesn’t break the 
 bootstrap with clang as system compiler).
 
 OK to commit?

Reading the toplevel Makefile and trying to understand how things work
for non-bootstrap vs. bootstrap host dirs that aren't bootstrapped,
I'd say the right fix should be something like following
(bootstrapping/regtesting it right now on x86_64-linux and i686-linux,
though it won't make much difference there, on x86_64-linux
STAGE1_LDFLAGS is equal to POSTSTAGE1_LDFLAGS and STAGE1_LIBS is equal
to POSTSTAGE1_LIBS.  On i686-linux there is at least a difference
for some reason (possibly related with my setarch and gcc -m32 wrappers
hacks to make i686-linux bootstrap work on x86_64-linux box) in
*STAGE1_LDFLAGS, only the POSTSTAGE1_LDFLAGS is -static-libstdc++ 
-static-libgcc.

From my reading, POSTSTAGE1_HOST_EXPORTS is clearly inappropriate for the
modules like libcc1, because it uses prev-gcc/, while we want to use gcc/,
but otherwise looking at the HOST_EXPORTS vs. POSTSTAGE1_HOST_EXPORTS
differences, LDFLAGS and HOST_LIBS is what needs changing.
For some reason POSTSTAGE1_HOST_EXPORTS sets LDFLAGS to 
$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)
(the first part is ok and clear, the latter differs from the HOST_EXPORTS
$(STAGE1_LDFLAGS) $(LDFLAGS).
With my patch below, one actually ends up with
$(POSTSTAGE1_LDFLAGS) $(LDFLAGS_FOR_TARGET)
for libcc1 when bootstrapping in LDFLAGS, while previously
$(STAGE1_LDFLAGS) $(LDFLAGS_FOR_TARGET)
was used.  STAGE1_L{DFLAGS,IBS} is only used in $(HOST_EXPORTS),
so at least in theory I think my patch should DTRT.

Can you please test it on Darwin (or whatever other target has similar
issues with bootstrapping libcc1)?

2014-12-05  Jakub Jelinek  ja...@redhat.com

PR bootstrap/64023
* Makefile.tpl (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS
to POSTSTAGE1_LDFLAGS and STAGE1_LIBS to POSTSTAGE1_LIBS.
* Makefile.in: Regenerated.

--- Makefile.tpl.jj 2014-11-12 09:31:59.0 +0100
+++ Makefile.tpl2014-12-05 17:14:16.115295667 +0100
@@ -659,6 +659,8 @@ EXTRA_TARGET_FLAGS = \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
'WINDMC=$$(WINDMC_FOR_TARGET)' \
'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
+   'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
+   'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
--- Makefile.in.jj  2014-11-28 14:40:52.0 +0100
+++ Makefile.in 2014-12-05 17:15:04.322439003 +0100
@@ -853,6 +853,8 @@ EXTRA_TARGET_FLAGS = \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
'WINDMC=$$(WINDMC_FOR_TARGET)' \
'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
+   'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
+   'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)


Jakub


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Dominique Dhumieres
 ...
 Can you please test it on Darwin (or whatever other target has similar
 issues with bootstrapping libcc1)?

 2014-12-05  Jakub Jelinek  ja...@redhat.com
 ...

The patch does not work for x86_64-apple-darwin14.0.0. However the following 
patch does:

--- ../_clean/Makefile.in   2014-11-26 23:09:14.0 +0100
+++ Makefile.in 2014-12-05 17:22:54.0 +0100
@@ -31389,7 +31389,7 @@ configure-libcc1: 
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
test ! -f $(HOST_SUBDIR)/libcc1/Makefile || exit 0; \
$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcc1 ; \
-   $(HOST_EXPORTS)  \
+   $(POSTSTAGE1_HOST_EXPORTS)  \
echo Configuring in $(HOST_SUBDIR)/libcc1; \
cd $(HOST_SUBDIR)/libcc1 || exit 1; \
case $(srcdir) in \
@@ -31422,7 +31422,7 @@ all-libcc1: configure-libcc1
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS)  \
+   $(POSTSTAGE1_HOST_EXPORTS)  \
(cd $(HOST_SUBDIR)/libcc1  \
  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
$(STAGE1_FLAGS_TO_PASS)  \
$(TARGET-libcc1))
@@ -31440,7 +31440,7 @@ check-libcc1:
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
(cd $(HOST_SUBDIR)/libcc1  \
  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -31455,7 +31455,7 @@ install-libcc1: installdirs
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
(cd $(HOST_SUBDIR)/libcc1  \
  $(MAKE) $(FLAGS_TO_PASS)  install)
 
@@ -31470,7 +31470,7 @@ install-strip-libcc1: installdirs
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
(cd $(HOST_SUBDIR)/libcc1  \
  $(MAKE) $(FLAGS_TO_PASS)  install-strip)
 
@@ -31489,7 +31489,7 @@ info-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
for flag in $(EXTRA_HOST_FLAGS) ; do \
  eval `echo $$flag | sed -e s|^\([^=]*\)=\(.*\)|\1='\2'; export 
\1|`; \
done; \
@@ -31515,7 +31515,7 @@ dvi-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
for flag in $(EXTRA_HOST_FLAGS) ; do \
  eval `echo $$flag | sed -e s|^\([^=]*\)=\(.*\)|\1='\2'; export 
\1|`; \
done; \
@@ -31541,7 +31541,7 @@ pdf-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
for flag in $(EXTRA_HOST_FLAGS) ; do \
  eval `echo $$flag | sed -e s|^\([^=]*\)=\(.*\)|\1='\2'; export 
\1|`; \
done; \
@@ -31567,7 +31567,7 @@ html-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
for flag in $(EXTRA_HOST_FLAGS) ; do \
  eval `echo $$flag | sed -e s|^\([^=]*\)=\(.*\)|\1='\2'; export 
\1|`; \
done; \
@@ -31593,7 +31593,7 @@ TAGS-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
for flag in $(EXTRA_HOST_FLAGS) ; do \
  eval `echo $$flag | sed -e s|^\([^=]*\)=\(.*\)|\1='\2'; export 
\1|`; \
done; \
@@ -31620,7 +31620,7 @@ install-info-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
for flag in $(EXTRA_HOST_FLAGS) ; do \
  eval `echo $$flag | sed -e s|^\([^=]*\)=\(.*\)|\1='\2'; export 
\1|`; \
done; \
@@ -31647,7 +31647,7 @@ install-pdf-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS) \
+   $(POSTSTAGE1_HOST_EXPORTS) \
for flag in $(EXTRA_HOST_FLAGS) ; do \
  eval `echo $$flag | sed -e s|^\([^=]*\)=\(.*\)|\1='\2'; export 
\1|`; \
done; \
@@ -31674,7 +31674,7 @@ install-html-libcc1: \
@[ -f ./libcc1/Makefile ] || exit 0; \

Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Jakub Jelinek
On Fri, Dec 05, 2014 at 08:11:53PM +0100, Dominique Dhumieres wrote:
  ...
  Can you please test it on Darwin (or whatever other target has similar
  issues with bootstrapping libcc1)?
 
  2014-12-05  Jakub Jelinek  ja...@redhat.com
  ...
 
 The patch does not work for x86_64-apple-darwin14.0.0. However the following 
 patch does:

As I've tried to explain, that is IMHO wrong though.
If what you are after is the -B stuff too, then perhaps:

2014-12-05  Jakub Jelinek  ja...@redhat.com

PR bootstrap/64023
* Makefile.tpl (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS
to POSTSTAGE1_LDFLAGS and STAGE1_LIBS to POSTSTAGE1_LIBS.
Add -B to libstdc++-v3/src/.libs and libstdc++-v3/libsupc++/.libs
to CXX.
* Makefile.in: Regenerated.

--- Makefile.tpl.jj 2014-11-12 09:31:59.0 +0100
+++ Makefile.tpl2014-12-05 21:12:21.486031062 +0100
@@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \
'AS=$(COMPILER_AS_FOR_TARGET)' \
'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
-   'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' 
\
+   ' -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs' \
+   ' $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
@@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
'WINDMC=$$(WINDMC_FOR_TARGET)' \
'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
+   'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
+   'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
--- Makefile.in.jj  2014-11-28 14:40:52.0 +0100
+++ Makefile.in 2014-12-05 21:11:48.276616008 +0100
@@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \
'AS=$(COMPILER_AS_FOR_TARGET)' \
'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
-   'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' 
\
+   ' -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs' \
+   ' $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
@@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
'WINDMC=$$(WINDMC_FOR_TARGET)' \
'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
+   'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
+   'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)


Jakub


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Dominique Dhumieres
 As I've tried to explain, that is IMHO wrong though.
 If what you are after is the -B stuff too, then perhaps:
 ...

Sorry but it does not work:

true  DO=all multi-do # make
make[4]: Leaving directory '/opt/gcc/build_w/libbacktrace'
make[3]: Leaving directory '/opt/gcc/build_w/libbacktrace'
make[3]: Entering directory '/opt/gcc/build_w/libcpp'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/opt/gcc/build_w/libcpp'
make[3]: Entering directory '/opt/gcc/build_w/libdecnumber'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/opt/gcc/build_w/libdecnumber'
make[3]: Entering directory '/opt/gcc/build_w/gcc'
make[3]: Leaving directory '/opt/gcc/build_w/gcc'
Checking multilib configuration for libgcc...
make[3]: Entering directory '/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libgcc'
make[3]: *** No rule to make target ' 
-B$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs'.  Stop.
make[3]: Leaving directory '/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libgcc'
Makefile:14905: recipe for target 'all-stage1-target-libgcc' failed
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory '/opt/gcc/build_w'
Makefile:21193: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/opt/gcc/build_w'
Makefile:910: recipe for target 'all' failed
make: *** [all] Error 2

Dominique


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Jeff Law

On 12/05/14 15:34, Dominique Dhumieres wrote:

As I've tried to explain, that is IMHO wrong though.
If what you are after is the -B stuff too, then perhaps:
...


Sorry but it does not work:
BTW, thanks for working with Jakub on this.  We're going to be getting a 
Darwin box for Jakub and other folks in the Red Hat team to use when the 
need arises to dig into these kind of issues.


However, until that box arrives and is setup, this kind of iteration is 
the only way he can test Darwin stuff.


Jeff



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Phil Muldoon
On 05/12/14 22:40, Jeff Law wrote:
 On 12/05/14 15:34, Dominique Dhumieres wrote:
 As I've tried to explain, that is IMHO wrong though.
 If what you are after is the -B stuff too, then perhaps:
 ...

 Sorry but it does not work:
 BTW, thanks for working with Jakub on this.  We're going to be getting a 
 Darwin box for Jakub and other folks in the Red Hat team to use when the need 
 arises to dig into these kind of issues.

 However, until that box arrives and is setup, this kind of iteration is the 
 only way he can test Darwin stuff.

 Jeff


Indeed I feel especially bad in these scenarios where patches are
suggested for a patch I submitted and are causing you folks problems.
I really do not want to do that.  So many architectures for GCC, so
very few resources.  Hopefully as Jeff indicates, this will be sorted
soon.  Again from a libcc1 point of view, as long as we have the .so
built on all configurations, that is what matters.  I have not chipped
into these threads as I have nothing to say/recommend about darwin
architectures :( I do read them all, though.

Cheers,

Phil



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Jakub Jelinek
On Fri, Dec 05, 2014 at 11:34:28PM +0100, Dominique Dhumieres wrote:
  As I've tried to explain, that is IMHO wrong though.
  If what you are after is the -B stuff too, then perhaps:
  ...
 
 Sorry but it does not work:

Sorry, make that (just removed 4x ' in each file):

2014-12-05  Jakub Jelinek  ja...@redhat.com

PR bootstrap/64023
* Makefile.tpl (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS
to POSTSTAGE1_LDFLAGS and STAGE1_LIBS to POSTSTAGE1_LIBS.
Add -B to libstdc++-v3/src/.libs and libstdc++-v3/libsupc++/.libs
to CXX.
* Makefile.in: Regenerated.

--- Makefile.tpl.jj 2014-11-12 09:31:59.0 +0100
+++ Makefile.tpl2014-12-05 21:12:21.486031062 +0100
@@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \
'AS=$(COMPILER_AS_FOR_TARGET)' \
'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
-   'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
+-B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
+$$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
@@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
'WINDMC=$$(WINDMC_FOR_TARGET)' \
'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
+   'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
+   'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
--- Makefile.in.jj  2014-11-28 14:40:52.0 +0100
+++ Makefile.in 2014-12-05 21:11:48.276616008 +0100
@@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \
'AS=$(COMPILER_AS_FOR_TARGET)' \
'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
-   'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
+-B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
+$$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
@@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
'WINDMC=$$(WINDMC_FOR_TARGET)' \
'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
+   'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
+   'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)

Jakub


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-05 Thread Dominique d'Humières
Bootstrap just finished with the patch.

Thanks,

Dominique

 Le 5 déc. 2014 à 23:47, Jakub Jelinek ja...@redhat.com a écrit :
 
 On Fri, Dec 05, 2014 at 11:34:28PM +0100, Dominique Dhumieres wrote:
 As I've tried to explain, that is IMHO wrong though.
 If what you are after is the -B stuff too, then perhaps:
 ...
 
 Sorry but it does not work:
 
 Sorry, make that (just removed 4x ' in each file):
 
 2014-12-05  Jakub Jelinek  ja...@redhat.com
 
   PR bootstrap/64023
   * Makefile.tpl (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS
   to POSTSTAGE1_LDFLAGS and STAGE1_LIBS to POSTSTAGE1_LIBS.
   Add -B to libstdc++-v3/src/.libs and libstdc++-v3/libsupc++/.libs
   to CXX.
   * Makefile.in: Regenerated.
 
 --- Makefile.tpl.jj   2014-11-12 09:31:59.0 +0100
 +++ Makefile.tpl  2014-12-05 21:12:21.486031062 +0100
 @@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \
   'AS=$(COMPILER_AS_FOR_TARGET)' \
   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
 - 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 + 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
 +  -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
 +  $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 @@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \
   'WINDRES=$$(WINDRES_FOR_TARGET)' \
   'WINDMC=$$(WINDMC_FOR_TARGET)' \
   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
 + 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
 + 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
   TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
 --- Makefile.in.jj2014-11-28 14:40:52.0 +0100
 +++ Makefile.in   2014-12-05 21:11:48.276616008 +0100
 @@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \
   'AS=$(COMPILER_AS_FOR_TARGET)' \
   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
 - 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 + 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
 +  -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
 +  $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 @@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \
   'WINDRES=$$(WINDRES_FOR_TARGET)' \
   'WINDMC=$$(WINDMC_FOR_TARGET)' \
   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
 + 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
 + 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
   TFLAGS=$$TFLAGS
 
 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
 
   Jakub



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread FX
10-days ping
This restores bootstrap on a secondary target, target maintainer is OK with it. 
I think I need build maintainers approval, so please review.


 when the freshly built g++ is used, we need to pass the appropriate -B 
 options. As I understand it, the appropriate place for that is in the 
 toplevel configure.ac, where we already pass down the respective -L options. 
 Indeed, the attached patch restores bootstrap on x86_64-apple-darwin14 with 
 gcc as system compiler (and doesn’t break the bootstrap with clang as system 
 compiler).
 
 OK to commit?
 
 FX
 
 
 
 PS: HJ, the reason only don’t see this on Linux is that only Darwin (AFAIK) 
 plays spec tricks with static-libstdc++ (in gcc/config/darwin.h)



libcc1.ChangeLog
Description: Binary data


libcc1.diff
Description: Binary data


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Rainer Orth
FX fxcoud...@gmail.com writes:

 10-days ping
 This restores bootstrap on a secondary target, target maintainer is OK with
 it. I think I need build maintainers approval, so please review.

While in my testing, 64-bit Mac OS X 10.10.1 (x86_64-apple-darwin14.0.0)
now bootstraps, but 32-bit (i386-apple-darwin14.0.0) does not:

ld: illegal text-relocation to 'anon' in ../libiberty/pic/libiberty.a(regex.o) 
from '_byte_common_op_match_null_string_p' in 
../libiberty/pic/libiberty.a(regex.o) for architecture i386
collect2: error: ld returned 1 exit status
make[3]: *** [libcc1.la] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-libcc1] Error 2

I couldn't find a corresponding reloc in otool -rv output, though.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread FX
 While in my testing, 64-bit Mac OS X 10.10.1 (x86_64-apple-darwin14.0.0)
 now bootstraps, but 32-bit (i386-apple-darwin14.0.0) does not:

Is it due to my patch, or pre-existing bootstrap failure?
How do you configure this 32-bit compiler? target/build/host/CFLAGS/CXXFLAGS/etc

FX

Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Iain Sandoe
Hi Rainer,

On 4 Dec 2014, at 13:32, Rainer Orth wrote:

 FX fxcoud...@gmail.com writes:
 
 10-days ping
 This restores bootstrap on a secondary target, target maintainer is OK with
 it. I think I need build maintainers approval, so please review.
 
 While in my testing, 64-bit Mac OS X 10.10.1 (x86_64-apple-darwin14.0.0)
 now bootstraps, but 32-bit (i386-apple-darwin14.0.0) does not:
 
 ld: illegal text-relocation to 'anon' in 
 ../libiberty/pic/libiberty.a(regex.o) from 
 '_byte_common_op_match_null_string_p' in 
 ../libiberty/pic/libiberty.a(regex.o) for architecture i386
 collect2: error: ld returned 1 exit status
 make[3]: *** [libcc1.la] Error 1
 make[2]: *** [all] Error 2
 make[1]: *** [all-libcc1] Error 2

For {i?86,ppc}-darwin* (i.e. m32 hosts) the PIC libiberty library is being 
incorrectly built.

The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
the libiberty pic build appends: -fno-common (and not even -fPIC) [NB -fPIC 
_won't_ override -mdynamic-no-pic, so that's not a simple way out]

This means that the PIC library is being built with non-pic relocs.

I have a local hack to allow build to proceed on m32-host-darwin (which I can 
send to you if you would like it) - however, it's not really a suitable patch 
for trunk... and I've not had time recently to try and fix this.

If you would like to raise a PR for this, I can append the analysis there.

cheers
Iain



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Rainer Orth
FX fxcoud...@gmail.com writes:

 While in my testing, 64-bit Mac OS X 10.10.1 (x86_64-apple-darwin14.0.0)
 now bootstraps, but 32-bit (i386-apple-darwin14.0.0) does not:

 Is it due to my patch, or pre-existing bootstrap failure?

I can't tell: before your patch, 32-bit bootstrap was broken due to PR
bootstrap/63966 for quite some time.

 How do you configure this 32-bit compiler? 
 target/build/host/CFLAGS/CXXFLAGS/etc

--target=i386-apple-darwin14.0.0
--build=i386-apple-darwin14.0.0
--host=i386-apple-darwin14.0.0
--enable-languages=all,ada,obj-c++ 

Bootstrap compiler is gcc 4.9.1 (patched for 10.10 support)

CC='gcc -m32' 
CXX='g++ -m32'

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Richard Biener
On Thu, Dec 4, 2014 at 2:47 PM, Richard Biener
richard.guent...@gmail.com wrote:
 On Thu, Dec 4, 2014 at 2:43 PM, Iain Sandoe i...@codesourcery.com wrote:
 Hi Rainer,

 On 4 Dec 2014, at 13:32, Rainer Orth wrote:

 FX fxcoud...@gmail.com writes:

 10-days ping
 This restores bootstrap on a secondary target, target maintainer is OK with
 it. I think I need build maintainers approval, so please review.

 While in my testing, 64-bit Mac OS X 10.10.1 (x86_64-apple-darwin14.0.0)
 now bootstraps, but 32-bit (i386-apple-darwin14.0.0) does not:

 ld: illegal text-relocation to 'anon' in 
 ../libiberty/pic/libiberty.a(regex.o) from 
 '_byte_common_op_match_null_string_p' in 
 ../libiberty/pic/libiberty.a(regex.o) for architecture i386
 collect2: error: ld returned 1 exit status
 make[3]: *** [libcc1.la] Error 1
 make[2]: *** [all] Error 2
 make[1]: *** [all-libcc1] Error 2

 For {i?86,ppc}-darwin* (i.e. m32 hosts) the PIC libiberty library is being 
 incorrectly built.

 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB -fPIC 
 _won't_ override -mdynamic-no-pic, so that's not a simple way out]

 This means that the PIC library is being built with non-pic relocs.

 I have a local hack to allow build to proceed on m32-host-darwin (which I 
 can send to you if you would like it) - however, it's not really a suitable 
 patch for trunk... and I've not had time recently to try and fix this.

 If you would like to raise a PR for this, I can append the analysis there.

 The libiberty PIC build shouldn't use BOOT_CFLAGS.  How does
 lto-plugin get around being built for the host but as a shared library?

That is, the mistake is probably adding -mdynamic-no-pic to BOOT_CFLAGS
rather than in more contained places when building files for the host
_binaries_.

Richard.

 Richard.

 cheers
 Iain



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Richard Biener
On Thu, Dec 4, 2014 at 2:48 PM, Richard Biener
richard.guent...@gmail.com wrote:
 On Thu, Dec 4, 2014 at 2:47 PM, Richard Biener
 richard.guent...@gmail.com wrote:
 On Thu, Dec 4, 2014 at 2:43 PM, Iain Sandoe i...@codesourcery.com wrote:
 Hi Rainer,

 On 4 Dec 2014, at 13:32, Rainer Orth wrote:

 FX fxcoud...@gmail.com writes:

 10-days ping
 This restores bootstrap on a secondary target, target maintainer is OK 
 with
 it. I think I need build maintainers approval, so please review.

 While in my testing, 64-bit Mac OS X 10.10.1 (x86_64-apple-darwin14.0.0)
 now bootstraps, but 32-bit (i386-apple-darwin14.0.0) does not:

 ld: illegal text-relocation to 'anon' in 
 ../libiberty/pic/libiberty.a(regex.o) from 
 '_byte_common_op_match_null_string_p' in 
 ../libiberty/pic/libiberty.a(regex.o) for architecture i386
 collect2: error: ld returned 1 exit status
 make[3]: *** [libcc1.la] Error 1
 make[2]: *** [all] Error 2
 make[1]: *** [all-libcc1] Error 2

 For {i?86,ppc}-darwin* (i.e. m32 hosts) the PIC libiberty library is being 
 incorrectly built.

 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB -fPIC 
 _won't_ override -mdynamic-no-pic, so that's not a simple way out]

 This means that the PIC library is being built with non-pic relocs.

 I have a local hack to allow build to proceed on m32-host-darwin (which I 
 can send to you if you would like it) - however, it's not really a suitable 
 patch for trunk... and I've not had time recently to try and fix this.

 If you would like to raise a PR for this, I can append the analysis there.

 The libiberty PIC build shouldn't use BOOT_CFLAGS.  How does
 lto-plugin get around being built for the host but as a shared library?

 That is, the mistake is probably adding -mdynamic-no-pic to BOOT_CFLAGS
 rather than in more contained places when building files for the host
 _binaries_.

Where T_CFLAGS should have been used?

Richard.

 Richard.

 Richard.

 cheers
 Iain



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread FX
 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB -fPIC 
 _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.

config/mh-darwin says that -mdynamic-no-pic is there because it “speeds 
compiles by 3-5%”. I don’t think we care about speed when the bootstrap fails, 
so can we remove it altogether?

FX




darwin.diff
Description: Binary data


Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Richard Biener
On Thu, Dec 4, 2014 at 2:52 PM, FX fxcoud...@gmail.com wrote:
 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB -fPIC 
 _won't_ override -mdynamic-no-pic, so that's not a simple way out]
 This means that the PIC library is being built with non-pic relocs.

 config/mh-darwin says that -mdynamic-no-pic is there because it “speeds 
 compiles by 3-5%”. I don’t think we care about speed when the bootstrap 
 fails, so can we remove it altogether?

Can you try adding it as

T_CFLAGS += -mdynamic-no-pic

in gcc/config/t-tarwin instead?

 FX




Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Richard Biener
On Thu, Dec 4, 2014 at 2:43 PM, Iain Sandoe i...@codesourcery.com wrote:
 Hi Rainer,

 On 4 Dec 2014, at 13:32, Rainer Orth wrote:

 FX fxcoud...@gmail.com writes:

 10-days ping
 This restores bootstrap on a secondary target, target maintainer is OK with
 it. I think I need build maintainers approval, so please review.

 While in my testing, 64-bit Mac OS X 10.10.1 (x86_64-apple-darwin14.0.0)
 now bootstraps, but 32-bit (i386-apple-darwin14.0.0) does not:

 ld: illegal text-relocation to 'anon' in 
 ../libiberty/pic/libiberty.a(regex.o) from 
 '_byte_common_op_match_null_string_p' in 
 ../libiberty/pic/libiberty.a(regex.o) for architecture i386
 collect2: error: ld returned 1 exit status
 make[3]: *** [libcc1.la] Error 1
 make[2]: *** [all] Error 2
 make[1]: *** [all-libcc1] Error 2

 For {i?86,ppc}-darwin* (i.e. m32 hosts) the PIC libiberty library is being 
 incorrectly built.

 The default BOOT_CFLAGS are: -O2 -g -mdynamic-no-pic
 the libiberty pic build appends: -fno-common (and not even -fPIC) [NB -fPIC 
 _won't_ override -mdynamic-no-pic, so that's not a simple way out]

 This means that the PIC library is being built with non-pic relocs.

 I have a local hack to allow build to proceed on m32-host-darwin (which I can 
 send to you if you would like it) - however, it's not really a suitable patch 
 for trunk... and I've not had time recently to try and fix this.

 If you would like to raise a PR for this, I can append the analysis there.

The libiberty PIC build shouldn't use BOOT_CFLAGS.  How does
lto-plugin get around being built for the host but as a shared library?

Richard.

 cheers
 Iain



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread FX
 Can you try adding it as
 
 T_CFLAGS += -mdynamic-no-pic
 
 in gcc/config/t-tarwin instead?

Nope, doing so fails to link libgcc_s.dylib:

/Users/fx/devel/gcc/i/./gcc/xgcc -B/Users/fx/devel/gcc/i/./gcc/ 
-B/Users/fx/devel/gcc/i2/i386-apple-darwin14.0.0/bin/ 
-B/Users/fx/devel/gcc/i2/i386-apple-darwin14.0.0/lib/ -isystem 
/Users/fx/devel/gcc/i2/i386-apple-darwin14.0.0/include -isystem 
/Users/fx/devel/gcc/i2/i386-apple-darwin14.0.0/sys-include-O2  -g -O2 
-DIN_GCC-mdynamic-no-pic -W -Wall -Wno-narrowing -Wwrite-strings 
-Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes 
-Wold-style-definition  -isystem ./include   -pipe -fno-common -g -DIN_LIBGCC2 
-fbuilding-libgcc -fno-stack-protector  -dynamiclib -nodefaultlibs 
-install_name /Users/fx/devel/gcc/i2/lib/libgcc_s.1.dylib -single_module -o 
./libgcc_s.dylib -Wl,-exported_symbols_list,libgcc.map -compatibility_version 1 
-current_version 1.0 -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o 
_ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o 
_trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o 
_subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o 
_ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o 
_ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o 
_paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o 
_muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o 
_divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o 
_fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o 
_fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o 
_floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o 
_floatundixf_s.o _fixsfti_s.o _fixdfti_s.o _fixxfti_s.o _fixtfti_s.o 
_fixunssfti_s.o _fixunsdfti_s.o _fixunsxfti_s.o _fixunstfti_s.o _floattisf_s.o 
_floattidf_s.o _floattixf_s.o _floattitf_s.o _floatuntisf_s.o _floatuntidf_s.o 
_floatuntixf_s.o _floatuntitf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o 
_umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o darwin-64_s.o cpuinfo_s.o 
tf-signs_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o 
letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o 
fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o 
floatditf_s.o floatunditf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o 
trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o 
unwind-dw2_s.o unwind-dw2-fde-darwin_s.o unwind-sjlj_s.o unwind-c_s.o 
emutls_s.o libgcc.a -lc
ld: warning: could not create compact unwind for __Unwind_RaiseException: does 
not use EBP or ESP based frame
ld: warning: could not create compact unwind for __Unwind_ForcedUnwind: does 
not use EBP or ESP based frame
ld: warning: could not create compact unwind for __Unwind_Resume: does not use 
EBP or ESP based frame
ld: warning: could not create compact unwind for __Unwind_Resume_or_Rethrow: 
does not use EBP or ESP based frame
ld: illegal text-relocation to '4-byte-literal' in _powisf2_s.o from 
'___powisf2' in _powisf2_s.o for architecture i386
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.dylib] Error 1
make[2]: *** [all-stage1-target-libgcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2




Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-04 Thread Iain Sandoe

On 4 Dec 2014, at 15:24, FX wrote:

 Can you try adding it as
 
 T_CFLAGS += -mdynamic-no-pic
 
 in gcc/config/t-tarwin instead?
 

-mdynamic-no-pic should be used to build *host* executable stuff for m32 darwin.

It is not suitable for building shared libraries (hence the problem with 
building the PIC version of libiberty) and won't work for the target libaries 
for similar reasons.



If you want a quick fix, sure remove it from the boot cflags - but it's 
hiding a real issue which is that the pic build of libiberty does not cater for 
the possibility that the non-pic flags cannot simply be overridden by the pic 
ones.

Of course, it's possible what darwin is the only affected target - but I'd not 
want to swear to that.

Iain



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-11-25 Thread Mike Stump
On Nov 23, 2014, at 4:06 PM, FX fxcoud...@gmail.com wrote:
 One question to build maintainers, and one patch submitted to top-level 
 configure.ac

So, not sure who wants to review this.  From the darwin perspective, Ok.

Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-11-25 Thread Phil Muldoon
On 25/11/14 20:37, Mike Stump wrote:
 On Nov 23, 2014, at 4:06 PM, FX fxcoud...@gmail.com wrote:
 One question to build maintainers, and one patch submitted to top-level 
 configure.ac

 So, not sure who wants to review this.  From the darwin perspective, Ok.

I mean from my limited viewpoint it looks fine. As long as the .so is
built, that's really our only goal from a GDB point of view.  But I am
not a maintainer, so I have refrained from commenting on this change,
as it seems fairly straightforward.  Though I am no expert on GCC
build systems.

Cheers

Phil



Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-11-25 Thread Jeff Law

On 11/25/14 13:57, Phil Muldoon wrote:

On 25/11/14 20:37, Mike Stump wrote:

On Nov 23, 2014, at 4:06 PM, FX fxcoud...@gmail.com wrote:

One question to build maintainers, and one patch submitted to top-level 
configure.ac


So, not sure who wants to review this.  From the darwin perspective, Ok.


I mean from my limited viewpoint it looks fine. As long as the .so is
built, that's really our only goal from a GDB point of view.  But I am
not a maintainer, so I have refrained from commenting on this change,
as it seems fairly straightforward.  Though I am no expert on GCC
build systems.

I'm not sure there *is* an expert on the GCC buildsystem :(

jeff