head 1.4; access; symbols netbsd-11-0-RC4:1.3 netbsd-11-0-RC3:1.3 netbsd-11-0-RC2:1.3 netbsd-11-0-RC1:1.3 gcc-14-3-0:1.1.1.4 perseant-exfatfs-base-20250801:1.3 netbsd-11:1.3.0.4 netbsd-11-base:1.3 gcc-12-5-0:1.1.1.3 perseant-exfatfs-base-20240630:1.3 gcc-12-4-0:1.1.1.3 perseant-exfatfs:1.3.0.2 perseant-exfatfs-base:1.3 gcc-12-3-0:1.1.1.3 gcc-10-5-0:1.1.1.2 gcc-10-4-0:1.1.1.2 cjep_sun2x:1.2.0.4 cjep_sun2x-base:1.2 cjep_staticlib_x-base1:1.2 cjep_staticlib_x:1.2.0.2 cjep_staticlib_x-base:1.2 gcc-10-3-0:1.1.1.1 FSF:1.1.1; locks; strict; comment @// @; 1.4 date 2025.09.14.00.08.57; author mrg; state Exp; branches; next 1.3; commitid x9D5QEnvbeMI4CaG; 1.3 date 2023.07.31.01.44.56; author mrg; state Exp; branches; next 1.2; commitid q79F5Opf0FLsyTyE; 1.2 date 2021.04.11.23.54.27; author mrg; state dead; branches; next 1.1; commitid wJn7ggfUTEMOWVOC; 1.1 date 2021.04.10.22.09.22; author mrg; state Exp; branches 1.1.1.1; next ; commitid eC4g0MRpqTvEkNOC; 1.1.1.1 date 2021.04.10.22.09.22; author mrg; state Exp; branches; next 1.1.1.2; commitid eC4g0MRpqTvEkNOC; 1.1.1.2 date 2022.07.22.19.53.17; author mrg; state Exp; branches; next 1.1.1.3; commitid fUYPgdKzIHqhwVMD; 1.1.1.3 date 2023.07.30.05.20.40; author mrg; state Exp; branches; next 1.1.1.4; commitid tk6nV4mbc9nVEMyE; 1.1.1.4 date 2025.09.13.23.45.04; author mrg; state Exp; branches; next ; commitid KwhwN4krNWa6XBaG; desc @@ 1.4 log @merge GCC 14.3.0. @ text @//===-- sanitizer_posix_libcdep.cpp ---------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file is shared between AddressSanitizer and ThreadSanitizer // run-time libraries and implements libc-dependent POSIX-specific functions // from sanitizer_libc.h. //===----------------------------------------------------------------------===// #include "sanitizer_platform.h" #if SANITIZER_POSIX #include "sanitizer_common.h" #include "sanitizer_flags.h" #include "sanitizer_platform_limits_netbsd.h" #include "sanitizer_platform_limits_posix.h" #include "sanitizer_platform_limits_solaris.h" #include "sanitizer_posix.h" #include "sanitizer_procmaps.h" #include #include #include #include #include #include #include #include #include #include #include #include #if SANITIZER_FREEBSD // The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before // that, it was never implemented. So just define it to zero. #undef MAP_NORESERVE #define MAP_NORESERVE 0 #endif typedef void (*sa_sigaction_t)(int, siginfo_t *, void *); namespace __sanitizer { u32 GetUid() { return getuid(); } uptr GetThreadSelf() { return (uptr)pthread_self(); } void ReleaseMemoryPagesToOS(uptr beg, uptr end) { uptr page_size = GetPageSizeCached(); uptr beg_aligned = RoundUpTo(beg, page_size); uptr end_aligned = RoundDownTo(end, page_size); if (beg_aligned < end_aligned) internal_madvise(beg_aligned, end_aligned - beg_aligned, SANITIZER_MADVISE_DONTNEED); } void SetShadowRegionHugePageMode(uptr addr, uptr size) { #ifdef MADV_NOHUGEPAGE // May not be defined on old systems. if (common_flags()->no_huge_pages_for_shadow) internal_madvise(addr, size, MADV_NOHUGEPAGE); else internal_madvise(addr, size, MADV_HUGEPAGE); #endif // MADV_NOHUGEPAGE } bool DontDumpShadowMemory(uptr addr, uptr length) { #if defined(MADV_DONTDUMP) return internal_madvise(addr, length, MADV_DONTDUMP) == 0; #elif defined(MADV_NOCORE) return internal_madvise(addr, length, MADV_NOCORE) == 0; #else return true; #endif // MADV_DONTDUMP } static rlim_t getlim(int res) { rlimit rlim; CHECK_EQ(0, getrlimit(res, &rlim)); return rlim.rlim_cur; } static void setlim(int res, rlim_t lim) { struct rlimit rlim; if (getrlimit(res, const_cast(&rlim))) { Report("ERROR: %s getrlimit() failed %d\n", SanitizerToolName, errno); Die(); } rlim.rlim_cur = lim; if (setrlimit(res, const_cast(&rlim))) { Report("ERROR: %s setrlimit() failed %d\n", SanitizerToolName, errno); Die(); } } void DisableCoreDumperIfNecessary() { if (common_flags()->disable_coredump) { setlim(RLIMIT_CORE, 0); } } bool StackSizeIsUnlimited() { rlim_t stack_size = getlim(RLIMIT_STACK); return (stack_size == RLIM_INFINITY); } void SetStackSizeLimitInBytes(uptr limit) { setlim(RLIMIT_STACK, (rlim_t)limit); CHECK(!StackSizeIsUnlimited()); } bool AddressSpaceIsUnlimited() { rlim_t as_size = getlim(RLIMIT_AS); return (as_size == RLIM_INFINITY); } void SetAddressSpaceUnlimited() { setlim(RLIMIT_AS, RLIM_INFINITY); CHECK(AddressSpaceIsUnlimited()); } void Abort() { #if !SANITIZER_GO // If we are handling SIGABRT, unhandle it first. // TODO(vitalybuka): Check if handler belongs to sanitizer. if (GetHandleSignalMode(SIGABRT) != kHandleSignalNo) { struct sigaction sigact; internal_memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler = SIG_DFL; internal_sigaction(SIGABRT, &sigact, nullptr); } #endif abort(); } int Atexit(void (*function)(void)) { #if !SANITIZER_GO return atexit(function); #else return 0; #endif } bool CreateDir(const char *pathname) { return mkdir(pathname, 0755) == 0; } bool SupportsColoredOutput(fd_t fd) { return isatty(fd) != 0; } #if !SANITIZER_GO // TODO(glider): different tools may require different altstack size. static uptr GetAltStackSize() { // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be // more costly that you think. However GetAltStackSize is only call 2-3 times // per thread so don't cache the evaluation. return SIGSTKSZ * 4; } void SetAlternateSignalStack() { stack_t altstack, oldstack; CHECK_EQ(0, sigaltstack(nullptr, &oldstack)); // If the alternate stack is already in place, do nothing. // Android always sets an alternate stack, but it's too small for us. if (!SANITIZER_ANDROID && !(oldstack.ss_flags & SS_DISABLE)) return; // TODO(glider): the mapped stack should have the MAP_STACK flag in the // future. It is not required by man 2 sigaltstack now (they're using // malloc()). altstack.ss_size = GetAltStackSize(); altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__); altstack.ss_flags = 0; CHECK_EQ(0, sigaltstack(&altstack, nullptr)); } void UnsetAlternateSignalStack() { stack_t altstack, oldstack; altstack.ss_sp = nullptr; altstack.ss_flags = SS_DISABLE; altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin. CHECK_EQ(0, sigaltstack(&altstack, &oldstack)); UnmapOrDie(oldstack.ss_sp, oldstack.ss_size); } static void MaybeInstallSigaction(int signum, SignalHandlerType handler) { if (GetHandleSignalMode(signum) == kHandleSignalNo) return; struct sigaction sigact; internal_memset(&sigact, 0, sizeof(sigact)); sigact.sa_sigaction = (sa_sigaction_t)handler; // Do not block the signal from being received in that signal's handler. // Clients are responsible for handling this correctly. sigact.sa_flags = SA_SIGINFO | SA_NODEFER; if (common_flags()->use_sigaltstack) sigact.sa_flags |= SA_ONSTACK; CHECK_EQ(0, internal_sigaction(signum, &sigact, nullptr)); VReport(1, "Installed the sigaction for signal %d\n", signum); } void InstallDeadlySignalHandlers(SignalHandlerType handler) { // Set the alternate signal stack for the main thread. // This will cause SetAlternateSignalStack to be called twice, but the stack // will be actually set only once. if (common_flags()->use_sigaltstack) SetAlternateSignalStack(); MaybeInstallSigaction(SIGSEGV, handler); MaybeInstallSigaction(SIGBUS, handler); MaybeInstallSigaction(SIGABRT, handler); MaybeInstallSigaction(SIGFPE, handler); MaybeInstallSigaction(SIGILL, handler); MaybeInstallSigaction(SIGTRAP, handler); } bool SignalContext::IsStackOverflow() const { // Access at a reasonable offset above SP, or slightly below it (to account // for x86_64 or PowerPC redzone, ARM push of multiple registers, etc) is // probably a stack overflow. #ifdef __s390__ // On s390, the fault address in siginfo points to start of the page, not // to the precise word that was accessed. Mask off the low bits of sp to // take it into account. bool IsStackAccess = addr >= (sp & ~0xFFF) && addr < sp + 0xFFFF; #else // Let's accept up to a page size away from top of stack. Things like stack // probing can trigger accesses with such large offsets. bool IsStackAccess = addr + GetPageSizeCached() > sp && addr < sp + 0xFFFF; #endif #if __powerpc__ // Large stack frames can be allocated with e.g. // lis r0,-10000 // stdux r1,r1,r0 # store sp to [sp-10000] and update sp by -10000 // If the store faults then sp will not have been updated, so test above // will not work, because the fault address will be more than just "slightly" // below sp. if (!IsStackAccess && IsAccessibleMemoryRange(pc, 4)) { u32 inst = *(unsigned *)pc; u32 ra = (inst >> 16) & 0x1F; u32 opcd = inst >> 26; u32 xo = (inst >> 1) & 0x3FF; // Check for store-with-update to sp. The instructions we accept are: // stbu rs,d(ra) stbux rs,ra,rb // sthu rs,d(ra) sthux rs,ra,rb // stwu rs,d(ra) stwux rs,ra,rb // stdu rs,ds(ra) stdux rs,ra,rb // where ra is r1 (the stack pointer). if (ra == 1 && (opcd == 39 || opcd == 45 || opcd == 37 || opcd == 62 || (opcd == 31 && (xo == 247 || xo == 439 || xo == 183 || xo == 181)))) IsStackAccess = true; } #endif // __powerpc__ // We also check si_code to filter out SEGV caused by something else other // then hitting the guard page or unmapped memory, like, for example, // unaligned memory access. auto si = static_cast(siginfo); return IsStackAccess && (si->si_code == si_SEGV_MAPERR || si->si_code == si_SEGV_ACCERR); } #endif // SANITIZER_GO bool IsAccessibleMemoryRange(uptr beg, uptr size) { uptr page_size = GetPageSizeCached(); // Checking too large memory ranges is slow. CHECK_LT(size, page_size * 10); int sock_pair[2]; if (pipe(sock_pair)) return false; uptr bytes_written = internal_write(sock_pair[1], reinterpret_cast(beg), size); int write_errno; bool result; if (internal_iserror(bytes_written, &write_errno)) { CHECK_EQ(EFAULT, write_errno); result = false; } else { result = (bytes_written == size); } internal_close(sock_pair[0]); internal_close(sock_pair[1]); return result; } void PlatformPrepareForSandboxing(void *args) { // Some kinds of sandboxes may forbid filesystem access, so we won't be able // to read the file mappings from /proc/self/maps. Luckily, neither the // process will be able to load additional libraries, so it's fine to use the // cached mappings. MemoryMappingLayout::CacheMemoryMappings(); } static bool MmapFixed(uptr fixed_addr, uptr size, int additional_flags, const char *name) { size = RoundUpTo(size, GetPageSizeCached()); fixed_addr = RoundDownTo(fixed_addr, GetPageSizeCached()); uptr p = MmapNamed((void *)fixed_addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED | additional_flags | MAP_ANON, name); int reserrno; if (internal_iserror(p, &reserrno)) { Report("ERROR: %s failed to " "allocate 0x%zx (%zd) bytes at address %zx (errno: %d)\n", SanitizerToolName, size, size, fixed_addr, reserrno); return false; } IncreaseTotalMmap(size); return true; } bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) { return MmapFixed(fixed_addr, size, MAP_NORESERVE, name); } bool MmapFixedSuperNoReserve(uptr fixed_addr, uptr size, const char *name) { #if SANITIZER_FREEBSD if (common_flags()->no_huge_pages_for_shadow) return MmapFixedNoReserve(fixed_addr, size, name); // MAP_NORESERVE is implicit with FreeBSD return MmapFixed(fixed_addr, size, MAP_ALIGNED_SUPER, name); #else bool r = MmapFixedNoReserve(fixed_addr, size, name); if (r) SetShadowRegionHugePageMode(fixed_addr, size); return r; #endif } uptr ReservedAddressRange::Init(uptr size, const char *name, uptr fixed_addr) { base_ = fixed_addr ? MmapFixedNoAccess(fixed_addr, size, name) : MmapNoAccess(size); size_ = size; name_ = name; (void)os_handle_; // unsupported return reinterpret_cast(base_); } // Uses fixed_addr for now. // Will use offset instead once we've implemented this function for real. uptr ReservedAddressRange::Map(uptr fixed_addr, uptr size, const char *name) { return reinterpret_cast( MmapFixedOrDieOnFatalError(fixed_addr, size, name)); } uptr ReservedAddressRange::MapOrDie(uptr fixed_addr, uptr size, const char *name) { return reinterpret_cast(MmapFixedOrDie(fixed_addr, size, name)); } void ReservedAddressRange::Unmap(uptr addr, uptr size) { CHECK_LE(size, size_); if (addr == reinterpret_cast(base_)) // If we unmap the whole range, just null out the base. base_ = (size == size_) ? nullptr : reinterpret_cast(addr + size); else CHECK_EQ(addr + size, reinterpret_cast(base_) + size_); size_ -= size; UnmapOrDie(reinterpret_cast(addr), size); } void *MmapFixedNoAccess(uptr fixed_addr, uptr size, const char *name) { return (void *)MmapNamed((void *)fixed_addr, size, PROT_NONE, MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE | MAP_ANON, name); } void *MmapNoAccess(uptr size) { unsigned flags = MAP_PRIVATE | MAP_ANON | MAP_NORESERVE; return (void *)internal_mmap(nullptr, size, PROT_NONE, flags, -1, 0); } // This function is defined elsewhere if we intercepted pthread_attr_getstack. extern "C" { SANITIZER_WEAK_ATTRIBUTE int real_pthread_attr_getstack(void *attr, void **addr, size_t *size); } // extern "C" int internal_pthread_attr_getstack(void *attr, void **addr, uptr *size) { #if !SANITIZER_GO && !SANITIZER_APPLE if (&real_pthread_attr_getstack) return real_pthread_attr_getstack((pthread_attr_t *)attr, addr, (size_t *)size); #endif return pthread_attr_getstack((pthread_attr_t *)attr, addr, (size_t *)size); } #if !SANITIZER_GO void AdjustStackSize(void *attr_) { pthread_attr_t *attr = (pthread_attr_t *)attr_; uptr stackaddr = 0; uptr stacksize = 0; internal_pthread_attr_getstack(attr, (void **)&stackaddr, &stacksize); // GLibC will return (0 - stacksize) as the stack address in the case when // stacksize is set, but stackaddr is not. bool stack_set = (stackaddr != 0) && (stackaddr + stacksize != 0); // We place a lot of tool data into TLS, account for that. const uptr minstacksize = GetTlsSize() + 128*1024; if (stacksize < minstacksize) { if (!stack_set) { if (stacksize != 0) { VPrintf(1, "Sanitizer: increasing stacksize %zu->%zu\n", stacksize, minstacksize); pthread_attr_setstacksize(attr, minstacksize); } } else { Printf("Sanitizer: pre-allocated stack size is insufficient: " "%zu < %zu\n", stacksize, minstacksize); Printf("Sanitizer: pthread_create is likely to fail.\n"); } } } #endif // !SANITIZER_GO pid_t StartSubprocess(const char *program, const char *const argv[], const char *const envp[], fd_t stdin_fd, fd_t stdout_fd, fd_t stderr_fd) { auto file_closer = at_scope_exit([&] { if (stdin_fd != kInvalidFd) { internal_close(stdin_fd); } if (stdout_fd != kInvalidFd) { internal_close(stdout_fd); } if (stderr_fd != kInvalidFd) { internal_close(stderr_fd); } }); int pid = internal_fork(); if (pid < 0) { int rverrno; if (internal_iserror(pid, &rverrno)) { Report("WARNING: failed to fork (errno %d)\n", rverrno); } return pid; } if (pid == 0) { // Child subprocess if (stdin_fd != kInvalidFd) { internal_close(STDIN_FILENO); internal_dup2(stdin_fd, STDIN_FILENO); internal_close(stdin_fd); } if (stdout_fd != kInvalidFd) { internal_close(STDOUT_FILENO); internal_dup2(stdout_fd, STDOUT_FILENO); internal_close(stdout_fd); } if (stderr_fd != kInvalidFd) { internal_close(STDERR_FILENO); internal_dup2(stderr_fd, STDERR_FILENO); internal_close(stderr_fd); } for (int fd = sysconf(_SC_OPEN_MAX); fd > 2; fd--) internal_close(fd); internal_execve(program, const_cast(&argv[0]), const_cast(envp)); internal__exit(1); } return pid; } bool IsProcessRunning(pid_t pid) { int process_status; uptr waitpid_status = internal_waitpid(pid, &process_status, WNOHANG); int local_errno; if (internal_iserror(waitpid_status, &local_errno)) { VReport(1, "Waiting on the process failed (errno %d).\n", local_errno); return false; } return waitpid_status == 0; } int WaitForProcess(pid_t pid) { int process_status; uptr waitpid_status = internal_waitpid(pid, &process_status, 0); int local_errno; if (internal_iserror(waitpid_status, &local_errno)) { VReport(1, "Waiting on the process failed (errno %d).\n", local_errno); return -1; } return process_status; } bool IsStateDetached(int state) { return state == PTHREAD_CREATE_DETACHED; } } // namespace __sanitizer #endif // SANITIZER_POSIX @ 1.3 log @make this actually be GCC 12.3.0's libsanitizer. the libsanitizer we used with GCC 9 and GCC 10 was significantly ahead of the GCC 9 and GCC 10 provided versions. @ text @d293 1 a293 1 void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) { d386 2 a387 2 int my_pthread_attr_getstack(void *attr, void **addr, uptr *size) { #if !SANITIZER_GO && !SANITIZER_MAC d400 1 a400 1 my_pthread_attr_getstack(attr, (void**)&stackaddr, &stacksize); @ 1.2 log @revert sanitizer back to the version we were using with GCC 9, since that one was already newer than the GCC 10 version. @ text @a20 1 #include "sanitizer_platform_limits_openbsd.h" d63 2 a64 5 // In the default Solaris compilation environment, madvise() is declared // to take a caddr_t arg; casting it to void * results in an invalid // conversion error, so use char * instead. madvise((char *)beg_aligned, end_aligned - beg_aligned, SANITIZER_MADVISE_DONTNEED); d70 1 a70 1 madvise((char *)addr, size, MADV_NOHUGEPAGE); d72 1 a72 1 madvise((char *)addr, size, MADV_HUGEPAGE); d78 1 a78 1 return madvise((char *)addr, length, MADV_DONTDUMP) == 0; d80 1 a80 1 return madvise((char *)addr, length, MADV_NOCORE) == 0; a130 8 void SleepForSeconds(int seconds) { sleep(seconds); } void SleepForMillis(int millis) { usleep(millis * 1000); } d138 1 a138 1 sigact.sa_sigaction = (sa_sigaction_t)SIG_DFL; d154 2 d162 6 a167 1 static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough. d178 2 a179 2 void* base = MmapOrDie(kAltStackSize, __func__); altstack.ss_sp = (char*) base; a180 1 altstack.ss_size = kAltStackSize; d188 1 a188 1 altstack.ss_size = kAltStackSize; // Some sane value required on Darwin. d423 2 a424 1 fd_t stdin_fd, fd_t stdout_fd, fd_t stderr_fd) { d467 2 a468 1 execv(program, const_cast(&argv[0])); @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @initial import of GCC 10.3.0. main changes include: caveats: - ABI issue between c++14 and c++17 fixed - profile mode is removed from libstdc++ - -fno-common is now the default new features: - new flags -fallocation-dce, -fprofile-partial-training, -fprofile-reproducible, -fprofile-prefix-path, and -fanalyzer - many new compile and link time optimisations - enhanced drive optimisations - openacc 2.6 support - openmp 5.0 features - new warnings: -Wstring-compare and -Wzero-length-bounds - extended warnings: -Warray-bounds, -Wformat-overflow, -Wrestrict, -Wreturn-local-addr, -Wstringop-overflow, -Warith-conversion, -Wmismatched-tags, and -Wredundant-tags - some likely C2X features implemented - more C++20 implemented - many new arm & intel CPUs known hundreds of reported bugs are fixed. full list of changes can be found at: https://gcc.gnu.org/gcc-10/changes.html @ text @@ 1.1.1.2 log @initial import of GCC 10.4.0 sources. mostly a large list of PRs fixed (210 total), plus one x86-64 specific change related to MMX and 64 bit integer return. https://gcc.gnu.org/gcc-10/changes.html links to the full list of PRs fixed. @ text @d172 1 a172 6 static uptr GetAltStackSize() { // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be // more costly that you think. However GetAltStackSize is only call 2-3 times // per thread so don't cache the evaluation. return SIGSTKSZ * 4; } d183 2 a184 2 altstack.ss_size = GetAltStackSize(); altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__); d186 1 d194 1 a194 1 altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin. @ 1.1.1.3 log @initial import of GCC 12.3.0. major changes in GCC 11 included: - The default mode for C++ is now -std=gnu++17 instead of -std=gnu++14. - When building GCC itself, the host compiler must now support C++11, rather than C++98. - Some short options of the gcov tool have been renamed: -i to -j and -j to -H. - ThreadSanitizer improvements. - Introduce Hardware-assisted AddressSanitizer support. - For targets that produce DWARF debugging information GCC now defaults to DWARF version 5. This can produce up to 25% more compact debug information compared to earlier versions. - Many optimisations. - The existing malloc attribute has been extended so that it can be used to identify allocator/deallocator API pairs. A pair of new -Wmismatched-dealloc and -Wmismatched-new-delete warnings are added. - Other new warnings: -Wsizeof-array-div, enabled by -Wall, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element. -Wstringop-overread, enabled by default, warns about calls to string functions reading past the end of the arrays passed to them as arguments. -Wtsan, enabled by default, warns about unsupported features in ThreadSanitizer (currently std::atomic_thread_fence). - Enchanced warnings: -Wfree-nonheap-object detects many more instances of calls to deallocation functions with pointers not returned from a dynamic memory allocation function. -Wmaybe-uninitialized diagnoses passing pointers or references to uninitialized memory to functions taking const-qualified arguments. -Wuninitialized detects reads from uninitialized dynamically allocated memory. -Warray-parameter warns about functions with inconsistent array forms. -Wvla-parameter warns about functions with inconsistent VLA forms. - Several new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. - Several C++20 features have been implemented. - The C++ front end has experimental support for some of the upcoming C++23 draft. - Several new C++ warnings. - Enhanced Arm, AArch64, x86, and RISC-V CPU support. - The implementation of how program state is tracked within -fanalyzer has been completely rewritten with many enhancements. see https://gcc.gnu.org/gcc-11/changes.html for a full list. major changes in GCC 12 include: - An ABI incompatibility between C and C++ when passing or returning by value certain aggregates containing zero width bit-fields has been discovered on various targets. x86-64, ARM and AArch64 will always ignore them (so there is a C ABI incompatibility between GCC 11 and earlier with GCC 12 or later), PowerPC64 ELFv2 always take them into account (so there is a C++ ABI incompatibility, GCC 4.4 and earlier compatible with GCC 12 or later, incompatible with GCC 4.5 through GCC 11). RISC-V has changed the handling of these already starting with GCC 10. As the ABI requires, MIPS takes them into account handling function return values so there is a C++ ABI incompatibility with GCC 4.5 through 11. - STABS: Support for emitting the STABS debugging format is deprecated and will be removed in the next release. All ports now default to emit DWARF (version 2 or later) debugging info or are obsoleted. - Vectorization is enabled at -O2 which is now equivalent to the original -O2 -ftree-vectorize -fvect-cost-model=very-cheap. - GCC now supports the ShadowCallStack sanitizer. - Support for __builtin_shufflevector compatible with the clang language extension was added. - Support for attribute unavailable was added. - Support for __builtin_dynamic_object_size compatible with the clang language extension was added. - New warnings: -Wbidi-chars warns about potentially misleading UTF-8 bidirectional control characters. -Warray-compare warns about comparisons between two operands of array type. - Some new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. - Several C++23 features have been implemented. - Many C++ enhancements across warnings and -f options. see https://gcc.gnu.org/gcc-12/changes.html for a full list. @ text @d21 1 d64 5 a68 2 internal_madvise(beg_aligned, end_aligned - beg_aligned, SANITIZER_MADVISE_DONTNEED); d74 1 a74 1 internal_madvise(addr, size, MADV_NOHUGEPAGE); d76 1 a76 1 internal_madvise(addr, size, MADV_HUGEPAGE); d82 1 a82 1 return internal_madvise(addr, length, MADV_DONTDUMP) == 0; d84 1 a84 1 return internal_madvise(addr, length, MADV_NOCORE) == 0; d135 8 d150 1 a150 1 sigact.sa_handler = SIG_DFL; a165 2 bool CreateDir(const char *pathname) { return mkdir(pathname, 0755) == 0; } d433 1 a433 2 const char *const envp[], fd_t stdin_fd, fd_t stdout_fd, fd_t stderr_fd) { d476 1 a476 2 internal_execve(program, const_cast(&argv[0]), const_cast(envp)); @ 1.1.1.4 log @initial import of GCC 14.3.0. major changes in GCC 13: - improved sanitizer - zstd debug info compression - LTO improvements - SARIF based diagnostic support - new warnings: -Wxor-used-as-pow, -Wenum-int-mismatch, -Wself-move, -Wdangling-reference - many new -Wanalyzer* specific warnings - enhanced warnings: -Wpessimizing-move, -Wredundant-move - new attributes to mark file descriptors, c++23 "assume" - several C23 features added - several C++23 features added - many new features for Arm, x86, RISC-V major changes in GCC 14: - more strict C99 or newer support - ia64* marked deprecated (but seemingly still in GCC 15.) - several new hardening features - support for "hardbool", which can have user supplied values of true/false - explicit support for stack scrubbing upon function exit - better auto-vectorisation support - added clang-compatible __has_feature and __has_extension - more C23, including -std=c23 - several C++26 features added - better diagnostics in C++ templates - new warnings: -Wnrvo, Welaborated-enum-base - many new features for Arm, x86, RISC-V - possible ABI breaking change for SPARC64 and small structures with arrays of floats. @ text @d293 1 a293 1 void PlatformPrepareForSandboxing(void *args) { d386 2 a387 2 int internal_pthread_attr_getstack(void *attr, void **addr, uptr *size) { #if !SANITIZER_GO && !SANITIZER_APPLE d400 1 a400 1 internal_pthread_attr_getstack(attr, (void **)&stackaddr, &stacksize); @