diff mbox

Add CFLAGS_FOR_TARGET to Ada OS Constant Extraction Process

Message ID 54DA95AE.1060809@oarcorp.com
State New
Headers show

Commit Message

Joel Sherrill Feb. 10, 2015, 11:35 p.m. UTC
Hi

When building Ada for RTEMS, you need to pass in the CFLAGS_FOR_TARGET
to see OS specific .h files. This was already done for the RTS but needed to
be added to the process which extracts value settings from the .h files.

This patch is against 4.9.  OK to apply to 4.8, 4.9, and head assuming it
applies cleanly?

2015-02-10  Joel Sherrill <joel.sherrill@oarcorp.com>

    * gcc-interface/Makefile.in: Add CFLAGS_TO_TARGET to OSCONS_CPP
    and OSCONS_EXTRACT.

Comments

Arnaud Charlet Feb. 11, 2015, 7:22 a.m. UTC | #1
> When building Ada for RTEMS, you need to pass in the CFLAGS_FOR_TARGET
> to see OS specific .h files. This was already done for the RTS but needed to
> be added to the process which extracts value settings from the .h files.
> 
> This patch is against 4.9.  OK to apply to 4.8, 4.9, and head assuming it
> applies cleanly?

This patch won't apply cleanly for head I think, where I suspect at least
part of your patch is OBE.

It would be better to first have a patch for trunk (if still relevant)
and then backport it to the other branches, since changes on trunk have
already been done in a different way to address at least partly this issue
(e.g. use of GNATLIBCFLAGS_FOR_C in OSCONS_CPP, different computation of
OSCONS_CC).

Arno
Joel Sherrill Feb. 12, 2015, 12:33 a.m. UTC | #2
On 2/11/2015 1:22 AM, Arnaud Charlet wrote:
>> When building Ada for RTEMS, you need to pass in the CFLAGS_FOR_TARGET
>> to see OS specific .h files. This was already done for the RTS but needed to
>> be added to the process which extracts value settings from the .h files.
>>
>> This patch is against 4.9.  OK to apply to 4.8, 4.9, and head assuming it
>> applies cleanly?
> This patch won't apply cleanly for head I think, where I suspect at least
> part of your patch is OBE.
OK. Rebuilding on the head.
> It would be better to first have a patch for trunk (if still relevant)
> and then backport it to the other branches, since changes on trunk have
> already been done in a different way to address at least partly this issue
> (e.g. use of GNATLIBCFLAGS_FOR_C in OSCONS_CPP, different computation of
> OSCONS_CC).
I am happy to do and from your description it sounds like the it would
have built
if the code had my previous patch to add CFLAGS_FOR_TARGET to the
GNATLIBCFLAGS.

GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(CFLAGS_FOR_TARGET) \
        -fexceptions -DIN_RTS -DHAVE_GETIPINFO

But the build didn't get far enough to know. It fails before that with:

gcc -c -g -O2  -gnatpg -gnata -W -Wall -nostdinc -I- -I. -Iada/generated
-Iada -I/users/joel/test-gcc/gcc/gcc/ada
-I/users/joel/test-gcc/gcc/gcc/ada/gcc-interface
/users/joel/test-gcc/gcc/gcc/ada/a-ioexce.ads -o ada/a-ioexce.o
a-ioexce.ads:21:19: violation of restriction "No_Elaboration_Code" at
system.ads:53
a-ioexce.ads:22:19: violation of restriction "No_Elaboration_Code" at
system.ads:53
a-ioexce.ads:23:19: violation of restriction "No_Elaboration_Code" at
system.ads:53
a-ioexce.ads:24:19: violation of restriction "No_Elaboration_Code" at
system.ads:53
a-ioexce.ads:25:19: violation of restriction "No_Elaboration_Code" at
system.ads:53
a-ioexce.ads:26:19: violation of restriction "No_Elaboration_Code" at
system.ads:53
a-ioexce.ads:27:19: violation of restriction "No_Elaboration_Code" at
system.ads:53
a-ioexce.ads:28:19: violation of restriction "No_Elaboration_Code" at
system.ads:53

Any ideas?

My native compiler is from the head back in August. I will rebuild it
overnight
and try again in the morning in case that's a factor.

> Arno
diff mbox

Patch

Index: gcc/ada/gcc-interface/Makefile.in
===================================================================
--- gcc/ada/gcc-interface/Makefile.in	(revision 220002)
+++ gcc/ada/gcc-interface/Makefile.in	(working copy)
@@ -115,7 +115,7 @@ 
 # 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 = -W -Wall $(GNATLIBCFLAGS) \
+GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(CFLAGS_FOR_TARGET) \
 	-fexceptions -DIN_RTS -DHAVE_GETIPINFO
 ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
 THREAD_KIND = native
@@ -2748,9 +2748,9 @@ 
 # for running it from $(RTSDIR)
 OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
   | sed -e 's^\./xgcc^../../xgcc^' -e 's^-B./^-B../../^'`
-OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
+OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) $(CFLAGS_FOR_TARGET) -E -C \
   -DTARGET=\"$(target)\" $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i
-OSCONS_EXTRACT=$(OSCONS_CC) $(GNATLIBCFLAGS) -S s-oscons-tmplt.i
+OSCONS_EXTRACT=$(OSCONS_CC) $(GNATLIBCFLAGS) $(CFLAGS_FOR_TARGET) -S s-oscons-tmplt.i
 endif
 
 ./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb