Re: [PATCH] D60728: [clang] [test] Add a (xfailing) test for PR41027
On 05/06/2019 05:19, Michał Górny via Phabricator via llvm-commits wrote: > This revision was automatically updated to reflect the committed changes. > Closed by commit rL362587: [clang] [test] Add a (xfailing) test for PR41027 > (authored by mgorny, committed by ). > Herald added a project: LLVM. > Herald added a subscriber: llvm-commits. > > Changed prior to commit: > https://reviews.llvm.org/D60728?vs=195518&id=203097#toc > > Repository: > rL LLVM > > CHANGES SINCE LAST ACTION > https://reviews.llvm.org/D60728/new/ > > https://reviews.llvm.org/D60728 > > Files: > cfe/trunk/test/Sema/pr41027.c This patch is failing on aarch64-linux bot [1], I think you need to add a 'requires: x86_64'. [1] http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/7694 > > > Index: cfe/trunk/test/Sema/pr41027.c > === > --- cfe/trunk/test/Sema/pr41027.c > +++ cfe/trunk/test/Sema/pr41027.c > @@ -0,0 +1,10 @@ > +// RUN: %clang_cc1 -triple x86_64 -fsyntax-only %s > +// XFAIL: * > + > +inline void pr41027(unsigned a, unsigned b) { > + if (__builtin_constant_p(a)) { > +__asm__ volatile("outl %0,%w1" : : "a"(b), "n"(a)); > + } else { > +__asm__ volatile("outl %0,%w1" : : "a"(b), "d"(a)); > + } > +} > > > > ___ > llvm-commits mailing list > llvm-comm...@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r360896 - [clang] Handle lround/llround builtins
Author: azanella Date: Thu May 16 06:43:25 2019 New Revision: 360896 URL: http://llvm.org/viewvc/llvm-project?rev=360896&view=rev Log: [clang] Handle lround/llround builtins As for other floating-point rounding builtins that can be optimized when build with -fno-math-errno, this patch adds support for lround and llround. It currently only optimize for AArch64 backend. Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D61392 Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/builtins.c cfe/trunk/test/CodeGen/math-builtins.c cfe/trunk/test/CodeGen/math-libcalls.c Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=360896&r1=360895&r2=360896&view=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu May 16 06:43:25 2019 @@ -1721,6 +1721,27 @@ RValue CodeGenFunction::EmitBuiltinExpr( case Builtin::BI__builtin_truncl: return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::trunc)); +case Builtin::BIlround: +case Builtin::BIlroundf: +case Builtin::BIlroundl: +case Builtin::BI__builtin_lround: +case Builtin::BI__builtin_lroundf: +case Builtin::BI__builtin_lroundl: { + llvm::Type *ResultType = ConvertType(E->getType()); + int Width = ResultType->getPrimitiveSizeInBits(); + return RValue::get(emitUnaryBuiltin(*this, E, + Width == 32 ? Intrinsic::lround_i32 + : Intrinsic::lround_i64)); +} + +case Builtin::BIllround: +case Builtin::BIllroundf: +case Builtin::BIllroundl: +case Builtin::BI__builtin_llround: +case Builtin::BI__builtin_llroundf: +case Builtin::BI__builtin_llroundl: + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::llround)); + default: break; } Modified: cfe/trunk/test/CodeGen/builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=360896&r1=360895&r2=360896&view=diff == --- cfe/trunk/test/CodeGen/builtins.c (original) +++ cfe/trunk/test/CodeGen/builtins.c Thu May 16 06:43:25 2019 @@ -256,6 +256,8 @@ void test_float_builtin_ops(float F, dou volatile float resf; volatile double resd; volatile long double resld; + volatile long int resli; + volatile long long int reslli; resf = __builtin_fmodf(F,F); // CHECK: frem float @@ -380,6 +382,14 @@ void test_float_builtin_ops(float F, dou resld = __builtin_roundl(LD); // CHECK: call x86_fp80 @llvm.round.f80 + resli = __builtin_lroundf (F); + // CHECK: call i64 @llvm.lround.i64.f32 + + resli = __builtin_lround (D); + // CHECK: call i64 @llvm.lround.i64.f64 + + resli = __builtin_lroundl (LD); + // CHECK: call i64 @llvm.lround.i64.f80 } // __builtin_longjmp isn't supported on all platforms, so only test it on X86. Modified: cfe/trunk/test/CodeGen/math-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/math-builtins.c?rev=360896&r1=360895&r2=360896&view=diff == --- cfe/trunk/test/CodeGen/math-builtins.c (original) +++ cfe/trunk/test/CodeGen/math-builtins.c Thu May 16 06:43:25 2019 @@ -362,9 +362,9 @@ void foo(double *d, float f, float *fp, __builtin_llround(f);__builtin_llroundf(f); __builtin_llroundl(f); -// NO__ERRNO: declare i64 @llround(double) [[READNONE]] -// NO__ERRNO: declare i64 @llroundf(float) [[READNONE]] -// NO__ERRNO: declare i64 @llroundl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare i64 @llvm.llround.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.llround.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.llround.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare i64 @llround(double) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @llroundf(float) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @llroundl(x86_fp80) [[NOT_READNONE]] @@ -425,9 +425,9 @@ void foo(double *d, float f, float *fp, __builtin_lround(f); __builtin_lroundf(f);__builtin_lroundl(f); -// NO__ERRNO: declare i64 @lround(double) [[READNONE]] -// NO__ERRNO: declare i64 @lroundf(float) [[READNONE]] -// NO__ERRNO: declare i64 @lroundl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare i64 @llvm.lround.i64.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.lround.i64.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.lround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare i64 @lround(double) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @lroundf(float) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @lroundl(x86_fp80) [[NOT_READNONE]] Modified: cfe/trunk/test/CodeGen/math-libcalls.
r361878 - [clang] Handle lrint/llrint builtins
Author: azanella Date: Tue May 28 14:16:04 2019 New Revision: 361878 URL: http://llvm.org/viewvc/llvm-project?rev=361878&view=rev Log: [clang] Handle lrint/llrint builtins As for other floating-point rounding builtins that can be optimized when build with -fno-math-errno, this patch adds support for lrint and llrint. It currently only optimize for AArch64 backend. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D62019 Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/builtins.c cfe/trunk/test/CodeGen/math-builtins.c cfe/trunk/test/CodeGen/math-libcalls.c Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=361878&r1=361877&r2=361878&view=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue May 28 14:16:04 2019 @@ -1741,6 +1741,22 @@ RValue CodeGenFunction::EmitBuiltinExpr( case Builtin::BI__builtin_llroundl: return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::llround)); +case Builtin::BIlrint: +case Builtin::BIlrintf: +case Builtin::BIlrintl: +case Builtin::BI__builtin_lrint: +case Builtin::BI__builtin_lrintf: +case Builtin::BI__builtin_lrintl: + return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::lrint)); + +case Builtin::BIllrint: +case Builtin::BIllrintf: +case Builtin::BIllrintl: +case Builtin::BI__builtin_llrint: +case Builtin::BI__builtin_llrintf: +case Builtin::BI__builtin_llrintl: + return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::llrint)); + default: break; } Modified: cfe/trunk/test/CodeGen/builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=361878&r1=361877&r2=361878&view=diff == --- cfe/trunk/test/CodeGen/builtins.c (original) +++ cfe/trunk/test/CodeGen/builtins.c Tue May 28 14:16:04 2019 @@ -390,6 +390,15 @@ void test_float_builtin_ops(float F, dou resli = __builtin_lroundl (LD); // CHECK: call i64 @llvm.lround.i64.f80 + + resli = __builtin_lrintf (F); + // CHECK: call i64 @llvm.lrint.i64.f32 + + resli = __builtin_lrint (D); + // CHECK: call i64 @llvm.lrint.i64.f64 + + resli = __builtin_lrintl (LD); + // CHECK: call i64 @llvm.lrint.i64.f80 } // __builtin_longjmp isn't supported on all platforms, so only test it on X86. Modified: cfe/trunk/test/CodeGen/math-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/math-builtins.c?rev=361878&r1=361877&r2=361878&view=diff == --- cfe/trunk/test/CodeGen/math-builtins.c (original) +++ cfe/trunk/test/CodeGen/math-builtins.c Tue May 28 14:16:04 2019 @@ -353,9 +353,9 @@ void foo(double *d, float f, float *fp, __builtin_llrint(f); __builtin_llrintf(f);__builtin_llrintl(f); -// NO__ERRNO: declare i64 @llrint(double) [[READNONE]] -// NO__ERRNO: declare i64 @llrintf(float) [[READNONE]] -// NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare i64 @llvm.llrint.i64.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.llrint.i64.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.llrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]] @@ -416,9 +416,9 @@ void foo(double *d, float f, float *fp, __builtin_lrint(f); __builtin_lrintf(f); __builtin_lrintl(f); -// NO__ERRNO: declare i64 @lrint(double) [[READNONE]] -// NO__ERRNO: declare i64 @lrintf(float) [[READNONE]] -// NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]] +// NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]] // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]] Modified: cfe/trunk/test/CodeGen/math-libcalls.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/math-libcalls.c?rev=361878&r1=361877&r2=361878&view=diff == --- cfe/trunk/test/CodeGen/math-libcalls.c (original) +++ cfe/trunk/test/CodeGen/math-libcalls.c Tue May 28 14:16:04 2019 @@ -308,9 +308,9 @@ void foo(double *d, float f, float *fp, llrint(f); llrintf(f);llrintl(f); -// NO__ERRNO: declare i64 @llrint(double) [[READNONE]] -// NO__ERRNO: declare i64 @llrintf(
[clang-tools-extra] [libc] [clang] [flang] [llvm] [compiler-rt] [X86] Do not end 'note.gnu.property' section with -fcf-protection (PR #79360)
https://github.com/zatrazz updated https://github.com/llvm/llvm-project/pull/79360 >From 240ec1a6b9dda5e6c625e096c52d70eb6458180b Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 24 Jan 2024 16:49:30 -0300 Subject: [PATCH] [X86] Do not end 'note.gnu.property' section with -fcf-protection The glibc now adds the required minimum ISA level for libc-nonshared.a (linked on all programs) and this is done with a inline asm along with .note.gnu.property an .pushsection/.popsection. However, x86 backend always end the 'note.gnu.property' section when building with -fcf-protection, leading to assert failure: llvm/llvm-project-git/llvm/lib/MC/MCStreamer.cpp:1251: virtual void llvm::MCStreamer::switchSection(llvm::MCSection*, const llvm::MCExpr*): Assertion `!Section->hasEnded() && "Section already ended"' failed. [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/isa-level.c;h=3f1b269848a52f994275bab6f60dded3ded6b144;hb=HEAD --- llvm/lib/Target/X86/X86AsmPrinter.cpp | 1 - .../X86/note-cet-property-inlineasm.ll| 30 +++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp index 9f0fd4d0938e97f..87ec8aa23080e00 100644 --- a/llvm/lib/Target/X86/X86AsmPrinter.cpp +++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp @@ -877,7 +877,6 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) { OutStreamer->emitInt32(FeatureFlagsAnd);// data emitAlignment(WordSize == 4 ? Align(4) : Align(8)); // padding - OutStreamer->endSection(Nt); OutStreamer->switchSection(Cur); } } diff --git a/llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll b/llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll new file mode 100644 index 000..a0e5b4add1b386e --- /dev/null +++ b/llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll @@ -0,0 +1,30 @@ +; RUN: llc -mtriple x86_64-unknown-linux-gnu %s -o %t.o -filetype=obj +; RUN: llvm-readobj -n %t.o | FileCheck %s + +module asm ".pushsection \22.note.gnu.property\22,\22a\22,@note" +module asm " .p2align 3" +module asm " .long 1f - 0f" +module asm " .long 4f - 1f" +module asm " .long 5" +module asm "0: .asciz \22GNU\22" +module asm "1: .p2align 3" +module asm " .long 0xc0008002" +module asm " .long 3f - 2f" +module asm "2: .long ((1U << 0) | 0 | 0 | 0)" +module asm "3: .p2align 3" +module asm "4:" +module asm " .popsection" + +!llvm.module.flags = !{!0, !1} + +!0 = !{i32 4, !"cf-protection-return", i32 1} +!1 = !{i32 4, !"cf-protection-branch", i32 1} + +; CHECK: Type: NT_GNU_PROPERTY_TYPE_0 +; CHECK-NEXT: Property [ +; CHECK-NEXT: x86 feature: IBT, SHSTK +; CHECK-NEXT: ] +; CHECK: Type: NT_GNU_PROPERTY_TYPE_0 +; CHECK-NEXT: Property [ +; CHECK-NEXT: x86 ISA needed: x86-64-baseline +; CHECK-NEXT: ] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 92e1723 - [clang][Headers] Only define FLT_EVAL_METHOD for C99 and later
Author: Adhemerval Zanella Date: 2022-11-08T13:58:37-03:00 New Revision: 92e172309cf6624487ef6b3a79a5445276f9 URL: https://github.com/llvm/llvm-project/commit/92e172309cf6624487ef6b3a79a5445276f9 DIFF: https://github.com/llvm/llvm-project/commit/92e172309cf6624487ef6b3a79a5445276f9.diff LOG: [clang][Headers] Only define FLT_EVAL_METHOD for C99 and later It was reported by glibc conform test [1]. [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=conform/data/float.h-data;h=7b98fc03447b8918da4a0cf47d41fb3e17f4f791;hb=HEAD Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D137267 Added: Modified: clang/lib/Headers/float.h Removed: diff --git a/clang/lib/Headers/float.h b/clang/lib/Headers/float.h index 5dace7a47c9fa..0e73bca0a2d6e 100644 --- a/clang/lib/Headers/float.h +++ b/clang/lib/Headers/float.h @@ -86,7 +86,10 @@ /* Characteristics of floating point types, C99 5.2.4.2.2 */ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ +(defined(__cplusplus) && __cplusplus >= 201103L) #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ +#endif #define FLT_ROUNDS (__builtin_flt_rounds()) #define FLT_RADIX __FLT_RADIX__ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9e95699 - [clang][Headers] Do not define varargs macros for __need___va_list
Author: Adhemerval Zanella Date: 2022-11-08T16:29:35-03:00 New Revision: 9e956995db1fc7e792e3dfb3a465a52626195557 URL: https://github.com/llvm/llvm-project/commit/9e956995db1fc7e792e3dfb3a465a52626195557 DIFF: https://github.com/llvm/llvm-project/commit/9e956995db1fc7e792e3dfb3a465a52626195557.diff LOG: [clang][Headers] Do not define varargs macros for __need___va_list The glibc uses the define to avoid namespace polution on headers that requires variadic argument, where the inclusion of stdarg.h is required to obtain the va_list definition. For such cases only __gnuc_va_list is required. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D137268 Added: Modified: clang/lib/Headers/stdarg.h compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp Removed: diff --git a/clang/lib/Headers/stdarg.h b/clang/lib/Headers/stdarg.h index dc7becff670f4..4fbfe0985a160 100644 --- a/clang/lib/Headers/stdarg.h +++ b/clang/lib/Headers/stdarg.h @@ -8,8 +8,16 @@ */ #ifndef __STDARG_H -#define __STDARG_H +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef __builtin_va_list __gnuc_va_list; +#endif + +#ifdef __need___va_list +#undef __need___va_list +#else +#define __STDARG_H #ifndef _VA_LIST typedef __builtin_va_list va_list; #define _VA_LIST @@ -29,9 +37,6 @@ typedef __builtin_va_list va_list; #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST 1 -typedef __builtin_va_list __gnuc_va_list; -#endif - #endif /* __STDARG_H */ + +#endif /* not __STDARG_H */ diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp index 84084b9291a70..f5dcc4bc3208c 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r278745 - libcxx: Fix path.compare.pass expected result
Author: azanella Date: Mon Aug 15 16:24:50 2016 New Revision: 278745 URL: http://llvm.org/viewvc/llvm-project?rev=278745&view=rev Log: libcxx: Fix path.compare.pass expected result The expected 'filesystem::path::compare' result states that for different path only result sign contains the information about passed arguments (not its integer value). This is due it uses the output of other compare functions (basic_string_view and char_traits) without further handling and char_traits uses memcmp for final buffer comparison. However for GLIBC on AArch64 the code: int ret = memcmp ("b/a/c", "a/b/c", 1); Results in '64' where for x86_64 it results in '1'. This patch fixes the expected 'filesystem::path::compare' by normalizing all the results before assert comparison. Modified: libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp?rev=278745&r1=278744&r2=278745&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp Mon Aug 15 16:24:50 2016 @@ -73,6 +73,11 @@ const PathCompareTest CompareTestCases[] #undef LONGC #undef LONGD +static inline int normalize_ret(int ret) +{ + return ret < 0 ? -1 : (ret > 0 ? 1 : 0); +} + int main() { using namespace fs; @@ -86,13 +91,12 @@ int main() DisableAllocationGuard g; // none of these operations should allocate // check runtime results - int ret1 = p1.compare(p2); - int ret2 = p1.compare(R); - int ret3 = p1.compare(TC.RHS); - int ret4 = p1.compare(RV); + int ret1 = normalize_ret(p1.compare(p2)); + int ret2 = normalize_ret(p1.compare(R)); + int ret3 = normalize_ret(p1.compare(TC.RHS)); + int ret4 = normalize_ret(p1.compare(RV)); assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4); - int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0); - assert(normalized_ret == E); + assert(ret1 == E); // check signatures ASSERT_NOEXCEPT(p1.compare(p2)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz added a comment. Ping (x2). https://reviews.llvm.org/D23420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r279552 - libcxx: Fix libcxx tests on aarch64 with libunwind
Author: azanella Date: Tue Aug 23 14:25:12 2016 New Revision: 279552 URL: http://llvm.org/viewvc/llvm-project?rev=279552&view=rev Log: libcxx: Fix libcxx tests on aarch64 with libunwind Some tests uses 'long double' to/from conversions and for some targets they are provided by compiler runtime (either compiler-rt or libgcc). However when building libcxx with linunwinder current test configuration at target_info.py do not include the required libraries, as: not llvm_unwinder: "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc" llvm_unwinder "-lc++" "-lm" "-lpthread" "-lc" "-lunwind" "-ldl" This causes some tests build issues with missing symbols on aarch64, for instance, where 'long double' is a binary float with 128-bits with mostly of internal operations being provided by software routines. This patch changes how to define the default linker flags with libunwinder by adding libgcc regardless. I checked and aarch64 and x86_64 with libcxx and libunwind (with and without LIBCXXABI_USE_LLVM_UNWINDER). Modified: libcxx/trunk/test/libcxx/test/target_info.py Modified: libcxx/trunk/test/libcxx/test/target_info.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/target_info.py?rev=279552&r1=279551&r2=279552&view=diff == --- libcxx/trunk/test/libcxx/test/target_info.py (original) +++ libcxx/trunk/test/libcxx/test/target_info.py Tue Aug 23 14:25:12 2016 @@ -180,7 +180,8 @@ class LinuxLocalTI(DefaultTargetInfo): if llvm_unwinder: flags += ['-lunwind', '-ldl'] else: -flags += ['-lgcc_s', '-lgcc'] +flags += ['-lgcc_s'] +flags += ['-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: flags += ['-latomic'] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D12708: [PATCH] [AArch64] Enable memory sanitizer on clang
zatrazz created this revision. zatrazz added reviewers: t.p.northover, aemerson, pcc, rengolin. zatrazz added a subscriber: cfe-commits. Herald added subscribers: rengolin, aemerson. This patch enables MSan for aarch64/linux. http://reviews.llvm.org/D12708 Files: lib/Driver/ToolChains.cpp Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -3736,7 +3736,7 @@ Res |= SanitizerKind::Leak; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Thread; - if (IsX86_64 || IsMIPS64 || IsPowerPC64) + if (IsX86_64 || IsMIPS64 || IsPowerPC64 || IsAArch64) Res |= SanitizerKind::Memory; if (IsX86 || IsX86_64) { Res |= SanitizerKind::Function; Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -3736,7 +3736,7 @@ Res |= SanitizerKind::Leak; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Thread; - if (IsX86_64 || IsMIPS64 || IsPowerPC64) + if (IsX86_64 || IsMIPS64 || IsPowerPC64 || IsAArch64) Res |= SanitizerKind::Memory; if (IsX86 || IsX86_64) { Res |= SanitizerKind::Function; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r247808 - [sanitizers] Enable memory sanitizer on clang
Author: azanella Date: Wed Sep 16 10:11:21 2015 New Revision: 247808 URL: http://llvm.org/viewvc/llvm-project?rev=247808&view=rev Log: [sanitizers] Enable memory sanitizer on clang This patch enables MSan for aarch64/linux Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=247808&r1=247807&r2=247808&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Sep 16 10:11:21 2015 @@ -3761,7 +3761,7 @@ SanitizerMask Linux::getSupportedSanitiz Res |= SanitizerKind::Leak; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Thread; - if (IsX86_64 || IsMIPS64 || IsPowerPC64) + if (IsX86_64 || IsMIPS64 || IsPowerPC64 || IsAArch64) Res |= SanitizerKind::Memory; if (IsX86 || IsX86_64) { Res |= SanitizerKind::Function; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D13109: [sanitizer] Enable lsan for AArch64
zatrazz created this revision. zatrazz added reviewers: rengolin, pcc, aemerson, t.p.northover. zatrazz added a subscriber: cfe-commits. Herald added subscribers: rengolin, aemerson. compiler-rt related patch: http://reviews.llvm.org/D13108 http://reviews.llvm.org/D13109 Files: lib/Driver/ToolChains.cpp Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -3760,7 +3760,7 @@ Res |= SanitizerKind::Vptr; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::DataFlow; - if (IsX86_64 || IsMIPS64) + if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Leak; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Thread; Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -3760,7 +3760,7 @@ Res |= SanitizerKind::Vptr; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::DataFlow; - if (IsX86_64 || IsMIPS64) + if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Leak; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Thread; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r249338 - [sanitizer] Enable lsan for AArch64
Author: azanella Date: Mon Oct 5 14:16:42 2015 New Revision: 249338 URL: http://llvm.org/viewvc/llvm-project?rev=249338&view=rev Log: [sanitizer] Enable lsan for AArch64 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=249338&r1=249337&r2=249338&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 5 14:16:42 2015 @@ -3803,7 +3803,7 @@ SanitizerMask Linux::getSupportedSanitiz Res |= SanitizerKind::SafeStack; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::DataFlow; - if (IsX86_64 || IsMIPS64) + if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Leak; if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::Thread; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz created this revision. zatrazz added reviewers: jroelofs, danalbert. zatrazz added subscribers: rengolin, cfe-commits. Herald added a subscriber: aemerson. Some tests uses 'long double' to/from conversions and for some targets they are provided by compiler runtime (either compiler-rt or libgcc). However when building libcxx with linunwinder current test configuration at target_info.py do not include the required libraries, as: not llvm_unwinder: [-lgcc_s] [-lgcc] [...] [-lgcc_s] [-lgcc] llvm_unwinder [-lunwind] [-ldl] This causes some tests build issues with missing symbols on aarch64, for instance, where 'long double' is a binary float with 128-bits with mostly of internal operations being provided by software routines. This patch changes how to define the default linker flags by: not llvm_unwinder: [-lgcc_s] [-lgcc] llvm_unwinder [-lunwind] [-ldl] [-lgcc_s] [-lgcc] I checked and aarch64 and x86_64 with libcxx and libunwind (with and without LIBCXXABI_USE_LLVM_UNWINDER). https://reviews.llvm.org/D23420 Files: test/libcxx/test/target_info.py Index: test/libcxx/test/target_info.py === --- test/libcxx/test/target_info.py +++ test/libcxx/test/target_info.py @@ -170,17 +170,14 @@ llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False) shared_libcxx = self.full_config.get_lit_bool('enable_shared', True) flags += ['-lm'] -if not llvm_unwinder: -flags += ['-lgcc_s', '-lgcc'] if enable_threads: flags += ['-lpthread'] if not shared_libcxx: flags += ['-lrt'] flags += ['-lc'] if llvm_unwinder: flags += ['-lunwind', '-ldl'] -else: -flags += ['-lgcc_s', '-lgcc'] +flags += ['-lgcc_s', '-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: flags += ['-latomic'] Index: test/libcxx/test/target_info.py === --- test/libcxx/test/target_info.py +++ test/libcxx/test/target_info.py @@ -170,17 +170,14 @@ llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False) shared_libcxx = self.full_config.get_lit_bool('enable_shared', True) flags += ['-lm'] -if not llvm_unwinder: -flags += ['-lgcc_s', '-lgcc'] if enable_threads: flags += ['-lpthread'] if not shared_libcxx: flags += ['-lrt'] flags += ['-lc'] if llvm_unwinder: flags += ['-lunwind', '-ldl'] -else: -flags += ['-lgcc_s', '-lgcc'] +flags += ['-lgcc_s', '-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: flags += ['-latomic'] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz added a comment. I tried to find why exactly libgcc has to appear before and after but I couldn't get any information from commit history. On my system (aarch64/linux) I am also getting "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc". I think we can got by the safe side and just add the final libgcc at the end for the soft-fp symbols. https://reviews.llvm.org/D23420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz updated this revision to Diff 67835. zatrazz added a comment. What about this version? The only difference is for libunwind libgcc is still included. https://reviews.llvm.org/D23420 Files: test/libcxx/test/target_info.py Index: test/libcxx/test/target_info.py === --- test/libcxx/test/target_info.py +++ test/libcxx/test/target_info.py @@ -179,8 +179,7 @@ flags += ['-lc'] if llvm_unwinder: flags += ['-lunwind', '-ldl'] -else: -flags += ['-lgcc_s', '-lgcc'] +flags += ['-lgcc_s', '-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: flags += ['-latomic'] Index: test/libcxx/test/target_info.py === --- test/libcxx/test/target_info.py +++ test/libcxx/test/target_info.py @@ -179,8 +179,7 @@ flags += ['-lc'] if llvm_unwinder: flags += ['-lunwind', '-ldl'] -else: -flags += ['-lgcc_s', '-lgcc'] +flags += ['-lgcc_s', '-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: flags += ['-latomic'] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23449: libcxx: Fix path.compare.pass expected result
zatrazz created this revision. zatrazz added reviewers: jroelofs, danalbert, EricWF. zatrazz added subscribers: rmaprath, aemerson, rengolin, cfe-commits. The expected 'filesystem::path::compare' result states that for different only the sign of result integer contains the information about passed arguments. This is because it uses the output of other compare function (basic_string_view and char_traits) without further handling and char_traits uses memcmp for final buffer comparison. However for GLIBC on AArch64 the code: int ret = memcmp ("b/a/c", "a/b/c", 1); Results in '64' where for x86_64 it results in '1'. This patch fixes the expected 'filesystem::path::compare' by normalizing all the results before assert comparison. https://reviews.llvm.org/D23449 Files: test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp Index: test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp === --- test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp +++ test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp @@ -73,6 +73,11 @@ #undef LONGC #undef LONGD +static inline int normalize_ret(int ret) +{ + return ret < 0 ? -1 : (ret > 0 ? 1 : 0); +} + int main() { using namespace fs; @@ -86,13 +91,12 @@ DisableAllocationGuard g; // none of these operations should allocate // check runtime results - int ret1 = p1.compare(p2); - int ret2 = p1.compare(R); - int ret3 = p1.compare(TC.RHS); - int ret4 = p1.compare(RV); + int ret1 = normalize_ret(p1.compare(p2)); + int ret2 = normalize_ret(p1.compare(R)); + int ret3 = normalize_ret(p1.compare(TC.RHS)); + int ret4 = normalize_ret(p1.compare(RV)); assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4); - int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0); - assert(normalized_ret == E); + assert(ret1 == E); // check signatures ASSERT_NOEXCEPT(p1.compare(p2)); Index: test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp === --- test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp +++ test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp @@ -73,6 +73,11 @@ #undef LONGC #undef LONGD +static inline int normalize_ret(int ret) +{ + return ret < 0 ? -1 : (ret > 0 ? 1 : 0); +} + int main() { using namespace fs; @@ -86,13 +91,12 @@ DisableAllocationGuard g; // none of these operations should allocate // check runtime results - int ret1 = p1.compare(p2); - int ret2 = p1.compare(R); - int ret3 = p1.compare(TC.RHS); - int ret4 = p1.compare(RV); + int ret1 = normalize_ret(p1.compare(p2)); + int ret2 = normalize_ret(p1.compare(R)); + int ret3 = normalize_ret(p1.compare(TC.RHS)); + int ret4 = normalize_ret(p1.compare(RV)); assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4); - int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0); - assert(normalized_ret == E); + assert(ret1 == E); // check signatures ASSERT_NOEXCEPT(p1.compare(p2)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz added a comment. Yes, but my understaning is the proposed link order will force libc++ to link against _Unwind* symbols from libunwind (this is what I am observing also). https://reviews.llvm.org/D23420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz added a comment. Yes, although in pratice for shared libraries this is not an issue (at least on Linux with current linker strategies). And I open for suggestion on how to proceed in this case since we have some other options: 1. Add the required soft-sp implementations when building for Linux (this might happen not only on aarch64, but any other ABI that defines long double using fallback soft-fp) 2. Remove the possible soft-fp usages on all the tests. However this will lead to possible remove *all* the FP cases if libcxx should be used in a pure soft-fp platform 3. Only allows the libcxx + linunwind to be built against compiler-rt https://reviews.llvm.org/D23420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz added a comment. In https://reviews.llvm.org/D23420#513824, @jroelofs wrote: > In https://reviews.llvm.org/D23420#513820, @zatrazz wrote: > > > Yes, although in pratice for shared libraries this is not an issue (at > > least on Linux with current linker strategies). And I open for suggestion > > on how to proceed in this case since we have some other options: > > > > 1. Add the required soft-sp implementations when building for Linux (this > > might happen not only on aarch64, but any other ABI that defines long > > double using fallback soft-fp) > > > Are the softfp symbols you need not contained in libgcc.a? Good call, I think just using 'lgcc' should be suffice. I will change the patch. https://reviews.llvm.org/D23420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz updated this revision to Diff 67850. zatrazz added a comment. I think patch should be safe now. https://reviews.llvm.org/D23420 Files: test/libcxx/test/target_info.py Index: test/libcxx/test/target_info.py === --- test/libcxx/test/target_info.py +++ test/libcxx/test/target_info.py @@ -180,7 +180,8 @@ if llvm_unwinder: flags += ['-lunwind', '-ldl'] else: -flags += ['-lgcc_s', '-lgcc'] +flags += ['-lgcc_s'] +flags += ['-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: flags += ['-latomic'] Index: test/libcxx/test/target_info.py === --- test/libcxx/test/target_info.py +++ test/libcxx/test/target_info.py @@ -180,7 +180,8 @@ if llvm_unwinder: flags += ['-lunwind', '-ldl'] else: -flags += ['-lgcc_s', '-lgcc'] +flags += ['-lgcc_s'] +flags += ['-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: flags += ['-latomic'] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23449: libcxx: Fix path.compare.pass expected result
zatrazz added a comment. Ping. https://reviews.llvm.org/D23449 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind
zatrazz added a comment. Ping. https://reviews.llvm.org/D23420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits