Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | gengtype is generated for both the build system and the target. -DGENERATOR_FILE |
| 2 | was added in the patch http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00273.html |
| 3 | and was applied to both versions of gengtype. |
| 4 | |
| 5 | Unfortunately the presence of this flag triggers the build configuration (bconfig.h) |
| 6 | to be included for the target build of gengtype. Compiling gengtype with the target |
| 7 | compiler and bconfig.h can result in errors if the build and target systems are |
| 8 | dissimilar. An example case this fails is cross compiling gcc on linux for a darwin |
| 9 | target system: |
| 10 | |
| 11 | In file included from /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c:25:0: |
| 12 | | /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c: In function 'void parse_error(const char*, ...)': |
| 13 | | /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/system.h:93:53: error: 'fputc_unlocked' was not declared in this scope |
| 14 | | # define fputc(C, Stream) fputc_unlocked (C, Stream) |
| 15 | |
| 16 | which occurs since auto-build.h and auto-host.h have differnet values of |
| 17 | HAVE_FPUTC_UNLOCKED: |
| 18 | |
| 19 | #define HAVE_FPUTC_UNLOCKED 1 |
| 20 | /* #undef HAVE_FPUTS_UNLOCKED */ |
| 21 | |
| 22 | The obvious fix is to only include the flag on build/ targets which this patch does, however |
| 23 | this also leads to compile errors due to const_tree being undefined but used in double_int.h |
| 24 | |
| 25 | I added a GENERATOR_FILE2 flag to workaround those in the |
| 26 | target case and allow the build to succeed. |
| 27 | |
| 28 | Only the build/gengtypes should have the -DGENERATOR_FILE |
| 29 | |
| 30 | RP 22/8/2013 |
| 31 | |
| 32 | Upstream-Status: Pending |
| 33 | |
| 34 | Index: gcc-4.8.1/gcc/Makefile.in |
| 35 | =================================================================== |
| 36 | --- gcc-4.8.1.orig/gcc/Makefile.in 2013-08-19 11:40:36.844014424 +0000 |
| 37 | +++ gcc-4.8.1/gcc/Makefile.in 2013-08-19 11:40:37.784014402 +0000 |
| 38 | @@ -3903,27 +3903,29 @@ |
| 39 | |
| 40 | gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H) |
| 41 | gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H) |
| 42 | -CFLAGS-gengtype-lex.o += -DGENERATOR_FILE |
| 43 | +CFLAGS-build/gengtype-lex.o += -DGENERATOR_FILE |
| 44 | build/gengtype-lex.o: $(BCONFIG_H) |
| 45 | |
| 46 | gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \ |
| 47 | $(SYSTEM_H) |
| 48 | gengtype-parse.o: $(CONFIG_H) |
| 49 | -CFLAGS-gengtype-parse.o += -DGENERATOR_FILE |
| 50 | +CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE |
| 51 | build/gengtype-parse.o: $(BCONFIG_H) |
| 52 | |
| 53 | gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \ |
| 54 | gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \ |
| 55 | $(XREGEX_H) |
| 56 | gengtype-state.o: $(CONFIG_H) |
| 57 | -CFLAGS-gengtype-state.o += -DGENERATOR_FILE |
| 58 | +CFLAGS-gengtype-state.o += -DGENERATOR_FILE2 |
| 59 | +CFLAGS-build/gengtype-state.o += -DGENERATOR_FILE |
| 60 | build/gengtype-state.o: $(BCONFIG_H) |
| 61 | |
| 62 | gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \ |
| 63 | rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \ |
| 64 | $(OBSTACK_H) $(XREGEX_H) |
| 65 | gengtype.o: $(CONFIG_H) |
| 66 | -CFLAGS-gengtype.o += -DGENERATOR_FILE |
| 67 | +CFLAGS-gengtype.o += -DGENERATOR_FILE2 |
| 68 | +CFLAGS-build/gengtype.o += -DGENERATOR_FILE |
| 69 | build/gengtype.o: $(BCONFIG_H) |
| 70 | |
| 71 | build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \ |
| 72 | @@ -3988,7 +3990,7 @@ |
| 73 | # any system header is included. |
| 74 | gengtype-lex.c : gengtype-lex.l |
| 75 | -$(FLEX) $(FLEXFLAGS) -o$@ $< && { \ |
| 76 | - echo '#include "bconfig.h"' > $@.tmp; \ |
| 77 | + echo '' > $@.tmp; \ |
| 78 | cat $@ >> $@.tmp; \ |
| 79 | mv $@.tmp $@; \ |
| 80 | } |
| 81 | Index: gcc-4.8.1/gcc/double-int.h |
| 82 | =================================================================== |
| 83 | --- gcc-4.8.1.orig/gcc/double-int.h 2013-01-30 11:04:30.000000000 +0000 |
| 84 | +++ gcc-4.8.1/gcc/double-int.h 2013-08-19 11:41:51.564012719 +0000 |
| 85 | @@ -448,10 +448,12 @@ |
| 86 | |
| 87 | |
| 88 | #ifndef GENERATOR_FILE |
| 89 | +#ifndef GENERATOR_FILE2 |
| 90 | /* Conversion to and from GMP integer representations. */ |
| 91 | |
| 92 | void mpz_set_double_int (mpz_t, double_int, bool); |
| 93 | double_int mpz_get_double_int (const_tree, mpz_t, bool); |
| 94 | #endif |
| 95 | +#endif |
| 96 | |
| 97 | #endif /* DOUBLE_INT_H */ |