0013-Ensure-target-gcc-headers-can-be-included.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. From 531b9df680c4380797e8e7705a8e7f8ed17ebe68 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Fri, 20 Feb 2015 10:25:11 +0000
  4. Subject: [PATCH] Ensure target gcc headers can be included
  5. There are a few headers installed as part of the OpenEmbedded
  6. gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
  7. built for the target architecture, these are within the target
  8. sysroot and not cross/nativesdk; thus they weren't able to be
  9. found by gcc with the existing search paths. Add support for
  10. picking up these headers under the sysroot supplied on the gcc
  11. command line in order to resolve this.
  12. Extend target gcc headers search to musl too
  13. Upstream-Status: Inappropriate [embedded specific]
  14. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
  15. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  16. ---
  17. gcc/Makefile.in | 2 ++
  18. gcc/config/linux.h | 8 ++++++++
  19. gcc/config/rs6000/sysv4.h | 8 ++++++++
  20. gcc/cppdefault.cc | 4 ++++
  21. 4 files changed, 22 insertions(+)
  22. diff --git a/gcc/Makefile.in b/gcc/Makefile.in
  23. index 04f28984b34..8ef996c0f4d 100644
  24. --- a/gcc/Makefile.in
  25. +++ b/gcc/Makefile.in
  26. @@ -640,6 +640,7 @@ libexecdir = @libexecdir@
  27. # Directory in which the compiler finds libraries etc.
  28. libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
  29. +libsubdir_target = $(target_noncanonical)/$(version)
  30. # Directory in which the compiler finds executables
  31. libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
  32. # Directory in which all plugin resources are installed
  33. @@ -3059,6 +3060,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
  34. PREPROCESSOR_DEFINES = \
  35. -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  36. + -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
  37. -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
  38. -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
  39. -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
  40. diff --git a/gcc/config/linux.h b/gcc/config/linux.h
  41. index 6491c6b84f5..57496ff1f2f 100644
  42. --- a/gcc/config/linux.h
  43. +++ b/gcc/config/linux.h
  44. @@ -157,6 +157,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  45. #define INCLUDE_DEFAULTS_MUSL_TOOL
  46. #endif
  47. +#ifdef GCC_INCLUDE_SUBDIR_TARGET
  48. +#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
  49. + { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
  50. +#else
  51. +#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
  52. +#endif
  53. +
  54. #ifdef NATIVE_SYSTEM_HEADER_DIR
  55. #define INCLUDE_DEFAULTS_MUSL_NATIVE \
  56. { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
  57. @@ -183,6 +190,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  58. INCLUDE_DEFAULTS_MUSL_PREFIX \
  59. INCLUDE_DEFAULTS_MUSL_CROSS \
  60. INCLUDE_DEFAULTS_MUSL_TOOL \
  61. + INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
  62. INCLUDE_DEFAULTS_MUSL_NATIVE \
  63. { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
  64. { 0, 0, 0, 0, 0, 0 } \
  65. diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
  66. index 26db003cb3a..3a443abcf6b 100644
  67. --- a/gcc/config/rs6000/sysv4.h
  68. +++ b/gcc/config/rs6000/sysv4.h
  69. @@ -986,6 +986,13 @@ ncrtn.o%s"
  70. #define INCLUDE_DEFAULTS_MUSL_TOOL
  71. #endif
  72. +#ifdef GCC_INCLUDE_SUBDIR_TARGET
  73. +#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
  74. + { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
  75. +#else
  76. +#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
  77. +#endif
  78. +
  79. #ifdef NATIVE_SYSTEM_HEADER_DIR
  80. #define INCLUDE_DEFAULTS_MUSL_NATIVE \
  81. { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
  82. @@ -1012,6 +1019,7 @@ ncrtn.o%s"
  83. INCLUDE_DEFAULTS_MUSL_PREFIX \
  84. INCLUDE_DEFAULTS_MUSL_CROSS \
  85. INCLUDE_DEFAULTS_MUSL_TOOL \
  86. + INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
  87. INCLUDE_DEFAULTS_MUSL_NATIVE \
  88. { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
  89. { 0, 0, 0, 0, 0, 0 } \
  90. diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
  91. index 141bb4d25f6..734590a7059 100644
  92. --- a/gcc/cppdefault.cc
  93. +++ b/gcc/cppdefault.cc
  94. @@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
  95. /* This is the dir for gcc's private headers. */
  96. { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
  97. #endif
  98. +#ifdef GCC_INCLUDE_SUBDIR_TARGET
  99. + /* This is the dir for gcc's private headers under the specified sysroot. */
  100. + { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
  101. +#endif
  102. #ifdef LOCAL_INCLUDE_DIR
  103. /* /usr/local/include comes before the fixincluded header files. */
  104. { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },