Hello, We used to have in gcc-interface/Makefile.in:
GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) ...
^^^^^^^^^^^^^^^^^^^^^^^^
As part of the libgcc move to toplevel,
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00917.html
introduced PIC_FLAG_FOR_TARGET and replaced all the uses of
TARGET_LIBGCC2_CFLAGS by that, on the assumption that it was
essentially used for gnatlib-shared related targets.
That was true for most of the uses indeed, in particular those
directly part of the gnatlib-shared targets which now have:
gnatlib-shared-default:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
==> GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
gnatlib
However, we now alo have:
GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)
^^^^^^^^^^^^^^^^^^^^^
which is used for all the gnatlib related targets in this Makefile, so we
end up passing -fpic or alike for the compilation of C files aimed at non
shared libs as well.
This causes kernel-mode library build failures with --diable-libada on VxWorks
because the compiler stops in presence of -fPIC without -mrtp. The extraneaous
PICFLAG is visible in libada/Makefile.in as well, with similar consequences
in the libada enabled case.
The attached patch addresses this with two simple steps: remove
PICFLAG_FOR_TARGET from the top definition of GNATLIBCFLAGS_FOR_C,
then add it explicitly to the options passed by the gnatlib-shared
targets only. Like
GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS)
gnatlib-shared-default:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
==> GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
==> GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \
gnatlib
This lets the simple VxWorks builds proceed to completion, and
bootstrap+regtest fine x86_64-linux.
Committing to mainline.
Olivier
2012-06-10 Olivier Hainque <[email protected]>
* Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PIC_FLAG_FOR_TARGET).
(gnatlib-shared-default): Add $(PIC_FLAG_FOR_TARGET) to
GNATLIBCFLAGS_FOR_C passed to gnatlib.
(gnatlib-shared-win32): Likewise.
(gnatlib-shared-darwin): Likewise.
(gnatlib-shared-dual-win32): Pass PIC_FLAG_FOR_TARGET to
gnatlib-shared-win32.
libada/
* Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PICFLAG).
ada-picflag.diff
Description: Binary data
