Message ID | yddpqkdmr1o.fsf@manam.CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
On 08/10/2011 01:42 PM, Rainer Orth wrote: > * Centralize the determination of PICFLAG. Currently, three libraries > inside the gcc tree are built PIC without libtool: libgcc, libiberty, > and libgnat/libgnarl. > > libiberty/configure.ac has a hardcoded list of PICFLAG that could be > moved to a toplevel config/picflag.m4. That's the simplest alternative. It would need however a pass through the config/ directory for targets that are never used as hosts for GCC (and thus libiberty). Alternatively, the libtool code could be extracted to config/picflag.m4. > Alternatively, one could think about using libtool --config | grep > pic_flag to determine the flag without actually using libtool. > > Last, one completely could go for libtool, but I very much doubt such > a suggestion would get much traction. > > My current plan is to merge the PICFLAG information from libiberty and > libgcc into picflag.m4 and use that. Yes, that needs to be done of course. I'm not sure if we still support gnatlib_and_tools to build libada/gnattools. If so, we would need the PICFLAG to be available somehow in the gcc Makefile (perhaps by providing GCC_TARGET_PICFLAG in addition to GCC_PICFLAG in picflag.m4). Paolo
> That's the simplest alternative. It would need however a pass through the > config/ directory for targets that are never used as hosts for GCC (and > thus libiberty). > > Alternatively, the libtool code could be extracted to config/picflag.m4. > >> Alternatively, one could think about using libtool --config | grep >> pic_flag to determine the flag without actually using libtool. >> >> Last, one completely could go for libtool, but I very much doubt such >> a suggestion would get much traction. >> >> My current plan is to merge the PICFLAG information from libiberty and >> libgcc into picflag.m4 and use that. > > Yes, that needs to be done of course. I'm not sure if we still support > gnatlib_and_tools to build libada/gnattools. If so, we would need the > PICFLAG to be available somehow in the gcc Makefile (perhaps by providing > GCC_TARGET_PICFLAG in addition to GCC_PICFLAG in picflag.m4). Yes, we still need that. Building separately gnatlib/gnatools is still in production at AdaCore, because the GCC multilib mechanism isn't quite suitable/would need to be merged with GNAT's need of multiple run-times. So passing PICFLAG down to the gcc/ada/gcc-interface Makefile and not just via libada/Makefile is indeed important. Arno
Arnaud Charlet <charlet@adacore.com> writes: >> Yes, that needs to be done of course. I'm not sure if we still support >> gnatlib_and_tools to build libada/gnattools. If so, we would need the >> PICFLAG to be available somehow in the gcc Makefile (perhaps by providing >> GCC_TARGET_PICFLAG in addition to GCC_PICFLAG in picflag.m4). > > Yes, we still need that. Building separately gnatlib/gnatools is still in > production at AdaCore, because the GCC multilib mechanism isn't quite > suitable/would need to be merged with GNAT's need of multiple run-times. Ok, I see. Perhaps gcc/ada could be disentangled and those files exclusively or primarily used for libgnat/libgnarl moved over to libada, and referenced from there for the host build? > So passing PICFLAG down to the gcc/ada/gcc-interface Makefile and not > just via libada/Makefile is indeed important. This seems to be easy: unless I'm mistaken, it should suffice to just call GCC_PICFLAG in gcc/configure.ac and substitute the result in gcc/ada/gcc-interface/Makefile.in. What's the best way to test this? I've often had serious trouble when I tried to run make gnatlib/gnatlib-shared in gcc/ada. OTOH, it seems you're fine with the general approach of only passing PICFLAG to build gnatlib, not everything else that happens to reside in TARGET_LIBGCC2_CFLAGS? Thanks. Rainer
> Ok, I see. Perhaps gcc/ada could be disentangled and those files > exclusively or primarily used for libgnat/libgnarl moved over to libada, > and referenced from there for the host build? That would require some delicate work on AdaCore's side, so wouldn't be helpful in the short term (rather harmful actually). > > So passing PICFLAG down to the gcc/ada/gcc-interface Makefile and not > > just via libada/Makefile is indeed important. > > This seems to be easy: unless I'm mistaken, it should suffice to just > call GCC_PICFLAG in gcc/configure.ac and substitute the result in > gcc/ada/gcc-interface/Makefile.in. What's the best way to test this? You can e.g. add some dummy target in the Makefile that will echo the value of this variable. > I've often had serious trouble when I tried to run make > gnatlib/gnatlib-shared in gcc/ada. Apparently "someone" in the past removed too many things from the Makefile which broke partly this support (probably thinking that with libada/Makefile, these changes were not needed anymore). We have local changes at AdaCore in the Makefile that basically ignores these changes. > OTOH, it seems you're fine with the general approach of only passing > PICFLAG to build gnatlib, not everything else that happens to reside in > TARGET_LIBGCC2_CFLAGS? I think that would be fine, although I'm not 100% sure. I can't remember whether we've needed TARGET_LIBGCC2_CFLAGS for other flags on e.g. some exotic/non mainstream platform in the past, so can't guarantee that this change is a good idea. I'd say worth a try, asa long as we're prepared to have a "plan B" in case this change does break some exotic platforms unexpectedly. Arno
Arnaud Charlet <charlet@adacore.com> writes: >> Ok, I see. Perhaps gcc/ada could be disentangled and those files >> exclusively or primarily used for libgnat/libgnarl moved over to libada, >> and referenced from there for the host build? > > That would require some delicate work on AdaCore's side, so wouldn't be > helpful in the short term (rather harmful actually). I wasn't suggesting this as a short-term project, but given the clutter of gcc/ada might be a good idea longer term. >> > So passing PICFLAG down to the gcc/ada/gcc-interface Makefile and not >> > just via libada/Makefile is indeed important. >> >> This seems to be easy: unless I'm mistaken, it should suffice to just >> call GCC_PICFLAG in gcc/configure.ac and substitute the result in >> gcc/ada/gcc-interface/Makefile.in. What's the best way to test this? > > You can e.g. add some dummy target in the Makefile that will echo > the value of this variable. Sure, I was rather asking how make gnatlib (or whatever) is supposed to be invoked? From gcc/ada, any special needs? >> I've often had serious trouble when I tried to run make >> gnatlib/gnatlib-shared in gcc/ada. > > Apparently "someone" in the past removed too many things from the Makefile > which broke partly this support (probably thinking that with libada/Makefile, > these changes were not needed anymore). We have local changes at AdaCore in the > Makefile that basically ignores these changes. It would be good to contribute them, perhaps for close scrutiny by a build maintainer. If anything goes wrong in libada during a bootstrap, investigating and manually retrying is currently painful at best. >> OTOH, it seems you're fine with the general approach of only passing >> PICFLAG to build gnatlib, not everything else that happens to reside in >> TARGET_LIBGCC2_CFLAGS? > > I think that would be fine, although I'm not 100% sure. I can't remember > whether we've needed TARGET_LIBGCC2_CFLAGS for other flags on e.g. some > exotic/non mainstream platform in the past, so can't guarantee that this change > is a good idea. I'd say worth a try, asa long as we're prepared to have a > "plan B" in case this change does break some exotic platforms unexpectedly. I think to correct way to handle this would be in one of the target-specific sections of gcc/ada/gcc-interface/Makefile.in, adding to CFLAGS with a comment describing the need. If we cannot get rid of libada's need for PICFLAG, this blocks the rest of the toplevel libgcc move, which would be unfortunate. Rainer
On 08/16/2011 09:52 AM, Arnaud Charlet wrote: > >> > I've often had serious trouble when I tried to run make >> > gnatlib/gnatlib-shared in gcc/ada. > Apparently "someone" in the past removed too many things from the Makefile > which broke partly this support (probably thinking that with libada/Makefile, > these changes were not needed anymore). We have local changes at AdaCore in the > Makefile that basically ignores these changes. Please post them. Paolo
On 08/16/2011 09:44 AM, Rainer Orth wrote: >> > So passing PICFLAG down to the gcc/ada/gcc-interface Makefile and not >> > just via libada/Makefile is indeed important. > This seems to be easy: unless I'm mistaken, it should suffice to just > call GCC_PICFLAG in gcc/configure.ac and substitute the result in > gcc/ada/gcc-interface/Makefile.in. What's the best way to test this? > I've often had serious trouble when I tried to run make > gnatlib/gnatlib-shared in gcc/ada. No, you need GCC_PICFLAG_FOR_TARGET that dispatches on $target rather than $host. But it is still easy. > OTOH, it seems you're fine with the general approach of only passing > PICFLAG to build gnatlib, not everything else that happens to reside in > TARGET_LIBGCC2_CFLAGS? We can always try, and later introduce TARGET_GNATLIB_CFLAGS if it turns out to be a problem. Paolo
> Sure, I was rather asking how make gnatlib (or whatever) is supposed to > be invoked? From gcc/ada, any special needs? From <obj dir>/gcc typically. > It would be good to contribute them, perhaps for close scrutiny by a well, it's not a matter of contributing: it's more a matter of undoing what was removed, but Makefiles are tricky, and it's never been a priority. > If we cannot get rid of libada's need for PICFLAG, this blocks the rest > of the toplevel libgcc move, which would be unfortunate. Well, PICFLAG certainly is needed, but you do seem to have a plan for that. Let's assume that's all we need for now. Arno
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -114,7 +114,7 @@ GNATLIBCFLAGS = -g -O2 # Pretend that _Unwind_GetIPInfo is available for the target by default. This # should be autodetected during the configuration of libada and passed down to # here, but we need something for --disable-libada and hope for the best. -GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \ +GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(PICFLAG) -fexceptions \ -DIN_RTS -DHAVE_GETIPINFO ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) MOST_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(SOME_ADAFLAGS) @@ -2482,7 +2482,7 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../ gnatlib-shared-default: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ - GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \ + GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG)" \ GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ @@ -2490,14 +2490,14 @@ gnatlib-shared-default: $(RM) $(RTSDIR)/libgna*$(soext) cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \ - $(TARGET_LIBGCC2_CFLAGS) \ + $(PICFLAG) \ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(MISCLIB) -lm cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \ - $(TARGET_LIBGCC2_CFLAGS) \ + $(PICFLAG) \ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(GNATRTL_TASKING_OBJS) \ $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ @@ -2529,7 +2529,7 @@ gnatlib-shared-dual: gnatlib-shared-dual-win32: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ - GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \ + GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG)" \ GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ @@ -2552,7 +2552,7 @@ gnatlib-shared-dual-win32: gnatlib-shared-win32: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ - GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \ + GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG)" \ GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ @@ -2560,13 +2560,13 @@ gnatlib-shared-win32: $(RM) $(RTSDIR)/libgna*$(soext) cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \ - $(TARGET_LIBGCC2_CFLAGS) \ + $(PICFLAG) \ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB) cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \ - $(TARGET_LIBGCC2_CFLAGS) \ + $(PICFLAG) \ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(GNATRTL_TASKING_OBJS) \ $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ @@ -2575,21 +2575,21 @@ gnatlib-shared-win32: gnatlib-shared-darwin: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ - GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \ + GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG)" \ GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib $(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext) cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ - | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \ + | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG) \ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ $(SO_OPTS) \ -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(MISCLIB) -lm cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ - | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \ + | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG) \ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ $(GNATRTL_TASKING_OBJS) \ $(SO_OPTS) \ @@ -2638,7 +2638,7 @@ gnatlib-shared: GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ - TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \ + PICFLAG="$(PICFLAG)" \ $(GNATLIB_SHARED) gnatlib-sjlj: @@ -2653,7 +2653,7 @@ gnatlib-sjlj: GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ - TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib + PICFLAG="$(PICFLAG)" gnatlib gnatlib-zcx: $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \ @@ -2667,7 +2667,7 @@ gnatlib-zcx: GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ - TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib + PICFLAG="$(PICFLAG)" gnatlib # .s files for cross-building gnat-cross: force diff --git a/libada/Makefile.in b/libada/Makefile.in --- a/libada/Makefile.in +++ b/libada/Makefile.in @@ -1,5 +1,5 @@ # Makefile for libada. -# Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc. +# Copyright 2003, 2004, 2009, 2010, 2011 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -56,15 +56,13 @@ LOOSE_WARN = -W -Wall -Wwrite-strings -W GCC_WARN_CFLAGS = $(LOOSE_WARN) WARN_CFLAGS = @warn_cflags@ -TARGET_LIBGCC2_CFLAGS= +PICFLAG = @PICFLAG@ GNATLIBCFLAGS= -g -O2 -GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \ +GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(PICFLAG) -fexceptions \ -DIN_RTS @have_getipinfo@ -# Get target-specific overrides for TARGET_LIBGCC2_CFLAGS. host_subdir = @host_subdir@ GCC_DIR=$(MULTIBUILDTOP)../../$(host_subdir)/gcc -include $(GCC_DIR)/libgcc.mvars target_noncanonical:=@target_noncanonical@ version := $(shell cat $(srcdir)/../gcc/BASE-VER) @@ -83,7 +81,7 @@ LIBADA_FLAGS_TO_PASS = \ "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \ "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \ "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \ - "TARGET_LIBGCC2_CFLAGS=$(TARGET_LIBGCC2_CFLAGS)" \ + "PICFLAG=$(PICFLAG)" \ "THREAD_KIND=$(THREAD_KIND)" \ "TRACE=$(TRACE)" \ "MULTISUBDIR=$(MULTISUBDIR)" \ diff --git a/libada/configure.ac b/libada/configure.ac --- a/libada/configure.ac +++ b/libada/configure.ac @@ -117,6 +117,9 @@ case $enable_shared in esac ], [enable_shared=yes]) AC_SUBST([enable_shared]) +# FIXME: Configure. +PICFLAG=-fPIC +AC_SUBST([PICFLAG]) # These must be passed down, or are needed by gcc/libgcc.mvars AC_PROG_AWK