aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-05-18 08:44:18 +0000
committerIain Sandoe <iains@gcc.gnu.org>2019-05-18 08:44:18 +0000
commit7792cf668e8efe4d158172f80b6c217fc64d9ddc (patch)
treee286cc46662ddfdceb4fbbb5c80fbdb3f3074137
parent5219955ccd44eaca6fd12b39acafc24c04602e97 (diff)
downloadgcc-7792cf668e8efe4d158172f80b6c217fc64d9ddc.zip
gcc-7792cf668e8efe4d158172f80b6c217fc64d9ddc.tar.gz
gcc-7792cf668e8efe4d158172f80b6c217fc64d9ddc.tar.bz2
Darwin, objective-c - register gnu-runtime headers correctly.
Darwin is able to use two runtimes for objective-c; the default is its native "NeXT" runtime, but also it can build code using the "gnu-runtime". In order to do this, we have to be able to find the gnu-runtime headers (which are installed into the compiler's tree). The process to do this is erroneously prepending the sysroot to this when a sysroot is in force. The gnu-runtime headers have never been installed in a Darwin (macOS) SDK so we must make sure that they are found local to the compiler. gcc/ 2019-05-18 Iain Sandoe <iain@sandoe.co.uk> * config/darwin-c.c (darwin_register_objc_includes): Do not prepend the sysroot when building gnu-runtime header search paths. From-SVN: r271371
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/darwin-c.c39
2 files changed, 21 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 260724a..727fa43 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2019-05-18 Iain Sandoe <iain@sandoe.co.uk>
+ * config/darwin-c.c (darwin_register_objc_includes): Do not
+ prepend the sysroot when building gnu-runtime header search
+ paths.
+
+2019-05-18 Iain Sandoe <iain@sandoe.co.uk>
+
* config/darwin.c (darwin_file_end): Use switch_to_section ()
instead of direct output of the asm.
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 8331153..aa5d2f2 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -463,41 +463,32 @@ static const char *framework_defaults [] =
/* Register the GNU objective-C runtime include path if STDINC. */
void
-darwin_register_objc_includes (const char *sysroot, const char *iprefix,
- int stdinc)
+darwin_register_objc_includes (const char *sysroot ATTRIBUTE_UNUSED,
+ const char *iprefix, int stdinc)
{
- const char *fname;
- size_t len;
- /* We do not do anything if we do not want the standard includes. */
- if (!stdinc)
- return;
-
- fname = GCC_INCLUDE_DIR "-gnu-runtime";
-
- /* Register the GNU OBJC runtime include path if we are compiling OBJC
- with GNU-runtime. */
+ /* If we want standard includes; Register the GNU OBJC runtime include
+ path if we are compiling OBJC with GNU-runtime.
+ This path is compiler-relative, we don't want to prepend the sysroot
+ since it's not expected to find the headers there. */
- if (c_dialect_objc () && !flag_next_runtime)
+ if (stdinc && c_dialect_objc () && !flag_next_runtime)
{
+ const char *fname = GCC_INCLUDE_DIR "-gnu-runtime";
char *str;
- /* See if our directory starts with the standard prefix.
+ size_t len;
+
+ /* See if our directory starts with the standard prefix.
"Translate" them, i.e. replace /usr/local/lib/gcc... with
IPREFIX and search them first. */
- if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0 && !sysroot
+ if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0
&& !strncmp (fname, cpp_GCC_INCLUDE_DIR, len))
{
str = concat (iprefix, fname + len, NULL);
- /* FIXME: wrap the headers for C++awareness. */
- add_path (str, INC_SYSTEM, /*c++aware=*/false, false);
+ add_path (str, INC_SYSTEM, /*c++aware=*/true, false);
}
- /* Should this directory start with the sysroot? */
- if (sysroot)
- str = concat (sysroot, fname, NULL);
- else
- str = update_path (fname, "");
-
- add_path (str, INC_SYSTEM, /*c++aware=*/false, false);
+ str = update_path (fname, "");
+ add_path (str, INC_SYSTEM, /*c++aware=*/true, false);
}
}