Re: [PATCH] [Ada] Make clockid_t type public on GNU/kFreeBSD
I don't have commit access so could you please do so on my behalf? This bug applies to the 9 branch too, so please consider backporting it. Thanks, James > On 4 Jul 2019, at 07:50, Arnaud Charlet wrote: > > OK, thanks. > >> From: James Clarke >> >> Monotonic_Clock and RT_Resolution in the recently-added s-tpopmo.adb >> call clock_gettime/clock_getres with the integral constants from OSC and >> thus rely on clockid_t being an integral type, so we cannot hide it on >> GNU/kFreeBSD. Instead, make the definition public to match all the other >> implementations. >> >> gcc/ada >> * libgnarl/s-osinte__kfreebsd-gnu.ads (clockid_t): Make type >> definition public. >> (CLOCK_REALTIME): Make value public. >> --- >> gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads | 8 ++-- >> 1 file changed, 2 insertions(+), 6 deletions(-) >> >> diff --git a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads >> b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads >> index 408187314..b60ffd2c0 100644 >> --- a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads >> +++ b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads >> @@ -206,9 +206,8 @@ package System.OS_Interface is >>function nanosleep (rqtp, rmtp : access timespec) return int; >>pragma Import (C, nanosleep, "nanosleep"); >> >> - type clockid_t is private; >> - >> - CLOCK_REALTIME : constant clockid_t; >> + type clockid_t is new int; >> + CLOCK_REALTIME : constant clockid_t := 0; >> >>function clock_gettime >> (clock_id : clockid_t; >> @@ -607,9 +606,6 @@ private >>end record; >>pragma Convention (C, timespec); >> >> - type clockid_t is new int; >> - CLOCK_REALTIME : constant clockid_t := 0; >> - >>type pthread_attr_t is record >> detachstate : int; >> schedpolicy : int; >> -- >> 2.17.1 >>
[PATCH] [Ada] Make clockid_t type public on GNU/kFreeBSD
From: James Clarke Monotonic_Clock and RT_Resolution in the recently-added s-tpopmo.adb call clock_gettime/clock_getres with the integral constants from OSC and thus rely on clockid_t being an integral type, so we cannot hide it on GNU/kFreeBSD. Instead, make the definition public to match all the other implementations. gcc/ada * libgnarl/s-osinte__kfreebsd-gnu.ads (clockid_t): Make type definition public. (CLOCK_REALTIME): Make value public. --- gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads index 408187314..b60ffd2c0 100644 --- a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads +++ b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads @@ -206,9 +206,8 @@ package System.OS_Interface is function nanosleep (rqtp, rmtp : access timespec) return int; pragma Import (C, nanosleep, "nanosleep"); - type clockid_t is private; - - CLOCK_REALTIME : constant clockid_t; + type clockid_t is new int; + CLOCK_REALTIME : constant clockid_t := 0; function clock_gettime (clock_id : clockid_t; @@ -607,9 +606,6 @@ private end record; pragma Convention (C, timespec); - type clockid_t is new int; - CLOCK_REALTIME : constant clockid_t := 0; - type pthread_attr_t is record detachstate : int; schedpolicy : int; -- 2.17.1
[PATCH] Put __dso_handle in .sdata/.sbss on ia64
The symbol is exposed to C by dso_handle.h, and since it's a single 8-byte pointer, it is just within the threshold for being in the small data (or bss) section, so code accessing it will use GP-relative addressing. Therefore we must put it in .sdata/.sbss in case our other data sections grow too big and we overflow the 22-bit relocation. libgcc/ * config/ia64/crtbegin.S (__dso_handle): Put in .sdata/.sbss rather than .data/.bss so it can be accessed via gp-relative addressing. --- libgcc/config/ia64/crtbegin.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgcc/config/ia64/crtbegin.S b/libgcc/config/ia64/crtbegin.S index 5b2f55936dd..213ccd7ab8b 100644 --- a/libgcc/config/ia64/crtbegin.S +++ b/libgcc/config/ia64/crtbegin.S @@ -45,11 +45,11 @@ dtor_ptr: .type __dso_handle,@object .size __dso_handle,8 #ifdef SHARED - .section .data + .section .sdata __dso_handle: data8 __dso_handle #else - .section .bss + .section .sbss .align 8 __dso_handle: .skip 8 -- 2.20.1
Re: [PATCH] PR bootstrap/87338: Fix ia64 bootstrap comparison regression in r257511
On 26 Apr 2019, at 15:24, Jeff Law wrote: > On 4/26/19 2:01 AM, Jakub Jelinek wrote: >> On Fri, Apr 26, 2019 at 08:58:18AM +0200, Richard Biener wrote: >>> On Thu, Apr 25, 2019 at 7:52 PM James Clarke wrote: >>>> >>>> By using ASM_OUTPUT_LABEL, r257511 forced the assembler to start a new >>>> bundle when emitting an inline entry label on. Instead, use >>>> ASM_OUTPUT_DEBUG_LABEL like for the block begin and end labels so tags are >>>> emitted rather than labels. >>> >>> Looks sensible. mips is the other port defining ASM_OUTPUT_DEBUG_LABEL, >>> so either you can do a bootstrap/test on mips as well or I'm asking Matthew >>> for approval here. >> >> And arm and arc, while they don't define their own ASM_OUTPUT_DEBUG_LABEL, >> they override TARGET_ASM_INTERNAL_LABEL which is the underlying >> implementation of the default ASM_OUTPUT_DEBUG_LABEL. But I agree that >> for mips it is a significant change, while arm and arc call >> default_internal_label >> from their hook, just do additional stuff. > My tester will bootstrap the mips port within 24hrs after the change is > committed. Happy to contact y'all if something goes wrong ;-) If you > don't hear from me, assume it didn't cause problems. Hi all, It looks like there are no objections to this (assuming it doesn't regress anything), so could somebody please commit this to trunk? Thanks, James
[PATCH] PR bootstrap/87338: Fix ia64 bootstrap comparison regression in r257511
By using ASM_OUTPUT_LABEL, r257511 forced the assembler to start a new bundle when emitting an inline entry label on. Instead, use ASM_OUTPUT_DEBUG_LABEL like for the block begin and end labels so tags are emitted rather than labels. gcc/ PR bootstrap/87338 * dwarf2out.c (dwarf2out_inline_entry): Use ASM_OUTPUT_DEBUG_LABEL instead of ASM_GENERATE_INTERNAL_LABEL and ASM_OUTPUT_LABEL. --- gcc/dwarf2out.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b9a624e..c348692 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -27670,11 +27670,8 @@ dwarf2out_inline_entry (tree block) if (cur_line_info_table) ied->view = cur_line_info_table->view; - char label[MAX_ARTIFICIAL_LABEL_BYTES]; - - ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_INLINE_ENTRY_LABEL, - BLOCK_NUMBER (block)); - ASM_OUTPUT_LABEL (asm_out_file, label); + ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_INLINE_ENTRY_LABEL, + BLOCK_NUMBER (block)); } /* Called from finalize_size_functions for size functions so that their body -- 1.8.5.3
[PATCH] RISC-V: Pass -mno-relax through to assembler if supported
GCC will emit ".option (no)relax" in its outputted assembly, but when using it as an assembler driver, such as for preprocessed assembly, it's merely preprocessing and therefore will not generate this directive. Therefore we should pass -mno-relax on to the assembler if specified (and supported) as we do for other flags. gcc/ * configure.ac: (gcc_cv_as_riscv_mno_relax): Check if the assembler supports -mno-relax. * configure: Regenerate * config.in: Regenerate * config/riscv/riscv.h (ASM_MNO_RELAX_SPEC): Define based on HAVE_AS_MNO_RELAX_OPTION. (ASM_SPEC): Add %(asm_mno_relax_spec). (EXTRA_SPECS): Define to include $(asm_mno_relax_spec) and SUBTARGET_EXTRA_SPECS. (SUBTARGET_EXTRA_SPECS): Provide empty default value. --- gcc/config/riscv/riscv.h | 25 + gcc/configure.ac | 8 2 files changed, 33 insertions(+) diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index 13e15cc85..77d92acb2 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -55,14 +55,39 @@ along with GCC; see the file COPYING3. If not see #define TARGET_64BIT (__riscv_xlen == 64) #endif /* IN_LIBGCC2 */ +#ifdef HAVE_AS_MNO_RELAX_OPTION +#define ASM_MNO_RELAX_SPEC "%{mno-relax}" +#else +#define ASM_MNO_RELAX_SPEC "" +#endif + #undef ASM_SPEC #define ASM_SPEC "\ %(subtarget_asm_debugging_spec) \ %{" FPIE_OR_FPIC_SPEC ":-fpic} \ %{march=*} \ %{mabi=*} \ +%(asm_mno_relax_spec) \ %(subtarget_asm_spec)" +/* This macro defines names of additional specifications to put in the specs + that can be used in various specifications like CC1_SPEC. Its definition + is an initializer with a subgrouping for each command option. + + Each subgrouping contains a string constant, that defines the + specification name, and a string constant that used by the GCC driver + program. + + Do not define this macro if it does not need to do anything. */ + +#define EXTRA_SPECS\ + { "asm_mno_relax_spec", ASM_MNO_RELAX_SPEC }, \ + SUBTARGET_EXTRA_SPECS + +#ifndef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS +#endif + #define TARGET_DEFAULT_CMODEL CM_MEDLOW #define LOCAL_LABEL_PREFIX "." diff --git a/gcc/configure.ac b/gcc/configure.ac index 260d987da..4b7c0c79f 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4827,6 +4827,14 @@ pointers into PC-relative form.]) [Requesting --with-nan= requires assembler support for -mnan=]) fi ;; + + riscv*-*-*) +gcc_GAS_CHECK_FEATURE([-mno-relax option], gcc_cv_as_riscv_mno_relax,, + [-mno-relax], [.text],, + [AC_DEFINE(HAVE_AS_MNO_RELAX_OPTION, 1, + [Define if your assembler supports -mno-relax option.])]) +;; + s390*-*-*) gcc_GAS_CHECK_FEATURE([.gnu_attribute support], gcc_cv_as_s390_gnu_attribute, [2,18,0],, -- 2.14.1
[PATCH v2] Enable decimal float on x86_64 kFreeBSD and Hurd
config/ * dfp.m4 (enable_decimal_float): Enable for x86_64*-*-gnu* to catch x86_64 kFreeBSD and Hurd. gcc/ * configure: Regenerate. libdecnumber/ * configure: Regenerate. libgcc/ * configure: Regenerate. --- Hi, Apologies; I accidentally sent an older version of this to the list, so here's the correct version. Also, the motivation for this patch: Decimal float has been enabled on GNU/Hurd for a while, by adding the i?86*-*-gnu* pattern. However, this also matches i386 GNU/kFreeBSD triples, such as i386-unknown-kfreebsd-gnu, yet since there is not currently an x86_64 GNU/Hurd port there is no pattern for x86_64*-*-gnu*, and so x86_64 GNU/kFreeBSD also does not match anything. Thus, adding the x86_64 GNU/Hurd pattern both future-proofs the configure script for a time when such a sytem exists, as well as making x86_64 GNU/kFreeBSD match the behaviour of i386. Regards, James config/dfp.m4 | 2 +- gcc/configure | 2 +- libdecnumber/configure | 2 +- libgcc/configure | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/dfp.m4 b/config/dfp.m4 index 5b29089cec5..a137ddebf8c 100644 --- a/config/dfp.m4 +++ b/config/dfp.m4 @@ -21,7 +21,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; [ case $1 in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes diff --git a/gcc/configure b/gcc/configure index 60d373982fd..35564942bbf 100755 --- a/gcc/configure +++ b/gcc/configure @@ -7458,7 +7458,7 @@ else case $target in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes diff --git a/libdecnumber/configure b/libdecnumber/configure index 4cb732e80d4..b1588f4e884 100755 --- a/libdecnumber/configure +++ b/libdecnumber/configure @@ -4709,7 +4709,7 @@ else case $target in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes diff --git a/libgcc/configure b/libgcc/configure index b2f3f870844..f395474beac 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -4647,7 +4647,7 @@ else case $host in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes -- 2.17.0
[PATCH] Enable decimal float on x86_64 kFreeBSD and Hurd
config/ * dfp.m4 (enable_decimal_float): Enable for x86_64*-*-gnu* to catch x86_64 kFreeBSD and Hurd. gcc/ * configure: Regenerate. libdecnumber/ * configure: Regenerate. libgcc/ * configure: Regenerate. --- config/dfp.m4 | 2 +- gcc/configure | 2 +- libdecnumber/configure | 2 +- libgcc/configure | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/dfp.m4 b/config/dfp.m4 index 5b29089cec5..f9b447e1a9c 100644 --- a/config/dfp.m4 +++ b/config/dfp.m4 @@ -21,7 +21,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; [ case $1 in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes diff --git a/gcc/configure b/gcc/configure index 60d373982fd..46be6b93a2a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -7458,7 +7458,7 @@ else case $target in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes diff --git a/libdecnumber/configure b/libdecnumber/configure index 4cb732e80d4..0eb6e04ffe9 100755 --- a/libdecnumber/configure +++ b/libdecnumber/configure @@ -4709,7 +4709,7 @@ else case $target in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes diff --git a/libgcc/configure b/libgcc/configure index b2f3f870844..055ec66ce48 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -4647,7 +4647,7 @@ else case $host in powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ -i?86*-*-elfiamcu | i?86*-*-gnu* | \ +i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* \ i?86*-*-mingw* | x86_64*-*-mingw* | \ i?86*-*-cygwin* | x86_64*-*-cygwin*) enable_decimal_float=yes -- 2.17.0
[PATCH v2] PR rtl-optimization/83565: Fix 32-bit rotate on ia64
On ia64, 32-bit rotates are implemented by copying the lower 32 bits of a register into the upper half, then performing a right shift. However, depending on the bit pattern in question, this can leave the upper 32 bits as non-zero, despite being only a 32-bit unsigned result. Therefore add an extra zero_extract to mask these out. gcc/ PR rtl-optimization/83565 * gcc/config/ia64/ia64.md ("*rotrsi3_internal"): Mask out higher 32 bits from the shift result. ("*rotlsi3_internal"): Likewise --- [Resent because git send-email messed about with the headers, adding a second From: with a different email address, presumably since I ran git send-email from a directory with .git/config containing a user.email setting...] gcc/config/ia64/ia64.md | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md index b7cd52b..8198b54 100644 --- a/gcc/config/ia64/ia64.md +++ b/gcc/config/ia64/ia64.md @@ -3329,7 +3329,10 @@ (ior:DI (zero_extend:DI (match_dup 1)) (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32 (set (match_dup 3) - (lshiftrt:DI (match_dup 3) (match_dup 2)))] + (lshiftrt:DI (match_dup 3) (match_dup 2))) + (set (match_dup 3) + (zero_extract:DI (match_dup 3) + (const_int 32) (const_int 0)))] "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));") (define_expand "rotlsi3" @@ -3358,7 +3361,10 @@ (ior:DI (zero_extend:DI (match_dup 1)) (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32 (set (match_dup 3) - (lshiftrt:DI (match_dup 3) (match_dup 2)))] + (lshiftrt:DI (match_dup 3) (match_dup 2))) + (set (match_dup 3) + (zero_extract:DI (match_dup 3) + (const_int 32) (const_int 0)))] { operands[3] = gen_rtx_REG (DImode, REGNO (operands[0])); operands[2] = GEN_INT (32 - INTVAL (operands[2])); -- 1.7.10.4
[PATCH] PR rtl-optimization/83565: Fix 32-bit rotate on ia64
From: James Clarke <jrt...@jrtc27.com> On ia64, 32-bit rotates are implemented by copying the lower 32 bits of a register into the upper half, then performing a right shift. However, depending on the bit pattern in question, this can leave the upper 32 bits as non-zero, despite being only a 32-bit unsigned result. Therefore add an extra zero_extract to mask these out. gcc/ PR rtl-optimization/83565 * gcc/config/ia64/ia64.md ("*rotrsi3_internal"): Mask out higher 32 bits from the shift result. ("*rotlsi3_internal"): Likewise --- gcc/config/ia64/ia64.md | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md index b7cd52b..8198b54 100644 --- a/gcc/config/ia64/ia64.md +++ b/gcc/config/ia64/ia64.md @@ -3329,7 +3329,10 @@ (ior:DI (zero_extend:DI (match_dup 1)) (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32 (set (match_dup 3) - (lshiftrt:DI (match_dup 3) (match_dup 2)))] + (lshiftrt:DI (match_dup 3) (match_dup 2))) + (set (match_dup 3) + (zero_extract:DI (match_dup 3) + (const_int 32) (const_int 0)))] "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));") (define_expand "rotlsi3" @@ -3358,7 +3361,10 @@ (ior:DI (zero_extend:DI (match_dup 1)) (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32 (set (match_dup 3) - (lshiftrt:DI (match_dup 3) (match_dup 2)))] + (lshiftrt:DI (match_dup 3) (match_dup 2))) + (set (match_dup 3) + (zero_extract:DI (match_dup 3) + (const_int 32) (const_int 0)))] { operands[3] = gen_rtx_REG (DImode, REGNO (operands[0])); operands[2] = GEN_INT (32 - INTVAL (operands[2])); -- 1.7.10.4
[PATCH v2] PR sanitizer/78992: Fix sigaction definition on 32-bit sparc
libsanitizer: PR sanitizer/78992 * sanitizer_common/sanitizer_platform_limits_posix.h (struct __sanitizer_sigaction): Cherry-pick upstream r291561. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index 066bf41ffef..c139322839a 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -633,9 +633,12 @@ namespace __sanitizer { #ifndef __mips__ #if defined(__sparc__) #if __GLIBC_PREREQ (2, 20) -// On sparc glibc 2.19 and earlier sa_flags was unsigned long, and -// __glibc_reserved0 didn't exist. +// On sparc glibc 2.19 and earlier sa_flags was unsigned long. +#if defined(__arch64__) +// To maintain ABI compatibility on sparc64 when switching to an int, +// __glibc_reserved0 was added. int __glibc_reserved0; +#endif int sa_flags; #else unsigned long sa_flags; -- 2.11.0
[PATCH] PR sanitizer/78992: Fix sigaction definition on 32-bit sparc
libsanitizer: PR sanitizer/78992 * sanitizer_common/sanitizer_platform_limits_posix.h: sigaction should only have __glibc_reserved0 as a member on 64-bit sparc. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index 066bf41ffef..c139322839a 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -633,9 +633,12 @@ namespace __sanitizer { #ifndef __mips__ #if defined(__sparc__) #if __GLIBC_PREREQ (2, 20) -// On sparc glibc 2.19 and earlier sa_flags was unsigned long, and -// __glibc_reserved0 didn't exist. +// On sparc glibc 2.19 and earlier sa_flags was unsigned long. +#if defined(__arch64__) +// To maintain ABI compatibility on sparc64 when switching to an int, +// __glibc_reserved0 was added. int __glibc_reserved0; +#endif int sa_flags; #else unsigned long sa_flags; -- 2.11.0
[PATCH] Fix ICE for sparc targets in function_arg_record_value (PR target/77759)
gcc/ PR target/77759 * config/sparc/sparc.c (classify_data_t): Remove unused int_regs field. (classify_registers): Don't set int_regs. (function_arg_slotno): Don't initialise int_regs. Check slotno is within range for empty structs, just like int register-only structs. gcc/testsuite/ PR target/77759 * g++.dg/other/pr77759.C: New test. --- gcc/config/sparc/sparc.c | 10 +++--- gcc/testsuite/g++.dg/other/pr77759.C | 27 +++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index c622b66..7af8ba1 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -6294,7 +6294,6 @@ traverse_record_type (const_tree type, bool named, T *data, typedef struct { - bool int_regs; /* true if field eligible to int registers. */ bool fp_regs;/* true if field eligible to FP registers. */ bool fp_regs_in_first_word; /* true if such field in first word. */ } classify_data_t; @@ -6311,8 +6310,6 @@ classify_registers (const_tree, HOST_WIDE_INT bitpos, bool fp, if (bitpos < BITS_PER_WORD) data->fp_regs_in_first_word = true; } - else -data->int_regs = true; } /* Compute the slot number to pass an argument in. @@ -6439,7 +6436,7 @@ function_arg_slotno (const struct sparc_args *cum, machine_mode mode, if (TREE_CODE (type) == RECORD_TYPE) { - classify_data_t data = { false, false, false }; + classify_data_t data = { false, false }; traverse_record_type(type, named, ); @@ -6450,10 +6447,9 @@ function_arg_slotno (const struct sparc_args *cum, machine_mode mode, && slotno >= SPARC_FP_ARG_MAX - 1) return -1; - /* If there are only int args and all int slots are filled, -then must pass on stack. */ + /* If there are only int args or this is an empty record type, +and all int slots are filled, then must pass on stack. */ if (!data.fp_regs - && data.int_regs && slotno >= SPARC_INT_ARG_MAX) return -1; } diff --git a/gcc/testsuite/g++.dg/other/pr77759.C b/gcc/testsuite/g++.dg/other/pr77759.C new file mode 100644 index 000..4494bb5 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr77759.C @@ -0,0 +1,27 @@ +/* PR target/77759 + This testcase ICEd on sparc because function_arg_slotno did not treat empty + structs as being passed in integer registers and tried to assign the + struct pair_empty to register slot 6, causing function_arg_record_value to + fail the assertion that at least one register was available. */ +/* { dg-do compile { target sparc*-*-* } } */ + +struct empty {}; + +struct pair_empty +{ + struct empty a; + struct empty b; +}; + +void f1(int slot0 __attribute__((unused)), int slot1 __attribute__((unused)), + int slot2 __attribute__((unused)), int slot3 __attribute__((unused)), + int slot4 __attribute__((unused)), int slot5 __attribute__((unused)), + struct pair_empty pair __attribute__((unused))) +{ +} + +void f2(void) +{ + struct pair_empty pair; + f1(0, 0, 0, 0, 0, 0, pair); +} -- 2.9.3
Re: [PATCH v2] Ensure source_date_epoch is always initialised
Hi, > On 24 May 2016, at 11:59, Dholewrote: > > Hey! > > I'm the original author of the SOURCE_DATE_EPOCH patch. > > I've just seen this. I believe that this bug was fixed in the the > rework of the patch I sent some days ago [1], although the latest > version of that patch has not been reviewed yet. In [1] the > initialization of source_date_epoch is done at init.c > (cpp_create_reader), so now it should be initialized properly even when > just calling the preprocessor. I tested your example and it gives the > expected output. > > Although thinking further, maybe it would be more wise to use "0" as a > default value, to mean "not yet set", so that errors like this are > avoided. So source_date_epoch could be: > 0: not yet set > negative: disabled > positive: use this value as SOURCE_DATE_EPOCH > > In such case, SOURCE_DATE_EPOCH would need to be a positive number > instead of a non-negative number. 0 *is* a valid SOURCE_DATE_EPOCH, ie Jan 1 1970 00:00:00, and should definitely be allowed. I see your patch continues to put some of the code inside c-family? Is there a reason for doing that instead of keeping it all inside libcpp like mine, given it’s inherently preprocessor-only? You’ve also merged all the error paths into one message which is not as helpful. Regards, James signature.asc Description: Message signed with OpenPGP using GPGMail
[PATCH v2] Ensure source_date_epoch is always initialised
gcc/c-family PR preprocessor/71183 * c-common.c (get_source_date_epoch): Move to libcpp/init.c. * c-common.h (get_source_date_epoch): Remove definition, as it is now internal to libcpp/init.c. * c-lex.c (c_lex_with_flags): Remove source_date_epoch initialization, as this is now done by libcpp. gcc/testsuite/ PR preprocessor/71183 * gcc.dg/cpp/special/date-time.c: New testcase. * gcc.dg/cpp/special/date-time.exp: New file. Sets the SOURCE_DATE_EPOCH environment variable for date-time.c. libcpp/ PR preprocessor/71183 * include/cpplib.h (cpp_init_source_date_epoch): Remove definition, as it is now internal to init.c. * init.c (get_source_date_epoch): Moved from gcc/c-family/c-common.c, and uses cpp_error instead of fatal_error. (cpp_init_source_date_epoch): Drop source_date_epoch argument and call get_source_date_epoch to get the value. (cpp_post_options): Call cpp_init_source_date_epoch. --- Changes from v1: * Moved cpp_init_source_date_epoch call from cpp_init_source_date_epoch to cpp_post_options, as the error callback is otherwise not set and would lead to an ICE if cpp_error was called. * Dropped forward declaration of cpp_init_source_date_epoch, as the call to it now comes after its definition. gcc/c-family/c-common.c| 33 gcc/c-family/c-common.h| 5 --- gcc/c-family/c-lex.c | 3 -- gcc/testsuite/gcc.dg/cpp/special/date-time.c | 5 +++ gcc/testsuite/gcc.dg/cpp/special/date-time.exp | 35 + libcpp/include/cpplib.h| 3 -- libcpp/init.c | 42 -- 7 files changed, 79 insertions(+), 47 deletions(-) diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 146e805..83f38dd 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -12791,39 +12791,6 @@ valid_array_size_p (location_t loc, tree type, tree name) return true; } -/* Read SOURCE_DATE_EPOCH from environment to have a deterministic - timestamp to replace embedded current dates to get reproducible - results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */ -time_t -get_source_date_epoch () -{ - char *source_date_epoch; - long long epoch; - char *endptr; - - source_date_epoch = getenv ("SOURCE_DATE_EPOCH"); - if (!source_date_epoch) -return (time_t) -1; - - errno = 0; - epoch = strtoll (source_date_epoch, , 10); - if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN)) - || (errno != 0 && epoch == 0)) -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"strtoll: %s\n", xstrerror(errno)); - if (endptr == source_date_epoch) -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"no digits were found: %s\n", endptr); - if (*endptr != '\0') -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"trailing garbage: %s\n", endptr); - if (epoch < 0) -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"value must be nonnegative: %lld \n", epoch); - - return (time_t) epoch; -} - /* Check and possibly warn if two declarations have contradictory attributes, such as always_inline vs. noinline. */ diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 0ee9f56..63fd2b9 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1482,9 +1482,4 @@ extern bool valid_array_size_p (location_t, tree, tree); extern bool cilk_ignorable_spawn_rhs_op (tree); extern bool cilk_recognize_spawn (tree, tree *); -/* Read SOURCE_DATE_EPOCH from environment to have a deterministic - timestamp to replace embedded current dates to get reproducible - results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */ -extern time_t get_source_date_epoch (void); - #endif /* ! GCC_C_COMMON_H */ diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 38a428d..5bab8d1 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -389,9 +389,6 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, enum cpp_ttype type; unsigned char add_flags = 0; enum overflow_type overflow = OT_NONE; - time_t source_date_epoch = get_source_date_epoch (); - - cpp_init_source_date_epoch (parse_in, source_date_epoch); timevar_push (TV_CPP); retry: diff --git a/gcc/testsuite/gcc.dg/cpp/special/date-time.c b/gcc/testsuite/gcc.dg/cpp/special/date-time.c new file mode 100644 index 000..3304b75 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/special/date-time.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +__DATE__ +__TIME__ +/* { dg-final { scan-file date-time.i "\"Jul 4 1978\"" } } */ +/*
[PATCH] Ensure source_date_epoch is always initialised
gcc/c-family PR preprocessor/71183 * c-common.c (get_source_date_epoch): Move to libcpp/init.c. * c-common.h (get_source_date_epoch): Remove definition, as it is now internal to libcpp/init.c. * c-lex.c (c_lex_with_flags): Remove source_date_epoch initialization, as this is now done by libcpp. gcc/testsuite/ PR preprocessor/71183 * gcc.dg/cpp/special/date-time.c: New testcase. * gcc.dg/cpp/special/date-time.exp: New file. Sets the SOURCE_DATE_EPOCH environment variable for date-time.c. libcpp/ PR preprocessor/71183 * include/cpplib.h (cpp_init_source_date_epoch): Remove definition, as it is now internal to init.c. * init.c (cpp_create_reader): Initialize source_date_epoch. (get_source_date_epoch): Moved from gcc/c-family/c-common.c, and uses cpp_error instead of fatal_error. (cpp_init_source_date_epoch): Drop source_date_epoch argument and call get_source_date_epoch to get the value. --- gcc/c-family/c-common.c| 33 gcc/c-family/c-common.h| 5 --- gcc/c-family/c-lex.c | 3 -- gcc/testsuite/gcc.dg/cpp/special/date-time.c | 5 +++ gcc/testsuite/gcc.dg/cpp/special/date-time.exp | 35 + libcpp/include/cpplib.h| 3 -- libcpp/init.c | 43 -- 7 files changed, 80 insertions(+), 47 deletions(-) diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 146e805..83f38dd 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -12791,39 +12791,6 @@ valid_array_size_p (location_t loc, tree type, tree name) return true; } -/* Read SOURCE_DATE_EPOCH from environment to have a deterministic - timestamp to replace embedded current dates to get reproducible - results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */ -time_t -get_source_date_epoch () -{ - char *source_date_epoch; - long long epoch; - char *endptr; - - source_date_epoch = getenv ("SOURCE_DATE_EPOCH"); - if (!source_date_epoch) -return (time_t) -1; - - errno = 0; - epoch = strtoll (source_date_epoch, , 10); - if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN)) - || (errno != 0 && epoch == 0)) -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"strtoll: %s\n", xstrerror(errno)); - if (endptr == source_date_epoch) -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"no digits were found: %s\n", endptr); - if (*endptr != '\0') -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"trailing garbage: %s\n", endptr); - if (epoch < 0) -fatal_error (UNKNOWN_LOCATION, "environment variable $SOURCE_DATE_EPOCH: " -"value must be nonnegative: %lld \n", epoch); - - return (time_t) epoch; -} - /* Check and possibly warn if two declarations have contradictory attributes, such as always_inline vs. noinline. */ diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 0ee9f56..63fd2b9 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1482,9 +1482,4 @@ extern bool valid_array_size_p (location_t, tree, tree); extern bool cilk_ignorable_spawn_rhs_op (tree); extern bool cilk_recognize_spawn (tree, tree *); -/* Read SOURCE_DATE_EPOCH from environment to have a deterministic - timestamp to replace embedded current dates to get reproducible - results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */ -extern time_t get_source_date_epoch (void); - #endif /* ! GCC_C_COMMON_H */ diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 38a428d..5bab8d1 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -389,9 +389,6 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, enum cpp_ttype type; unsigned char add_flags = 0; enum overflow_type overflow = OT_NONE; - time_t source_date_epoch = get_source_date_epoch (); - - cpp_init_source_date_epoch (parse_in, source_date_epoch); timevar_push (TV_CPP); retry: diff --git a/gcc/testsuite/gcc.dg/cpp/special/date-time.c b/gcc/testsuite/gcc.dg/cpp/special/date-time.c new file mode 100644 index 000..3304b75 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/special/date-time.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +__DATE__ +__TIME__ +/* { dg-final { scan-file date-time.i "\"Jul 4 1978\"" } } */ +/* { dg-final { scan-file date-time.i "\"21:24:16\"" } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/special/date-time.exp b/gcc/testsuite/gcc.dg/cpp/special/date-time.exp new file mode 100644 index 000..3c43143 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/special/date-time.exp @@ -0,0 +1,35 @@ +# Copyright (C) 1997-2016 Free Software Foundation, Inc. + +# This program
Re: [PATCH v4 0/2] Fix OS X Yosemite-related issues
Just checking on the status of this as I haven't heard anything further for a while. James Clarke On 26 Aug 2014, at 08:11, James Clarke jrt...@jrtc27.com wrote: These patches combine to address PR target/61407, meaning that GCC is able to bootstrap on OS X Yosemite. Changes from v3: [PATCH v4 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__: * Unchanged [PATCH v4 2/2] Fixed dirent sanitizer for 32-bit OS X builds: * Check whether the _DARWIN_FEATURE_64_BIT_INODE macro is defined rather than its value James Clarke (2): Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ Fixed dirent sanitizer for 32-bit OS X builds gcc/config/darwin-c.c | 25 -- gcc/config/darwin-driver.c | 2 -- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 +++ .../sanitizer_platform_limits_posix.cc | 3 ++- .../sanitizer_platform_limits_posix.h | 9 8 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c -- 2.1.0
[PATCH v2 0/2] Fix OS X Yosemite-related issues
These patches combine to address PR target/61407, meaning that GCC is able to bootstrap on OS X 10.10 Yosemite. James Clarke (2): Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ Fixed dirent sanitizer for 32-bit OS X builds gcc/config/darwin-c.c | 25 -- gcc/config/darwin-driver.c | 2 -- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 +++ .../sanitizer_platform_limits_posix.cc | 3 ++- .../sanitizer_platform_limits_posix.h | 9 8 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c -- 2.1.0
[PATCH v2 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
Previously, this macro had taken the form 10X0, where X is the minor version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X 10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10. Added a test for the new format and fixed the formatting for the existing ones. gcc/ChangeLog: * config/darwin-c.c (version_as_macro): Added extra 0 for OS X 10.10 and above * config/darwin-driver.c (darwin_find_version_from_kernel): Removed kernel version check to avoid incrementing it after every major OS X release gcc/testsuite/ChangeLog: * gcc.db/darwin-minversion-1.c: Fixed formatting * gcc.db/darwin-minversion-2.c: Fixed formatting * gcc.db/darwin-minversion-3.c: Fixed formatting * gcc.dg/darwin-minversion-4.c: Added test for OS X 10.10 --- gcc/config/darwin-c.c | 25 +++-- gcc/config/darwin-driver.c | 2 -- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 6 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 892ba35..7fe4b1f 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -571,21 +571,34 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) } /* Return the value of darwin_macosx_version_min suitable for the - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, so '10.4.2' + becomes 1040 and '10.10.0' becomes 101000. The lowest digit is + always zero, as is the second lowest for '10.10.x' and above. Print a warning if the version number can't be understood. */ static const char * version_as_macro (void) { - static char result[] = 1000; + static char result[7] = 1000; + int minorDigitIdx; if (strncmp (darwin_macosx_version_min, 10., 3) != 0) goto fail; if (! ISDIGIT (darwin_macosx_version_min[3])) goto fail; - result[2] = darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] != '\0' - darwin_macosx_version_min[4] != '.') + + minorDigitIdx = 3; + result[2] = darwin_macosx_version_min[minorDigitIdx++]; + if (ISDIGIT (darwin_macosx_version_min[minorDigitIdx])) + { +/* Starting with OS X 10.10, the macro ends '00' rather than '0', + i.e. 10.10.x becomes 101000 rather than 10100. */ +result[3] = darwin_macosx_version_min[minorDigitIdx++]; +result[4] = '0'; +result[5] = '0'; +result[6] = '\0'; + } + if (darwin_macosx_version_min[minorDigitIdx] != '\0' + darwin_macosx_version_min[minorDigitIdx] != '.') goto fail; return result; diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 8b6ae93..eb478e8 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -57,8 +57,6 @@ darwin_find_version_from_kernel (char *new_flag) version_p = osversion + 1; if (ISDIGIT (*version_p)) major_vers = major_vers * 10 + (*version_p++ - '0'); - if (major_vers 4 + 9) -goto parse_failed; if (*version_p++ != '.') goto parse_failed; version_pend = strchr(version_p, '.'); diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc/testsuite/gcc.dg/darwin-minversion-1.c index d8a3243..6221d61 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc/testsuite/gcc.dg/darwin-minversion-2.c index fd4975a..8e18d52 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 -mmacosx-version-min=10.3 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-3.c b/gcc/testsuite/gcc.dg/darwin-minversion-3.c index d0c5934..4fcb969 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-3.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-3.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.4.10 } */ /* { dg-do compile { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-4.c b/gcc/testsuite/gcc.dg/darwin-minversion-4.c new file mode 100644 index 000..1cb42eb --- /dev/null +++
[PATCH v2 2/2] Fixed dirent sanitizer for 32-bit OS X builds
The __DARWIN_64_BIT_INO_T macro is used to indicate whether dirent.d_ino is 64-bit or not, and so should be sized appropriately. Additionally, dirent.d_seekoff should only be defined/checked when __DARWIN_64_BIT_INO_T is defined. libsanitizer/ChangeLog: * sanitizer_common/sanitizer_platform_limits_posix.cc: Only check dirent.d_seekoff on OS X when performing a 64-bit build. * sanitizer_common/sanitizer_platform_limits_posix.h: Only define dirent.d_seekoff on OS X when performing a 64-bit build, and make dirent.d_ino the correct size (32-bit) when performing a 32-bit build. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index a93d38d..0d1870b 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) = sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC __DARWIN_64_BIT_INO_T +// The 'd_seekoff' field is only present on OS X for 64-bit builds CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); #elif SANITIZER_FREEBSD // There is no 'd_off' field on FreeBSD. diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index dece2d3..73a4c3f 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -392,12 +392,21 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +# if __DARWIN_64_BIT_INO_T struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +# else + struct __sanitizer_dirent { +unsigned int d_ino; +// No d_seekoff for 32-bit +unsigned short d_reclen; +// more fields that we don't care about + }; +# endif #elif SANITIZER_FREEBSD struct __sanitizer_dirent { unsigned int d_fileno; -- 2.1.0
[PATCH v3 0/2] Fix OS X Yosemite-related issues
These patches combine to address PR target/61407, meaning that GCC is able to bootstrap on OS X Yosemite. Changes from v2: [PATCH v3 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__: * Unchanged [PATCH v3 2/2] Fixed dirent sanitizer for 32-bit OS X builds: * Switch to using the public _DARWIN_FEATURE_64_BIT_INODE macro rather than the internal __DARWIN_64_BIT_INO_T macro James Clarke (2): Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ Fixed dirent sanitizer for 32-bit OS X builds gcc/config/darwin-c.c | 25 -- gcc/config/darwin-driver.c | 2 -- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 +++ .../sanitizer_platform_limits_posix.cc | 3 ++- .../sanitizer_platform_limits_posix.h | 9 8 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c -- 2.1.0
[PATCH v3 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
Previously, this macro had taken the form 10X0, where X is the minor version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X 10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10. Added a test for the new format and fixed the formatting for the existing ones. gcc/ChangeLog: * config/darwin-c.c (version_as_macro): Added extra 0 for OS X 10.10 and above * config/darwin-driver.c (darwin_find_version_from_kernel): Removed kernel version check to avoid incrementing it after every major OS X release gcc/testsuite/ChangeLog: * gcc.db/darwin-minversion-1.c: Fixed formatting * gcc.db/darwin-minversion-2.c: Fixed formatting * gcc.db/darwin-minversion-3.c: Fixed formatting * gcc.dg/darwin-minversion-4.c: Added test for OS X 10.10 --- gcc/config/darwin-c.c | 25 +++-- gcc/config/darwin-driver.c | 2 -- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 6 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 892ba35..7fe4b1f 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -571,21 +571,34 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) } /* Return the value of darwin_macosx_version_min suitable for the - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, so '10.4.2' + becomes 1040 and '10.10.0' becomes 101000. The lowest digit is + always zero, as is the second lowest for '10.10.x' and above. Print a warning if the version number can't be understood. */ static const char * version_as_macro (void) { - static char result[] = 1000; + static char result[7] = 1000; + int minorDigitIdx; if (strncmp (darwin_macosx_version_min, 10., 3) != 0) goto fail; if (! ISDIGIT (darwin_macosx_version_min[3])) goto fail; - result[2] = darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] != '\0' - darwin_macosx_version_min[4] != '.') + + minorDigitIdx = 3; + result[2] = darwin_macosx_version_min[minorDigitIdx++]; + if (ISDIGIT (darwin_macosx_version_min[minorDigitIdx])) + { +/* Starting with OS X 10.10, the macro ends '00' rather than '0', + i.e. 10.10.x becomes 101000 rather than 10100. */ +result[3] = darwin_macosx_version_min[minorDigitIdx++]; +result[4] = '0'; +result[5] = '0'; +result[6] = '\0'; + } + if (darwin_macosx_version_min[minorDigitIdx] != '\0' + darwin_macosx_version_min[minorDigitIdx] != '.') goto fail; return result; diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 8b6ae93..eb478e8 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -57,8 +57,6 @@ darwin_find_version_from_kernel (char *new_flag) version_p = osversion + 1; if (ISDIGIT (*version_p)) major_vers = major_vers * 10 + (*version_p++ - '0'); - if (major_vers 4 + 9) -goto parse_failed; if (*version_p++ != '.') goto parse_failed; version_pend = strchr(version_p, '.'); diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc/testsuite/gcc.dg/darwin-minversion-1.c index d8a3243..6221d61 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc/testsuite/gcc.dg/darwin-minversion-2.c index fd4975a..8e18d52 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 -mmacosx-version-min=10.3 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-3.c b/gcc/testsuite/gcc.dg/darwin-minversion-3.c index d0c5934..4fcb969 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-3.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-3.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.4.10 } */ /* { dg-do compile { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-4.c b/gcc/testsuite/gcc.dg/darwin-minversion-4.c new file mode 100644 index 000..1cb42eb --- /dev/null +++
[PATCH v3 2/2] Fixed dirent sanitizer for 32-bit OS X builds
The _DARWIN_FEATURE_64_BIT_INODE macro indicates whether dirent.d_ino is 64-bit or not, which should be sized appropriately, and whether dirent.d_seekoff should be defined/checked. libsanitizer/ChangeLog: * sanitizer_common/sanitizer_platform_limits_posix.cc: Only check dirent.d_seekoff on OS X when performing a 64-bit build. * sanitizer_common/sanitizer_platform_limits_posix.h: Only define dirent.d_seekoff on OS X when performing a 64-bit build, and make dirent.d_ino the correct size (32-bit) when performing a 32-bit build. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index a93d38d..7ffe298 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) = sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC _DARWIN_FEATURE_64_BIT_INODE +// The 'd_seekoff' field is only present on OS X for 64-bit builds CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); #elif SANITIZER_FREEBSD // There is no 'd_off' field on FreeBSD. diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index dece2d3..ac61fa5 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -392,12 +392,21 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +# if _DARWIN_FEATURE_64_BIT_INODE struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +# else + struct __sanitizer_dirent { +unsigned int d_ino; +// No d_seekoff for 32-bit +unsigned short d_reclen; +// more fields that we don't care about + }; +# endif #elif SANITIZER_FREEBSD struct __sanitizer_dirent { unsigned int d_fileno; -- 2.1.0
[PATCH v4 0/2] Fix OS X Yosemite-related issues
These patches combine to address PR target/61407, meaning that GCC is able to bootstrap on OS X Yosemite. Changes from v3: [PATCH v4 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__: * Unchanged [PATCH v4 2/2] Fixed dirent sanitizer for 32-bit OS X builds: * Check whether the _DARWIN_FEATURE_64_BIT_INODE macro is defined rather than its value James Clarke (2): Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ Fixed dirent sanitizer for 32-bit OS X builds gcc/config/darwin-c.c | 25 -- gcc/config/darwin-driver.c | 2 -- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 +++ .../sanitizer_platform_limits_posix.cc | 3 ++- .../sanitizer_platform_limits_posix.h | 9 8 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c -- 2.1.0
[PATCH v4 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
Previously, this macro had taken the form 10X0, where X is the minor version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X 10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10. Added a test for the new format and fixed the formatting for the existing ones. gcc/ChangeLog: * config/darwin-c.c (version_as_macro): Added extra 0 for OS X 10.10 and above * config/darwin-driver.c (darwin_find_version_from_kernel): Removed kernel version check to avoid incrementing it after every major OS X release gcc/testsuite/ChangeLog: * gcc.db/darwin-minversion-1.c: Fixed formatting * gcc.db/darwin-minversion-2.c: Fixed formatting * gcc.db/darwin-minversion-3.c: Fixed formatting * gcc.dg/darwin-minversion-4.c: Added test for OS X 10.10 --- gcc/config/darwin-c.c | 25 +++-- gcc/config/darwin-driver.c | 2 -- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 6 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 892ba35..7fe4b1f 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -571,21 +571,34 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) } /* Return the value of darwin_macosx_version_min suitable for the - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, so '10.4.2' + becomes 1040 and '10.10.0' becomes 101000. The lowest digit is + always zero, as is the second lowest for '10.10.x' and above. Print a warning if the version number can't be understood. */ static const char * version_as_macro (void) { - static char result[] = 1000; + static char result[7] = 1000; + int minorDigitIdx; if (strncmp (darwin_macosx_version_min, 10., 3) != 0) goto fail; if (! ISDIGIT (darwin_macosx_version_min[3])) goto fail; - result[2] = darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] != '\0' - darwin_macosx_version_min[4] != '.') + + minorDigitIdx = 3; + result[2] = darwin_macosx_version_min[minorDigitIdx++]; + if (ISDIGIT (darwin_macosx_version_min[minorDigitIdx])) + { +/* Starting with OS X 10.10, the macro ends '00' rather than '0', + i.e. 10.10.x becomes 101000 rather than 10100. */ +result[3] = darwin_macosx_version_min[minorDigitIdx++]; +result[4] = '0'; +result[5] = '0'; +result[6] = '\0'; + } + if (darwin_macosx_version_min[minorDigitIdx] != '\0' + darwin_macosx_version_min[minorDigitIdx] != '.') goto fail; return result; diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 8b6ae93..eb478e8 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -57,8 +57,6 @@ darwin_find_version_from_kernel (char *new_flag) version_p = osversion + 1; if (ISDIGIT (*version_p)) major_vers = major_vers * 10 + (*version_p++ - '0'); - if (major_vers 4 + 9) -goto parse_failed; if (*version_p++ != '.') goto parse_failed; version_pend = strchr(version_p, '.'); diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc/testsuite/gcc.dg/darwin-minversion-1.c index d8a3243..6221d61 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc/testsuite/gcc.dg/darwin-minversion-2.c index fd4975a..8e18d52 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 -mmacosx-version-min=10.3 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-3.c b/gcc/testsuite/gcc.dg/darwin-minversion-3.c index d0c5934..4fcb969 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-3.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-3.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.4.10 } */ /* { dg-do compile { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-4.c b/gcc/testsuite/gcc.dg/darwin-minversion-4.c new file mode 100644 index 000..1cb42eb --- /dev/null +++
[PATCH v4 2/2] Fixed dirent sanitizer for 32-bit OS X builds
The _DARWIN_FEATURE_64_BIT_INODE macro indicates whether dirent.d_ino is 64-bit or not, which should be sized appropriately, and whether dirent.d_seekoff should be defined/checked. libsanitizer/ChangeLog: * sanitizer_common/sanitizer_platform_limits_posix.cc: Only check dirent.d_seekoff on OS X when performing a 64-bit build. * sanitizer_common/sanitizer_platform_limits_posix.h: Only define dirent.d_seekoff on OS X when performing a 64-bit build, and make dirent.d_ino the correct size (32-bit) when performing a 32-bit build. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index a93d38d..69c84de 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) = sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC defined(_DARWIN_FEATURE_64_BIT_INODE) +// The 'd_seekoff' field is only present on OS X for 64-bit builds CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); #elif SANITIZER_FREEBSD // There is no 'd_off' field on FreeBSD. diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index dece2d3..0523465 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -392,12 +392,21 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +# if defined(_DARWIN_FEATURE_64_BIT_INODE) struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +# else + struct __sanitizer_dirent { +unsigned int d_ino; +// No d_seekoff for 32-bit +unsigned short d_reclen; +// more fields that we don't care about + }; +# endif #elif SANITIZER_FREEBSD struct __sanitizer_dirent { unsigned int d_fileno; -- 2.1.0
Re: [PATCH 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
So I should just take that particular check out then? James Clarke On 25 Aug 2014, at 21:05, Mike Stump mikest...@comcast.net wrote: On Aug 25, 2014, at 11:03 AM, James Clarke jrt...@jrtc27.com wrote: Previously, this macro had taken the form 10X0, where X is the minor version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X 10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10. So, if they continue using the same scheme, I’d prefer to future proof this (I don’t like software time bombs) so that 10.11.0 works as well as 10.12.0 and so on. We didn’t do this last time, as we were unsure how the numbers would work out. Now, it is much safer to see what the likely format will be. Could you try that? - if (major_vers 4 + 9) + if (major_vers 4 + 10) I think this is the only thing that has to change.
[PATCH 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
Previously, this macro had taken the form 10X0, where X is the minor version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X 10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10. Added a test for the new format and fixed the formatting for the existing ones. gcc/ChangeLog: * config/darwin-c.c (version_as_macro): Added extra 0 for OS X 10.10 and above * config/darwin-driver.c (darwin_find_version_from_kernel): Bump supported kernel version gcc/testsuite/ChangeLog: * gcc.db/darwin-minversion-1.c: Fixed formatting * gcc.db/darwin-minversion-2.c: Fixed formatting * gcc.db/darwin-minversion-3.c: Fixed formatting * gcc.dg/darwin-minversion-4.c: Added test for OS X 10.10 --- gcc/config/darwin-c.c | 25 +++-- gcc/config/darwin-driver.c | 2 +- gcc/testsuite/gcc.dg/darwin-minversion-1.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-2.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-3.c | 3 ++- gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 6 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 892ba35..7fe4b1f 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -571,21 +571,34 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) } /* Return the value of darwin_macosx_version_min suitable for the - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, so '10.4.2' + becomes 1040 and '10.10.0' becomes 101000. The lowest digit is + always zero, as is the second lowest for '10.10.x' and above. Print a warning if the version number can't be understood. */ static const char * version_as_macro (void) { - static char result[] = 1000; + static char result[7] = 1000; + int minorDigitIdx; if (strncmp (darwin_macosx_version_min, 10., 3) != 0) goto fail; if (! ISDIGIT (darwin_macosx_version_min[3])) goto fail; - result[2] = darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] != '\0' - darwin_macosx_version_min[4] != '.') + + minorDigitIdx = 3; + result[2] = darwin_macosx_version_min[minorDigitIdx++]; + if (ISDIGIT (darwin_macosx_version_min[minorDigitIdx])) + { +/* Starting with OS X 10.10, the macro ends '00' rather than '0', + i.e. 10.10.x becomes 101000 rather than 10100. */ +result[3] = darwin_macosx_version_min[minorDigitIdx++]; +result[4] = '0'; +result[5] = '0'; +result[6] = '\0'; + } + if (darwin_macosx_version_min[minorDigitIdx] != '\0' + darwin_macosx_version_min[minorDigitIdx] != '.') goto fail; return result; diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 8b6ae93..a115616 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -57,7 +57,7 @@ darwin_find_version_from_kernel (char *new_flag) version_p = osversion + 1; if (ISDIGIT (*version_p)) major_vers = major_vers * 10 + (*version_p++ - '0'); - if (major_vers 4 + 9) + if (major_vers 4 + 10) goto parse_failed; if (*version_p++ != '.') goto parse_failed; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc/testsuite/gcc.dg/darwin-minversion-1.c index d8a3243..6221d61 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc/testsuite/gcc.dg/darwin-minversion-2.c index fd4975a..8e18d52 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.1 -mmacosx-version-min=10.3 } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-3.c b/gcc/testsuite/gcc.dg/darwin-minversion-3.c index d0c5934..4fcb969 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-3.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-3.c @@ -2,7 +2,8 @@ /* { dg-options -mmacosx-version-min=10.4.10 } */ /* { dg-do compile { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040 fail me; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-4.c b/gcc/testsuite/gcc.dg/darwin-minversion-4.c new file mode 100644 index 000..1cb42eb --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-minversion-4.c @@ -0,0 +1,12 @@ +/* Test that major versions greater
[PATCH 2/2] Fixed dirent sanitizer for 32-bit OS X builds
The __DARWIN_64_BIT_INO_T macro is used to indicate whether dirent.d_ino is 64-bit or not, and so should be sized appropriately. Additionally, dirent.d_seekoff should only be defined/checked when __DARWIN_64_BIT_INO_T is defined. libsanitizer/ChangeLog: * sanitizer_common/sanitizer_platform_limits_posix.cc: Only check dirent.d_seekoff on OS X when performing a 64-bit build. * sanitizer_common/sanitizer_platform_limits_posix.h: Only define dirent.d_seekoff on OS X when performing a 64-bit build, and make dirent.d_ino the correct size (32-bit) when performing a 32-bit build. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index a93d38d..0d1870b 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) = sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC __DARWIN_64_BIT_INO_T +// The 'd_seekoff' field is only present on OS X for 64-bit builds CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); #elif SANITIZER_FREEBSD // There is no 'd_off' field on FreeBSD. diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index dece2d3..73a4c3f 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -392,12 +392,21 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +# if __DARWIN_64_BIT_INO_T struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +# else + struct __sanitizer_dirent { +unsigned int d_ino; +// No d_seekoff for 32-bit +unsigned short d_reclen; +// more fields that we don't care about + }; +# endif #elif SANITIZER_FREEBSD struct __sanitizer_dirent { unsigned int d_fileno; -- 2.1.0
Re: [PATCH 2/2] Fixed dirent sanitizer for 32-bit OS X builds
Please note that this fixes PR 61407 (forgot to add it to libsanitizer/ChangeLog). James Clarke On 25 Aug 2014, at 19:03, James Clarke jrt...@jrtc27.com wrote: The __DARWIN_64_BIT_INO_T macro is used to indicate whether dirent.d_ino is 64-bit or not, and so should be sized appropriately. Additionally, dirent.d_seekoff should only be defined/checked when __DARWIN_64_BIT_INO_T is defined. libsanitizer/ChangeLog: * sanitizer_common/sanitizer_platform_limits_posix.cc: Only check dirent.d_seekoff on OS X when performing a 64-bit build. * sanitizer_common/sanitizer_platform_limits_posix.h: Only define dirent.d_seekoff on OS X when performing a 64-bit build, and make dirent.d_ino the correct size (32-bit) when performing a 32-bit build. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index a93d38d..0d1870b 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) = sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC __DARWIN_64_BIT_INO_T +// The 'd_seekoff' field is only present on OS X for 64-bit builds CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); #elif SANITIZER_FREEBSD // There is no 'd_off' field on FreeBSD. diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index dece2d3..73a4c3f 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -392,12 +392,21 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +# if __DARWIN_64_BIT_INO_T struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +# else + struct __sanitizer_dirent { +unsigned int d_ino; +// No d_seekoff for 32-bit +unsigned short d_reclen; +// more fields that we don't care about + }; +# endif #elif SANITIZER_FREEBSD struct __sanitizer_dirent { unsigned int d_fileno; -- 2.1.0