diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-10 23:18:49 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-10 23:18:49 +0100 |
commit | be82a46963a2b08db29ec2fa5e941943bf0c7835 (patch) | |
tree | 2b6542862a4a3040d2010ad7db397aea4c11d06a /libcpp | |
parent | 320b0c28d38b8500d50ba29cd7c855e1d03110f5 (diff) | |
parent | 8216ca85037be9f4d5c20540522a22a4a93b660e (diff) | |
download | gcc-be82a46963a2b08db29ec2fa5e941943bf0c7835.zip gcc-be82a46963a2b08db29ec2fa5e941943bf0c7835.tar.gz gcc-be82a46963a2b08db29ec2fa5e941943bf0c7835.tar.bz2 |
Merge commit 'ea1cd66f2200839d46a8b4dc140d18c00b849c82^' into HEAD
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 15 | ||||
-rwxr-xr-x | libcpp/configure | 22 | ||||
-rw-r--r-- | libcpp/configure.ac | 19 | ||||
-rw-r--r-- | libcpp/files.cc | 15 |
4 files changed, 67 insertions, 4 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 847db36..8bbd1ac 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,18 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * configure.ac (--enable-host-shared): Don't set PICFLAG here. + (--enable-host-pie): New check. Set PICFLAG after this check. + * configure: Regenerate. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/80753 + * files.cc (struct _cpp_file): Add deferred_error bitfield. + (_cpp_find_file): When finding a file in cache with deferred_error + set in _cpp_FFK_NORMAL mode, call open_file_failed and clear the flag. + Set deferred_error in _cpp_FFK_HAS_INCLUDE mode if open_file_failed + hasn't been called. + 2023-04-30 Jeff Law <jlaw@ventanamicro> Revert: diff --git a/libcpp/configure b/libcpp/configure index e9937cd..1389dda 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -625,6 +625,8 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS CET_HOST_FLAGS PICFLAG +enable_host_pie +enable_host_shared MAINT USED_CATALOGS PACKAGE @@ -738,6 +740,7 @@ enable_maintainer_mode enable_checking enable_canonical_system_headers enable_host_shared +enable_host_pie enable_cet enable_valgrind_annotations ' @@ -1379,6 +1382,7 @@ Optional Features: --enable-canonical-system-headers enable or disable system headers canonicalization --enable-host-shared build host code as shared libraries + --enable-host-pie build host code as PIE --enable-cet enable Intel CET in host libraries [default=auto] --enable-valgrind-annotations enable valgrind runtime interaction @@ -7605,7 +7609,23 @@ esac # Enable --enable-host-shared. # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PICFLAG=-fPIC + enableval=$enable_host_shared; +fi + + + +# Enable --enable-host-pie. +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; +fi + + + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE else PICFLAG= fi diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 89ac99b..b29b4d6 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -211,8 +211,23 @@ esac # Enable --enable-host-shared. AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PICFLAG=-fPIC], [PICFLAG=]) + [build host code as shared libraries])]) +AC_SUBST(enable_host_shared) + +# Enable --enable-host-pie. +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])]) +AC_SUBST(enable_host_pie) + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi + AC_SUBST(PICFLAG) # Enable Intel CET on Intel CET enabled host if jit is enabled. diff --git a/libcpp/files.cc b/libcpp/files.cc index 3f8a810..43a8894 100644 --- a/libcpp/files.cc +++ b/libcpp/files.cc @@ -109,6 +109,10 @@ struct _cpp_file /* If this file is implicitly preincluded. */ bool implicit_preinclude : 1; + /* Set if a header wasn't found with __has_include or __has_include_next + and error should be emitted if it is included normally. */ + bool deferred_error : 1; + /* > 0: Known C++ Module header unit, <0: known not. ==0, unknown */ int header_unit : 2; }; @@ -523,7 +527,14 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, cpp_file_hash_entry *entry = search_cache ((struct cpp_file_hash_entry *) *hash_slot, start_dir); if (entry) - return entry->u.file; + { + if (entry->u.file->deferred_error && kind == _cpp_FFK_NORMAL) + { + open_file_failed (pfile, entry->u.file, angle_brackets, loc); + entry->u.file->deferred_error = false; + } + return entry->u.file; + } _cpp_file *file = make_cpp_file (start_dir, fname); file->implicit_preinclude @@ -589,6 +600,8 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, if (kind != _cpp_FFK_HAS_INCLUDE) open_file_failed (pfile, file, angle_brackets, loc); + else + file->deferred_error = true; break; } |