r351228 - [MSP430] Provide a toolchain description
Author: asl Date: Tue Jan 15 11:44:05 2019 New Revision: 351228 URL: http://llvm.org/viewvc/llvm-project?rev=351228&view=rev Log: [MSP430] Provide a toolchain description This is an initial implementation for msp430 toolchain including -mmcu option support -mhwmult options support -integrated-as by default The toolchain uses msp430-elf-as as a linker and supports msp430-gcc toolchain tree. Patch by Kristina Bessonova! Differential Revision: https://reviews.llvm.org/D56658 Added: cfe/trunk/include/clang/Basic/MSP430Target.def cfe/trunk/lib/Driver/ToolChains/MSP430.cpp cfe/trunk/lib/Driver/ToolChains/MSP430.h cfe/trunk/test/Driver/Inputs/basic_msp430_tree/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/bin/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/bin/msp430-elf-ld (with props) cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtbegin.o cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtend.o cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/ cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crt0.o cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crtn.o cfe/trunk/test/Driver/msp430-hwmult.c cfe/trunk/test/Driver/msp430-mmcu.c cfe/trunk/test/Driver/msp430-toolchain.c Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/module.modulemap cfe/trunk/lib/CodeGen/CodeGenModule.cpp cfe/trunk/lib/Driver/CMakeLists.txt cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/no-integrated-as.c Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=351228&r1=351227&r2=351228&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue Jan 15 11:44:05 2019 @@ -414,4 +414,15 @@ def err_drv_trivial_auto_var_init_zero_d "-ftrivial-auto-var-init=zero hasn't been enabled. Enable it at your own peril for benchmarking purpose only with " "-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">; +def warn_drv_msp430_hwmult_unsupported : Warning<"the given MCU does not " + "support hardware multiply, but -mhwmult is set to %0.">, + InGroup; +def warn_drv_msp430_hwmult_mismatch : Warning<"the given MCU supports %0 " + "hardware multiply, but -mhwmult is set to %1.">, + InGroup; +def warn_drv_msp430_hwmult_no_device : Warning<"no MCU device specified, but " + "'-mhwmult' is set to 'auto', assuming no hardware multiply. Use -mmcu to " + "specify a MSP430 device, or -mhwmult to set hardware multiply type " + "explicitly.">, InGroup; + } Added: cfe/trunk/include/clang/Basic/MSP430Target.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/MSP430Target.def?rev=351228&view=auto == --- cfe/trunk/include/clang/Basic/MSP430Target.def (added) +++ cfe/trunk/include/clang/Basic/MSP430Target.def Tue Jan 15 11:44:05 2019 @@ -0,0 +1,247 @@ +//===--- MSP430Target.def - MSP430 Feature/Processor Database*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// +// +// This file defines the MSP430 devices and their features. +// +//===--===// + +#ifndef MSP430_MCU_FEAT +#define MSP430_MCU_FEAT(NAME, HWMULT) MSP430_MCU(NAME) +#endif + +#ifndef MSP430_MCU +#define MSP430_MCU(NAME) +#endif + +MSP430_MCU("msp430c111") +MSP430_MCU("msp430c") +MSP430_MCU("msp430c112") +MSP430_MCU("msp430c1121") +MSP430_MCU("msp430c1331") +MSP430_MCU("msp430c1351") +MSP430_MCU("msp430e112") +MSP430_MCU("msp430f110") +MSP430_MCU("msp430f1101") +MSP430_MCU("msp430f1101a") +MSP430_MCU("msp430f") +MSP430_MCU("msp430fa") +MSP430_MCU("msp430f112") +MSP430_MCU("msp430f1121") +MSP430_MCU("msp430f1121a") +MSP430_MCU("msp430f1122") +MSP430_MCU(
Re: r351241 - CodeGen: Remove debug printf unintentionally added in r351228.
Thanks! On Wed, Jan 16, 2019 at 12:03 AM Peter Collingbourne via cfe-commits wrote: > > Author: pcc > Date: Tue Jan 15 12:59:59 2019 > New Revision: 351241 > > URL: http://llvm.org/viewvc/llvm-project?rev=351241&view=rev > Log: > CodeGen: Remove debug printf unintentionally added in r351228. > > Modified: > cfe/trunk/lib/CodeGen/CodeGenModule.cpp > > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=351241&r1=351240&r2=351241&view=diff > == > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Jan 15 12:59:59 2019 > @@ -137,12 +137,10 @@ CodeGenModule::CodeGenModule(ASTContext > >// Enable TBAA unless it's suppressed. ThreadSanitizer needs TBAA even at > O0. >if (LangOpts.Sanitize.has(SanitizerKind::Thread) || > - (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0)) { > -fprintf(stderr, "TBAA enabled\n"); > + (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0)) > TBAA.reset(new CodeGenTBAA(Context, TheModule, CodeGenOpts, > getLangOpts(), > getCXXABI().getMangleContext())); > - } > - > + >// If debug info or coverage generation is enabled, create the CGDebugInfo >// object. >if (CodeGenOpts.getDebugInfo() != codegenoptions::NoDebugInfo || > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits -- With best regards, Anton Korobeynikov Department of Statistical Modelling, Saint Petersburg State University ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r351340 - [MSP430] Fix msp430-toolchain.c on Windows (added in r351228)
Author: asl Date: Wed Jan 16 05:28:30 2019 New Revision: 351340 URL: http://llvm.org/viewvc/llvm-project?rev=351340&view=rev Log: [MSP430] Fix msp430-toolchain.c on Windows (added in r351228) Patch by Kristina Bessonova! Differential Revision: https://reviews.llvm.org/D56776 Modified: cfe/trunk/test/Driver/msp430-toolchain.c Modified: cfe/trunk/test/Driver/msp430-toolchain.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msp430-toolchain.c?rev=351340&r1=351339&r2=351340&view=diff == --- cfe/trunk/test/Driver/msp430-toolchain.c (original) +++ cfe/trunk/test/Driver/msp430-toolchain.c Wed Jan 16 05:28:30 2019 @@ -8,44 +8,44 @@ // RUN: --gcc-toolchain=%S/Inputs/basic_msp430_tree 2>&1 \ // RUN: | FileCheck -check-prefix=MSP430 %s -// MSP430: "{{.*}}Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../bin/msp430-elf-ld" +// MSP430: "{{.*}}Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}bin{{/|}}msp430-elf-ld" // MSP430: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430" -// MSP430: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../msp430-elf/lib/430" -// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../msp430-elf/lib/430/crt0.o" -// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtbegin.o" +// MSP430: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}msp430-elf{{/|}}lib/430" +// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}msp430-elf{{/|}}lib/430{{/|}}crt0.o" +// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430{{/|}}crtbegin.o" // MSP430: "--start-group" "-lmul_none" "-lgcc" "-lc" "-lcrt" "-lnosys" "--end-group" -// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtend.o" -// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../msp430-elf/lib/430/crtn.o" +// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430{{/|}}crtend.o" +// MSP430: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}msp430-elf{{/|}}lib/430{{/|}}crtn.o" // RUN: %clang %s -### -no-canonical-prefixes -target msp430 -nodefaultlibs \ // RUN: --gcc-toolchain=%S/Inputs/basic_msp430_tree 2>&1 \ // RUN: | FileCheck -check-prefix=MSP430-NO-DFT-LIB %s -// MSP430-NO-DFT-LIB: "{{.*}}Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../bin/msp430-elf-ld" +// MSP430-NO-DFT-LIB: "{{.*}}Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}bin{{/|}}msp430-elf-ld" // MSP430-NO-DFT-LIB: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430" -// MSP430-NO-DFT-LIB: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../msp430-elf/lib/430" -// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../msp430-elf/lib/430/crt0.o" -// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtbegin.o" +// MSP430-NO-DFT-LIB: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}msp430-elf{{/|}}lib/430" +// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}msp430-elf{{/|}}lib/430{{/|}}crt0.o" +// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430{{/|}}crtbegin.o" // MSP430-NO-DFT-LIB: "--start-group" "-lmul_none" "-lgcc" "--end-group" -// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtend.o" -// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../msp430-elf/lib/430/crtn.o" +// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430{{/|}}crtend.o" +// MSP430-NO-DFT-LIB: "{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}msp430-elf{{/|}}lib/430{{/|}}crtn.o" // RUN: %clang %s -### -no-canonical-prefixes -target msp430 -nostartfiles \ // RUN: --gcc-toolchain=%S/Inputs/basic_msp430_tree 2>&1 \ // RUN: | FileCheck -check-prefix=MSP430-NO-START %s -// MSP430-NO-START: "{{.*}}Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../bin/msp430-elf-ld" +// MSP430-NO-START: "{{.*}}Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}bin{{/|}}msp430-elf-ld" // MSP430-NO-START: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430" -// MSP430-NO-START: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../../../msp430-elf/lib/430" +// MSP430-NO-START: "-L{{.*}}/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/../../..{{/|}}..{{/|}}msp430-elf{{/|}}lib/430" // MSP430-NO-START:
r351344 - [MSP430] Improve support of 'interrupt' attribute
Author: asl Date: Wed Jan 16 05:44:01 2019 New Revision: 351344 URL: http://llvm.org/viewvc/llvm-project?rev=351344&view=rev Log: [MSP430] Improve support of 'interrupt' attribute * Accept as an argument constants in range 0..63 (aligned with TI headers and linker scripts provided with TI GCC toolchain). * Emit function attribute 'interrupt'='xx' instead of aliases (used in the backend to create a section for particular interrupt vector). * Add more diagnostics. Patch by Kristina Bessonova! Differential Revision: https://reviews.llvm.org/D56663 Added: cfe/trunk/test/CodeGen/attr-msp430.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/lib/Sema/SemaDeclAttr.cpp cfe/trunk/test/Sema/attr-msp430.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=351344&r1=351343&r2=351344&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jan 16 05:44:01 2019 @@ -274,6 +274,10 @@ def warn_riscv_interrupt_attribute : War "RISC-V 'interrupt' attribute only applies to functions that have " "%select{no parameters|a 'void' return type}0">, InGroup; +def warn_msp430_interrupt_attribute : Warning< + "MSP430 'interrupt' attribute only applies to functions that have " + "%select{no parameters|a 'void' return type}0">, + InGroup; def warn_unused_parameter : Warning<"unused parameter %0">, InGroup, DefaultIgnore; def warn_unused_variable : Warning<"unused variable %0">, Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=351344&r1=351343&r2=351344&view=diff == --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Jan 16 05:44:01 2019 @@ -6774,21 +6774,19 @@ void MSP430TargetCodeGenInfo::setTargetA if (GV->isDeclaration()) return; if (const FunctionDecl *FD = dyn_cast_or_null(D)) { -if (const MSP430InterruptAttr *attr = FD->getAttr()) { - // Handle 'interrupt' attribute: - llvm::Function *F = cast(GV); +const auto *InterruptAttr = FD->getAttr(); +if (!InterruptAttr) + return; - // Step 1: Set ISR calling convention. - F->setCallingConv(llvm::CallingConv::MSP430_INTR); +// Handle 'interrupt' attribute: +llvm::Function *F = cast(GV); - // Step 2: Add attributes goodness. - F->addFnAttr(llvm::Attribute::NoInline); +// Step 1: Set ISR calling convention. +F->setCallingConv(llvm::CallingConv::MSP430_INTR); - // Step 3: Emit ISR vector alias. - unsigned Num = attr->getNumber() / 2; - llvm::GlobalAlias::create(llvm::Function::ExternalLinkage, -"__isr_" + Twine(Num), F); -} +// Step 2: Add attributes goodness. +F->addFnAttr(llvm::Attribute::NoInline); +F->addFnAttr("interrupt", llvm::utostr(InterruptAttr->getNumber())); } } Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=351344&r1=351343&r2=351344&view=diff == --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Jan 16 05:44:01 2019 @@ -5377,6 +5377,27 @@ static void handleARMInterruptAttr(Sema } static void handleMSP430InterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + // MSP430 'interrupt' attribute is applied to + // a function with no parameters and void return type. + if (!isFunctionOrMethod(D)) { +S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) +<< "'interrupt'" << ExpectedFunctionOrMethod; +return; + } + + if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { +S.Diag(D->getLocation(), diag::warn_msp430_interrupt_attribute) +<< 0; +return; + } + + if (!getFunctionOrMethodResultType(D)->isVoidType()) { +S.Diag(D->getLocation(), diag::warn_msp430_interrupt_attribute) +<< 1; +return; + } + + // The attribute takes one integer argument. if (!checkAttributeNumArgs(S, AL, 1)) return; @@ -5386,8 +5407,6 @@ static void handleMSP430InterruptAttr(Se return; } - // FIXME: Check for decl - it should be void ()(void). - Expr *NumParamsExpr = static_cast(AL.getArgAsExpr(0)); llvm::APSInt NumParams(32); if (!NumParamsExpr->isIntegerConstantExpr(NumParams, S.Context)) { @@ -5396,9 +5415,9 @@ static void handleMSP430InterruptAttr(Se << NumParamsExpr->getSourceRange(); return; } - + // The argument should be in range 0..63. unsigned Num = Num
r351449 - CodeGen: Cast llvm.flt.rounds result to match __builtin_flt_rounds
Author: asl Date: Thu Jan 17 07:21:55 2019 New Revision: 351449 URL: http://llvm.org/viewvc/llvm-project?rev=351449&view=rev Log: CodeGen: Cast llvm.flt.rounds result to match __builtin_flt_rounds llvm.flt.rounds returns an i32, but the builtin expects an integer. On targets where integers are not 32-bits clang tries to bitcast the result, causing an assertion failure. The patch enables newlib build for msp430. Patch by Edward Jones! Differential Revision: https://reviews.llvm.org/D24461 Added: cfe/trunk/test/CodeGen/builtins-msp430.c Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/builtins.c Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351449&r1=351448&r2=351449&view=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Jan 17 07:21:55 2019 @@ -2130,6 +2130,17 @@ RValue CodeGenFunction::EmitBuiltinExpr( return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(; } + case Builtin::BI__builtin_flt_rounds: { +Value *F = CGM.getIntrinsic(Intrinsic::flt_rounds); + +llvm::Type *ResultType = ConvertType(E->getType()); +Value *Result = Builder.CreateCall(F); +if (Result->getType() != ResultType) + Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true, + "cast"); +return RValue::get(Result); + } + case Builtin::BI__builtin_fpclassify: { Value *V = EmitScalarExpr(E->getArg(5)); llvm::Type *Ty = ConvertType(E->getArg(5)->getType()); Added: cfe/trunk/test/CodeGen/builtins-msp430.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-msp430.c?rev=351449&view=auto == --- cfe/trunk/test/CodeGen/builtins-msp430.c (added) +++ cfe/trunk/test/CodeGen/builtins-msp430.c Thu Jan 17 07:21:55 2019 @@ -0,0 +1,10 @@ +// REQUIRES: msp430-registered-target +// RUN: %clang_cc1 -triple msp430-unknown-unknown -emit-llvm %s -o - | FileCheck %s + +int test_builtin_flt_rounds() { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = call i32 @llvm.flt.rounds() + // CHECK-DAG: [[V1:[%A-Za-z0-9.]+]] = trunc i32 [[V0]] to i16 + // CHECK-DAG: ret i16 [[V1]] + return __builtin_flt_rounds(); +} + Modified: cfe/trunk/test/CodeGen/builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=351449&r1=351448&r2=351449&view=diff == --- cfe/trunk/test/CodeGen/builtins.c (original) +++ cfe/trunk/test/CodeGen/builtins.c Thu Jan 17 07:21:55 2019 @@ -246,6 +246,9 @@ void test_float_builtins(float F, double // CHECK: fcmp uge float {{.*}}, 0x3810 // CHECK: and i1 // CHECK: and i1 + + res = __builtin_flt_rounds(); + // CHECK: call i32 @llvm.flt.rounds( } // CHECK-LABEL: define void @test_float_builtin_ops ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r352177 - [MSP430] Ajust f32/f64 alignment according to MSP430 EABI
Author: asl Date: Fri Jan 25 00:51:53 2019 New Revision: 352177 URL: http://llvm.org/viewvc/llvm-project?rev=352177&view=rev Log: [MSP430] Ajust f32/f64 alignment according to MSP430 EABI Patch by Kristina Bessonova! Differential Revision: https://reviews.llvm.org/D57015 Added: cfe/trunk/test/CodeGen/msp430-align.c Modified: cfe/trunk/lib/Basic/Targets/MSP430.h cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets/MSP430.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/MSP430.h?rev=352177&r1=352176&r2=352177&view=diff == --- cfe/trunk/lib/Basic/Targets/MSP430.h (original) +++ cfe/trunk/lib/Basic/Targets/MSP430.h Fri Jan 25 00:51:53 2019 @@ -33,6 +33,10 @@ public: LongWidth = 32; LongLongWidth = 64; LongAlign = LongLongAlign = 16; +FloatWidth = 32; +FloatAlign = 16; +DoubleWidth = LongDoubleWidth = 64; +DoubleAlign = LongDoubleAlign = 16; PointerWidth = 16; PointerAlign = 16; SuitableAlign = 16; @@ -51,6 +55,8 @@ public: return None; } + bool allowsLargerPreferedTypeAlignment() const override { return false; } + bool hasFeature(StringRef Feature) const override { return Feature == "msp430"; } Added: cfe/trunk/test/CodeGen/msp430-align.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/msp430-align.c?rev=352177&view=auto == --- cfe/trunk/test/CodeGen/msp430-align.c (added) +++ cfe/trunk/test/CodeGen/msp430-align.c Fri Jan 25 00:51:53 2019 @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple msp430-elf -emit-llvm %s -o - | FileCheck %s + +// MSP430 target prefers chars to be aligned to 8 bit and other types to 16 bit. + +// CHECK: @c ={{.*}}global i8 1, align 1 +// CHECK: @s ={{.*}}global i16 266, align 2 +// CHECK: @i ={{.*}}global i16 266, align 2 +// CHECK: @l ={{.*}}global i32 16909060, align 2 +// CHECK: @ll ={{.*}}global i64 283686952306183, align 2 +// CHECK: @f ={{.*}}global float 1.00e+00, align 2 +// CHECK: @d ={{.*}}global double 1.00e+00, align 2 +// CHECK: @ld ={{.*}}global double 1.00e+00, align 2 +// CHECK: @p ={{.*}}global i8* @c, align 2 + +char c = 1; +short s = 266; +int i = 266; +long l = 16909060; +long long ll = 283686952306183; +float f = 1.0f; +double d = 1.0; +long double ld = 1.0; +char *p = &c; Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=352177&r1=352176&r2=352177&view=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Fri Jan 25 00:51:53 2019 @@ -5158,7 +5158,7 @@ // MSP430:#define __SIZE_MAX__ 65535U // MSP430:#define __SIZE_TYPE__ unsigned int // MSP430:#define __SIZE_WIDTH__ 16 -// MSP430-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U +// MSP430-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 2U // MSP430:#define __UINT16_C_SUFFIX__ U // MSP430:#define __UINT16_MAX__ 65535U // MSP430:#define __UINT16_TYPE__ unsigned short ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r352181 - Disable PIC/PIE for MSP430 target by default.
Author: asl Date: Fri Jan 25 01:41:20 2019 New Revision: 352181 URL: http://llvm.org/viewvc/llvm-project?rev=352181&view=rev Log: Disable PIC/PIE for MSP430 target by default. Relocatable code generation is meaningless on MSP430, as the platform is too small to use shared libraries. Patch by Dmitry Mikushev! Differential Revision: https://reviews.llvm.org/D56927 Added: cfe/trunk/test/CodeGen/msp430-reloc.c Modified: cfe/trunk/lib/Driver/ToolChains/MSP430.h Modified: cfe/trunk/lib/Driver/ToolChains/MSP430.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSP430.h?rev=352181&r1=352180&r2=352181&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MSP430.h (original) +++ cfe/trunk/lib/Driver/ToolChains/MSP430.h Fri Jan 25 01:41:20 2019 @@ -36,6 +36,10 @@ public: llvm::opt::ArgStringList &CC1Args, Action::OffloadKind) const override; + bool isPICDefault() const override { return false; } + bool isPIEDefault() const override { return false; } + bool isPICDefaultForced() const override { return true; } + protected: Tool *buildLinker() const override; Added: cfe/trunk/test/CodeGen/msp430-reloc.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/msp430-reloc.c?rev=352181&view=auto == --- cfe/trunk/test/CodeGen/msp430-reloc.c (added) +++ cfe/trunk/test/CodeGen/msp430-reloc.c Fri Jan 25 01:41:20 2019 @@ -0,0 +1,29 @@ +// RUN: %clang -target msp430 -fPIC -S %s -o - | FileCheck %s + +// Check the compilation does not crash as it was crashing before with "-fPIC" enabled + +void *alloca(unsigned int size); + +// CHECK: .globl foo +short foo(char** data, char encoding) +{ + char* encoding_addr = alloca(sizeof(char)); + *encoding_addr = encoding; + + char tmp3 = *encoding_addr; + short conv2 = tmp3; + short and = conv2 & 0xf; + + switch (and) + { + case 0 : + case 4 : + case 10 : + return 1; + case 11 : + return 2; + } + + return 0; +} + ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r352186 - Revert r352181 as it's breaking the bots
Author: asl Date: Fri Jan 25 02:35:35 2019 New Revision: 352186 URL: http://llvm.org/viewvc/llvm-project?rev=352186&view=rev Log: Revert r352181 as it's breaking the bots Removed: cfe/trunk/test/CodeGen/msp430-reloc.c Modified: cfe/trunk/lib/Driver/ToolChains/MSP430.h Modified: cfe/trunk/lib/Driver/ToolChains/MSP430.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSP430.h?rev=352186&r1=352185&r2=352186&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MSP430.h (original) +++ cfe/trunk/lib/Driver/ToolChains/MSP430.h Fri Jan 25 02:35:35 2019 @@ -36,10 +36,6 @@ public: llvm::opt::ArgStringList &CC1Args, Action::OffloadKind) const override; - bool isPICDefault() const override { return false; } - bool isPIEDefault() const override { return false; } - bool isPICDefaultForced() const override { return true; } - protected: Tool *buildLinker() const override; Removed: cfe/trunk/test/CodeGen/msp430-reloc.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/msp430-reloc.c?rev=352185&view=auto == --- cfe/trunk/test/CodeGen/msp430-reloc.c (original) +++ cfe/trunk/test/CodeGen/msp430-reloc.c (removed) @@ -1,29 +0,0 @@ -// RUN: %clang -target msp430 -fPIC -S %s -o - | FileCheck %s - -// Check the compilation does not crash as it was crashing before with "-fPIC" enabled - -void *alloca(unsigned int size); - -// CHECK: .globl foo -short foo(char** data, char encoding) -{ - char* encoding_addr = alloca(sizeof(char)); - *encoding_addr = encoding; - - char tmp3 = *encoding_addr; - short conv2 = tmp3; - short and = conv2 & 0xf; - - switch (and) - { - case 0 : - case 4 : - case 10 : - return 1; - case 11 : - return 2; - } - - return 0; -} - ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] cb56fa2 - [MSP430] Update register names
Author: Anatoly Trosinenko Date: 2020-06-26T15:32:07+03:00 New Revision: cb56fa2196c5d80ce72e8e8f6ee2a7ac80acca77 URL: https://github.com/llvm/llvm-project/commit/cb56fa2196c5d80ce72e8e8f6ee2a7ac80acca77 DIFF: https://github.com/llvm/llvm-project/commit/cb56fa2196c5d80ce72e8e8f6ee2a7ac80acca77.diff LOG: [MSP430] Update register names When writing a unit test on replacing standard epilogue sequences with `BR __mspabi_func_epilog_`, by manually asm-clobbering `rN` - `r10` for N = 4..10, everything worked well except for seeming inability to clobber r4. The problem was that MSP430 code generator of LLVM used an obsolete name FP for that register. Things were worse because when `llc` read an unknown register name, it silently ignored it. That is, I cannot use `fp` register name from the C code because Clang does not accept it (exactly like GCC). But the accepted name `r4` is not recognised by `llc` (it can be used in listings passed to `llvm-mc` and even `fp` is replace to `r4` by `llvm-mc`). So I can specify any of `fp` or `r4` for the string literal of `asm(...)` but nothing in the clobber list. This patch replaces `MSP430::FP` with `MSP430::R4` in the backend code (even [MSP430 EABI](http://www.ti.com/lit/an/slaa534/slaa534.pdf) doesn't mention FP as a register name). The R0 - R3 registers, on the other hand, are left as is in the backend code (after all, they have some special meaning on the ISA level). It is just ensured clang is renaming them as expected by the downstream tools. There is probably not much sense in **marking them clobbered** but rename them //just in case// for use at potentially different contexts. Differential Revision: https://reviews.llvm.org/D82184 Added: clang/test/CodeGen/msp430-register-names.c llvm/test/CodeGen/MSP430/inline-asm-register-names.ll Modified: clang/lib/Basic/Targets/MSP430.h llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp llvm/lib/Target/MSP430/Disassembler/MSP430Disassembler.cpp llvm/lib/Target/MSP430/MSP430FrameLowering.cpp llvm/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp llvm/lib/Target/MSP430/MSP430RegisterInfo.td llvm/test/CodeGen/MSP430/asm-clobbers.ll Removed: diff --git a/clang/lib/Basic/Targets/MSP430.h b/clang/lib/Basic/Targets/MSP430.h index 620f12d2b8e3..9d42e4d4bb18 100644 --- a/clang/lib/Basic/Targets/MSP430.h +++ b/clang/lib/Basic/Targets/MSP430.h @@ -64,8 +64,14 @@ class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo { ArrayRef getGCCRegNames() const override; ArrayRef getGCCRegAliases() const override { -// No aliases. -return None; +// Make r0 - r3 be recognized by llc (f.e., in clobber list) +static const TargetInfo::GCCRegAlias GCCRegAliases[] = { +{{"r0"}, "pc"}, +{{"r1"}, "sp"}, +{{"r2"}, "sr"}, +{{"r3"}, "cg"}, +}; +return llvm::makeArrayRef(GCCRegAliases); } bool validateAsmConstraint(const char *&Name, diff --git a/clang/test/CodeGen/msp430-register-names.c b/clang/test/CodeGen/msp430-register-names.c new file mode 100644 index ..106b6c933a49 --- /dev/null +++ b/clang/test/CodeGen/msp430-register-names.c @@ -0,0 +1,105 @@ +// Registers R0 - R3 have diff erent names inside the LLVM MSP430 target code. +// Test that they are handled properly when used inside clobber lists. +// At the time of writing, llc silently ignores unknown register names. + +// REQUIRES: msp430-registered-target +// RUN: %clang -target msp430 -c %s -mllvm -stop-after=finalize-isel -o- | FileCheck %s + +void test_function(void) { + asm volatile("" + : + : + : "r0"); + asm volatile("" + : + : + : "r1"); + asm volatile("" + : + : + : "r2"); + asm volatile("" + : + : + : "r3"); + asm volatile("" + : + : + : "r4"); + asm volatile("" + : + : + : "r5"); + asm volatile("" + : + : + : "r6"); + asm volatile("" + : + : + : "r7"); + asm volatile("" + : + : + : "r8"); + asm volatile("" + : + : + : "r9"); + asm volatile("" + : + : + : "r10"); + asm volatile("" + : + : + : "r11"); + asm volatile("" + : + : + : "r12"); + asm volatile("" + : + : + : "r13"); + asm volatile("" + : + : + : "r14"); + asm volatile("" + : + :
[clang] 8f6620f - [MSP430] Update register names
Author: Anatoly Trosinenko Date: 2020-06-22T13:24:03+03:00 New Revision: 8f6620f663031da2bb35b788239f4b607271af84 URL: https://github.com/llvm/llvm-project/commit/8f6620f663031da2bb35b788239f4b607271af84 DIFF: https://github.com/llvm/llvm-project/commit/8f6620f663031da2bb35b788239f4b607271af84.diff LOG: [MSP430] Update register names When writing a unit test on replacing standard epilogue sequences with `BR __mspabi_func_epilog_`, by manually asm-clobbering `rN` - `r10` for N = 4..10, everything worked well except for seeming inability to clobber r4. The problem was that MSP430 code generator of LLVM used an obsolete name FP for that register. Things were worse because when `llc` read an unknown register name, it silently ignored it. Differential Revision: https://reviews.llvm.org/D82184 Added: clang/test/CodeGen/msp430-register-names.c llvm/test/CodeGen/MSP430/inline-asm-register-names.ll Modified: clang/lib/Basic/Targets/MSP430.h llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp llvm/lib/Target/MSP430/Disassembler/MSP430Disassembler.cpp llvm/lib/Target/MSP430/MSP430FrameLowering.cpp llvm/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp llvm/lib/Target/MSP430/MSP430RegisterInfo.td llvm/test/CodeGen/MSP430/asm-clobbers.ll Removed: diff --git a/clang/lib/Basic/Targets/MSP430.h b/clang/lib/Basic/Targets/MSP430.h index 620f12d2b8e3..2c734f6b724e 100644 --- a/clang/lib/Basic/Targets/MSP430.h +++ b/clang/lib/Basic/Targets/MSP430.h @@ -64,8 +64,14 @@ class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo { ArrayRef getGCCRegNames() const override; ArrayRef getGCCRegAliases() const override { -// No aliases. -return None; +// Make r0 - r3 be recognized by llc (f.e., in clobber list) +static const TargetInfo::GCCRegAlias GCCRegAliases[] = { +{{"r0"}, "pc"}, +{{"r1"}, "sp"}, +{{"r2"}, "sr"}, +{{"r3"}, "cg"}, +}; +return GCCRegAliases; } bool validateAsmConstraint(const char *&Name, diff --git a/clang/test/CodeGen/msp430-register-names.c b/clang/test/CodeGen/msp430-register-names.c new file mode 100644 index ..106b6c933a49 --- /dev/null +++ b/clang/test/CodeGen/msp430-register-names.c @@ -0,0 +1,105 @@ +// Registers R0 - R3 have diff erent names inside the LLVM MSP430 target code. +// Test that they are handled properly when used inside clobber lists. +// At the time of writing, llc silently ignores unknown register names. + +// REQUIRES: msp430-registered-target +// RUN: %clang -target msp430 -c %s -mllvm -stop-after=finalize-isel -o- | FileCheck %s + +void test_function(void) { + asm volatile("" + : + : + : "r0"); + asm volatile("" + : + : + : "r1"); + asm volatile("" + : + : + : "r2"); + asm volatile("" + : + : + : "r3"); + asm volatile("" + : + : + : "r4"); + asm volatile("" + : + : + : "r5"); + asm volatile("" + : + : + : "r6"); + asm volatile("" + : + : + : "r7"); + asm volatile("" + : + : + : "r8"); + asm volatile("" + : + : + : "r9"); + asm volatile("" + : + : + : "r10"); + asm volatile("" + : + : + : "r11"); + asm volatile("" + : + : + : "r12"); + asm volatile("" + : + : + : "r13"); + asm volatile("" + : + : + : "r14"); + asm volatile("" + : + : + : "r15"); + // CHECK: call void asm sideeffect "", "~{pc}"() + // CHECK: call void asm sideeffect "", "~{sp}"() + // CHECK: call void asm sideeffect "", "~{sr}"() + // CHECK: call void asm sideeffect "", "~{cg}"() + // CHECK: call void asm sideeffect "", "~{r4}"() + // CHECK: call void asm sideeffect "", "~{r5}"() + // CHECK: call void asm sideeffect "", "~{r6}"() + // CHECK: call void asm sideeffect "", "~{r7}"() + // CHECK: call void asm sideeffect "", "~{r8}"() + // CHECK: call void asm sideeffect "", "~{r9}"() + // CHECK: call void asm sideeffect "", "~{r10}"() + // CHECK: call void asm sideeffect "", "~{r11}"() + // CHECK: call void asm sideeffect "", "~{r12}"() + // CHECK: call void asm sideeffect "", "~{r13}"() + // CHECK: call void asm sideeffect "", "~{r14}"() + // CHECK: call void asm sideeffect "", "~{r15}"() + // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $pc +
[clang] 6cb80fb - Revert "[MSP430] Update register names"
Author: Anton Korobeynikov Date: 2020-06-22T13:37:22+03:00 New Revision: 6cb80fbe405264471e9bc5b6ea19694e51ae1b11 URL: https://github.com/llvm/llvm-project/commit/6cb80fbe405264471e9bc5b6ea19694e51ae1b11 DIFF: https://github.com/llvm/llvm-project/commit/6cb80fbe405264471e9bc5b6ea19694e51ae1b11.diff LOG: Revert "[MSP430] Update register names" This reverts commit 8f6620f663031da2bb35b788239f4b607271af84. Added: Modified: clang/lib/Basic/Targets/MSP430.h llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp llvm/lib/Target/MSP430/Disassembler/MSP430Disassembler.cpp llvm/lib/Target/MSP430/MSP430FrameLowering.cpp llvm/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp llvm/lib/Target/MSP430/MSP430RegisterInfo.td llvm/test/CodeGen/MSP430/asm-clobbers.ll Removed: clang/test/CodeGen/msp430-register-names.c llvm/test/CodeGen/MSP430/inline-asm-register-names.ll diff --git a/clang/lib/Basic/Targets/MSP430.h b/clang/lib/Basic/Targets/MSP430.h index 2c734f6b724e..620f12d2b8e3 100644 --- a/clang/lib/Basic/Targets/MSP430.h +++ b/clang/lib/Basic/Targets/MSP430.h @@ -64,14 +64,8 @@ class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo { ArrayRef getGCCRegNames() const override; ArrayRef getGCCRegAliases() const override { -// Make r0 - r3 be recognized by llc (f.e., in clobber list) -static const TargetInfo::GCCRegAlias GCCRegAliases[] = { -{{"r0"}, "pc"}, -{{"r1"}, "sp"}, -{{"r2"}, "sr"}, -{{"r3"}, "cg"}, -}; -return GCCRegAliases; +// No aliases. +return None; } bool validateAsmConstraint(const char *&Name, diff --git a/clang/test/CodeGen/msp430-register-names.c b/clang/test/CodeGen/msp430-register-names.c deleted file mode 100644 index 106b6c933a49.. --- a/clang/test/CodeGen/msp430-register-names.c +++ /dev/null @@ -1,105 +0,0 @@ -// Registers R0 - R3 have diff erent names inside the LLVM MSP430 target code. -// Test that they are handled properly when used inside clobber lists. -// At the time of writing, llc silently ignores unknown register names. - -// REQUIRES: msp430-registered-target -// RUN: %clang -target msp430 -c %s -mllvm -stop-after=finalize-isel -o- | FileCheck %s - -void test_function(void) { - asm volatile("" - : - : - : "r0"); - asm volatile("" - : - : - : "r1"); - asm volatile("" - : - : - : "r2"); - asm volatile("" - : - : - : "r3"); - asm volatile("" - : - : - : "r4"); - asm volatile("" - : - : - : "r5"); - asm volatile("" - : - : - : "r6"); - asm volatile("" - : - : - : "r7"); - asm volatile("" - : - : - : "r8"); - asm volatile("" - : - : - : "r9"); - asm volatile("" - : - : - : "r10"); - asm volatile("" - : - : - : "r11"); - asm volatile("" - : - : - : "r12"); - asm volatile("" - : - : - : "r13"); - asm volatile("" - : - : - : "r14"); - asm volatile("" - : - : - : "r15"); - // CHECK: call void asm sideeffect "", "~{pc}"() - // CHECK: call void asm sideeffect "", "~{sp}"() - // CHECK: call void asm sideeffect "", "~{sr}"() - // CHECK: call void asm sideeffect "", "~{cg}"() - // CHECK: call void asm sideeffect "", "~{r4}"() - // CHECK: call void asm sideeffect "", "~{r5}"() - // CHECK: call void asm sideeffect "", "~{r6}"() - // CHECK: call void asm sideeffect "", "~{r7}"() - // CHECK: call void asm sideeffect "", "~{r8}"() - // CHECK: call void asm sideeffect "", "~{r9}"() - // CHECK: call void asm sideeffect "", "~{r10}"() - // CHECK: call void asm sideeffect "", "~{r11}"() - // CHECK: call void asm sideeffect "", "~{r12}"() - // CHECK: call void asm sideeffect "", "~{r13}"() - // CHECK: call void asm sideeffect "", "~{r14}"() - // CHECK: call void asm sideeffect "", "~{r15}"() - // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $pc - // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $sp - // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $sr - // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $cg - // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $r4 - // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $r5 - // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $r6 -
r353212 - Do not use frame pointer by default for MSP430
Author: asl Date: Tue Feb 5 12:15:03 2019 New Revision: 353212 URL: http://llvm.org/viewvc/llvm-project?rev=353212&view=rev Log: Do not use frame pointer by default for MSP430 This is suggested by 3.3.9 of MSP430 EABI document. We do allow user to manually enable frame pointer. GCC toolchain uses the same behavior. Patch by Dmitry Mikushev! Differential Revision: https://reviews.llvm.org/D56925 Added: cfe/trunk/test/CodeGen/msp430-fp-elim.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=353212&r1=353211&r2=353212&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Feb 5 12:15:03 2019 @@ -519,6 +519,7 @@ static bool useFramePointerForTargetByDe case llvm::Triple::xcore: case llvm::Triple::wasm32: case llvm::Triple::wasm64: + case llvm::Triple::msp430: // XCore never wants frame pointers, regardless of OS. // WebAssembly never wants frame pointers. return false; Added: cfe/trunk/test/CodeGen/msp430-fp-elim.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/msp430-fp-elim.c?rev=353212&view=auto == --- cfe/trunk/test/CodeGen/msp430-fp-elim.c (added) +++ cfe/trunk/test/CodeGen/msp430-fp-elim.c Tue Feb 5 12:15:03 2019 @@ -0,0 +1,19 @@ +// REQUIRES: msp430-registered-target +// RUN: %clang_cc1 -mdisable-fp-elim -triple msp430 -S %s -o - | FileCheck %s --check-prefix=FP_ENFORCED +// RUN: %clang_cc1 -triple msp430 -S %s -o - | FileCheck %s --check-prefix=FP_DEFAULT + +// Check the frame pointer is not used on MSP430 by default, but can be forcibly turned on. + +// FP_ENFORCED: push r4 +// FP_ENFORCED: mov r4, r4 +// FP_ENFORCED: pop r4 +// FP_DEFAULT: .globl fp_elim_check +// FP_DEFAULT-NOT: push r4 +// FP_DEFAULT: mov r4, r4 +// FP_DEFAULT-NOT: pop r4 + +void fp_elim_check() +{ + asm volatile ("mov r4, r4"); +} + ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r353877 - Disable PIC/PIE for MSP430 target
Author: asl Date: Tue Feb 12 12:46:00 2019 New Revision: 353877 URL: http://llvm.org/viewvc/llvm-project?rev=353877&view=rev Log: Disable PIC/PIE for MSP430 target Relocatable code generation is meaningless on MSP430, as the platform is too small to use shared libraries. Patch by Dmitry Mikushev! Differential Revision: https://reviews.llvm.org/D56927 Added: cfe/trunk/test/CodeGen/msp430-reloc.c Modified: cfe/trunk/lib/Driver/ToolChains/MSP430.h Modified: cfe/trunk/lib/Driver/ToolChains/MSP430.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSP430.h?rev=353877&r1=353876&r2=353877&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MSP430.h (original) +++ cfe/trunk/lib/Driver/ToolChains/MSP430.h Tue Feb 12 12:46:00 2019 @@ -36,6 +36,10 @@ public: llvm::opt::ArgStringList &CC1Args, Action::OffloadKind) const override; + bool isPICDefault() const override { return false; } + bool isPIEDefault() const override { return false; } + bool isPICDefaultForced() const override { return true; } + protected: Tool *buildLinker() const override; Added: cfe/trunk/test/CodeGen/msp430-reloc.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/msp430-reloc.c?rev=353877&view=auto == --- cfe/trunk/test/CodeGen/msp430-reloc.c (added) +++ cfe/trunk/test/CodeGen/msp430-reloc.c Tue Feb 12 12:46:00 2019 @@ -0,0 +1,30 @@ +// REQUIRES: msp430-registered-target +// RUN: %clang -target msp430 -fPIC -S %s -o - | FileCheck %s + +// Check the compilation does not crash as it was crashing before with "-fPIC" enabled + +void *alloca(unsigned int size); + +// CHECK: .globl foo +short foo(char** data, char encoding) +{ + char* encoding_addr = alloca(sizeof(char)); + *encoding_addr = encoding; + + char tmp3 = *encoding_addr; + short conv2 = tmp3; + short and = conv2 & 0xf; + + switch (and) + { + case 0 : + case 4 : + case 10 : + return 1; + case 11 : + return 2; + } + + return 0; +} + ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r297005 - Do not include GCC "resource" directory into the set of built-in include paths on MingW.
Author: asl Date: Mon Mar 6 03:32:56 2017 New Revision: 297005 URL: http://llvm.org/viewvc/llvm-project?rev=297005&view=rev Log: Do not include GCC "resource" directory into the set of built-in include paths on MingW. Patch by Mateusz Mikuła. Differential Revision: https://reviews.llvm.org/D29464 Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp cfe/trunk/test/Driver/mingw.cpp Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MinGWToolChain.cpp?rev=297005&r1=297004&r2=297005&view=diff == --- cfe/trunk/lib/Driver/MinGWToolChain.cpp (original) +++ cfe/trunk/lib/Driver/MinGWToolChain.cpp Mon Mar 6 03:32:56 2017 @@ -148,23 +148,17 @@ void MinGW::printVerboseInfo(raw_ostream // c:\mingw\lib\gcc\mingw32\4.8.1\include\c++ // c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\mingw32 // c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\backward -// c:\mingw\lib\gcc\mingw32\4.8.1\include // c:\mingw\include -// c:\mingw\lib\gcc\mingw32\4.8.1\include-fixed // c:\mingw\mingw32\include // Windows, mingw-w64 mingw-builds -// c:\mingw32\lib\gcc\i686-w64-mingw32\4.9.1\include -// c:\mingw32\lib\gcc\i686-w64-mingw32\4.9.1\include-fixed // c:\mingw32\i686-w64-mingw32\include // c:\mingw32\i686-w64-mingw32\include\c++ // c:\mingw32\i686-w64-mingw32\include\c++\i686-w64-mingw32 // c:\mingw32\i686-w64-mingw32\include\c++\backward // Windows, mingw-w64 msys2 -// c:\msys64\mingw32\lib\gcc\i686-w64-mingw32\4.9.2\include // c:\msys64\mingw32\include -// c:\msys64\mingw32\lib\gcc\i686-w64-mingw32\4.9.2\include-fixed // c:\msys64\mingw32\i686-w64-mingw32\include // c:\msys64\mingw32\include\c++\4.9.2 // c:\msys64\mingw32\include\c++\4.9.2\i686-w64-mingw32 @@ -174,24 +168,18 @@ void MinGW::printVerboseInfo(raw_ostream // /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++ // /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/x86_64-w64-mingw32 // /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/backward -// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include -// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include-fixed // /usr/x86_64-w64-mingw32/sys-root/mingw/include // Arch Linux // /usr/i686-w64-mingw32/include/c++/5.1.0 // /usr/i686-w64-mingw32/include/c++/5.1.0/i686-w64-mingw32 // /usr/i686-w64-mingw32/include/c++/5.1.0/backward -// /usr/lib/gcc/i686-w64-mingw32/5.1.0/include -// /usr/lib/gcc/i686-w64-mingw32/5.1.0/include-fixed // /usr/i686-w64-mingw32/include // Ubuntu // /usr/include/c++/4.8 // /usr/include/c++/4.8/x86_64-w64-mingw32 // /usr/include/c++/4.8/backward -// /usr/lib/gcc/x86_64-w64-mingw32/4.8/include -// /usr/lib/gcc/x86_64-w64-mingw32/4.8/include-fixed // /usr/x86_64-w64-mingw32/include void MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs, @@ -209,15 +197,11 @@ void MinGW::AddClangSystemIncludeArgs(co return; if (GetRuntimeLibType(DriverArgs) == ToolChain::RLT_Libgcc) { -llvm::SmallString<1024> IncludeDir(GccLibDir); -llvm::sys::path::append(IncludeDir, "include"); -addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); -IncludeDir += "-fixed"; // openSUSE addSystemInclude(DriverArgs, CC1Args, Base + Arch + "/sys-root/mingw/include"); -addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); } + addSystemInclude(DriverArgs, CC1Args, Base + Arch + llvm::sys::path::get_separator() + "include"); addSystemInclude(DriverArgs, CC1Args, Base + "include"); Modified: cfe/trunk/test/Driver/mingw.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw.cpp?rev=297005&r1=297004&r2=297005&view=diff == --- cfe/trunk/test/Driver/mingw.cpp (original) +++ cfe/trunk/test/Driver/mingw.cpp Mon Mar 6 03:32:56 2017 @@ -7,8 +7,6 @@ // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++" // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32" // CHECK_MINGW_ORG_TREE: "{{.*}}{{/|}}Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}backward" -// CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include" -// CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include-fixed" // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}mingw32{{/|}}include" // CHECK_MINGW_ORG_TREE: {{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}include @@ -17,8 +15,6 @@ // CHECK_MINGW_BUILDS_TRE
Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.
asl added a comment. I totally agree with Renato. What part of libc++abi requires exactly libunwind's unwind.h, what is the dependency? https://reviews.llvm.org/D24084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D16754: Bug 15785 - OpenCL errors using vector/scalar conditionals and short integer types
asl requested changes to this revision. asl added a comment. This revision now requires changes to proceed. Please don't create empty review requests. This is ridiculous. Repository: rL LLVM http://reviews.llvm.org/D16754 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
asl added a comment. Hrm? Why I'm set to review this? Repository: rL LLVM http://reviews.llvm.org/D21737 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #86721)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/86721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)
asl wrote: I am ok with the changes. Though with pauth we'd probably need to rename `getRawPointerFromAddress` to indicate clearer that it has side effects (like `extractRawPointerFromAddress` or something like this) https://github.com/llvm/llvm-project/pull/67454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Support ptrauth builtins and -fptrauth-intrinsics. (PR #65996)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/65996 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/67454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)
asl wrote: We discussed the naming thing (`extractRawPointerFromAddress` vs `getRawPointerFromAddress`) at pauth call and decided that it would be better to do this renaming now. @ahmedbougacha will coordinate that renaming. https://github.com/llvm/llvm-project/pull/67454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)
asl wrote: > I'm not sure `extractRawPointerFromAddress` conveys the fact that the > function might do code-gen instead of just returning some pointer. I wonder > if there's a better name. > > `computeRawPointerFromAddress` `genRawPointerFromAddress` > `generateRawPointerFromAddress` `codeGenRawPointerFromAddress` > > Thoughts? I do not have particular preference. But probably like `compute` / `gen` slightly more. https://github.com/llvm/llvm-project/pull/67454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)
asl wrote: > Maybe `emitRawPointerFromAddress` is better. I see a lot of functions > starting with `emit` in CodeGen. Works for me! https://github.com/llvm/llvm-project/pull/67454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CodeGen][AArch64][FMV] PAC the stub_helper's frame on arm64e (PR #84704)
asl wrote: Tagging @kovdan01 Can the triple checks be generalized to checking about pauth-enabled subtarget feature? This way everything would work for ELF platforms eventually. https://github.com/llvm/llvm-project/pull/84704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MSP430][Clang] Update list of MCUs (PR #91258)
asl wrote: > The python script should likely be up streamed as well. But where? You could just put into `Target/MSP430`. https://github.com/llvm/llvm-project/pull/91258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MSP430][Clang] Update list of MCUs (PR #91258)
https://github.com/asl edited https://github.com/llvm/llvm-project/pull/91258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MSP430][Clang] Update list of MCUs (PR #91258)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/91258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MSP430][Clang] Update list of MCUs (PR #91258)
https://github.com/asl closed https://github.com/llvm/llvm-project/pull/91258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
@@ -20,7 +20,7 @@ .text #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) asl wrote: You are defining `__USING_WASM_EXCEPTIONS__`. Why you are not using it here and everywhere else? https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
@@ -20,7 +20,7 @@ .text #endif -#if !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) asl wrote: Ok. Then does the clang change really belong here? `LIBUNWIND_USES_WASM_EXCEPTIONS` also seems to be unused. https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)
https://github.com/asl approved this pull request. Ok from the generic point of view. I cannot judge if wasm-related part is ok though :) https://github.com/llvm/llvm-project/pull/92192 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] be61093 - [MSP430][Clang] Remove support for -mmcu=msp430
Author: Jozef Lawrynowicz Date: 2021-09-28T20:47:26+03:00 New Revision: be610932fa068ed2228b0f694ae80c9294f0293f URL: https://github.com/llvm/llvm-project/commit/be610932fa068ed2228b0f694ae80c9294f0293f DIFF: https://github.com/llvm/llvm-project/commit/be610932fa068ed2228b0f694ae80c9294f0293f.diff LOG: [MSP430][Clang] Remove support for -mmcu=msp430 The -mmcu= option accepts a generic MCU named "msp430", which sets the CPU to msp430 and disables hardware multiply support. The current purpose of accepting this value is to allow -mmcu= to be used as an alias for -mcpu=, however there are some downsides to doing this. -mmcu= provides additional features that will interfere with the expected behavior if the user tries to to use it as an alias for -mcpu=. -mmcu=msp430 will conflict with -mhwmult=, since the "msp430" MCU is defined to have no hardware multiply support, so the user will not be able to set an explicit hardware multiply version. -mmcu=msp430 will put "-Tmsp430.ld" on the linker command line, however TI's support files do not provide a linker script with this name and so the user would have to explicitly create it. Differential Revision: https://reviews.llvm.org/D108299 Added: Modified: clang/include/clang/Basic/MSP430Target.def clang/test/Driver/msp430-mmcu.c Removed: diff --git a/clang/include/clang/Basic/MSP430Target.def b/clang/include/clang/Basic/MSP430Target.def index a1e192c192610..7a10be1d54c8d 100644 --- a/clang/include/clang/Basic/MSP430Target.def +++ b/clang/include/clang/Basic/MSP430Target.def @@ -238,8 +238,7 @@ MSP430_MCU_FEAT("msp430f4793", "32bit") MSP430_MCU_FEAT("msp430f4784", "32bit") MSP430_MCU_FEAT("msp430f4794", "32bit") -// Generic MSUs -MSP430_MCU("msp430") +// Generic MCUs MSP430_MCU("msp430i2xxgeneric") #undef MSP430_MCU diff --git a/clang/test/Driver/msp430-mmcu.c b/clang/test/Driver/msp430-mmcu.c index 42caacb97fadc..5f973a542dfc9 100644 --- a/clang/test/Driver/msp430-mmcu.c +++ b/clang/test/Driver/msp430-mmcu.c @@ -14,3 +14,9 @@ // RUN: | FileCheck -check-prefix=MSP430-UNSUP %s // MSP430-UNSUP: error: the clang compiler does not support 'not-a-mcu' + +// The generic MCU name "msp430" is not supported. +// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430 2>&1 \ +// RUN: | FileCheck -check-prefix=MSP430 %s + +// MSP430: error: the clang compiler does not support 'msp430' ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Revert "demangle function names in trace files (#87626)" (PR #102274)
asl wrote: @tru @nikic @MaskRay should this be backported to 19 release branch? https://github.com/llvm/llvm-project/pull/102274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Wire -fptrauth-returns to "ptrauth-returns" fn attribute. (PR #102416)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/102416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement -fptrauth-auth-traps. (PR #102417)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/102417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PAC][ELF][AArch64] Encode several ptrauth features in PAuth core info (PR #102508)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/102508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PAC][ELF][AArch64] Encode several ptrauth features in PAuth core info (PR #102508)
asl wrote: But please wait for @MaskRay or other reviwers https://github.com/llvm/llvm-project/pull/102508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)
@@ -1758,6 +1758,34 @@ Also see the documentation for `@available }]; } +def PtrAuthDocs : Documentation { + let Category = DocCatVariable; + let Heading = "__ptrauth, __ptrauth_restricted_intptr"; asl wrote: `__ptrauth_restricted_intptr` is not here yet. https://github.com/llvm/llvm-project/pull/100830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)
@@ -956,6 +956,25 @@ def err_ptrauth_indirect_goto_addrlabel_arithmetic : Error< "%select{subtraction|addition}0 of address-of-label expressions is not " "supported with ptrauth indirect gotos">; +// __ptrauth qualifier +def err_ptrauth_qualifier_invalid : Error< + "%select{return types|parameter types|properties}2 may not be qualified with %select{__ptrauth|__ptrauth_restricted_intptr}1; type is %0">; asl wrote: ditto https://github.com/llvm/llvm-project/pull/100830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)
asl wrote: > Was there an RFC for this? I ask because it's introducing another qualifier > and that has broad impacts on things beyond Clang like libc++, etc so we > really need buy-in from a wider range of the community than will likely see > this PR. Just my 2 cents from downstream experience: the explicit qualifier is a great help for runtime library developers. As it makes explicit what is signed, what is not. And compiler ensures that all potential sensitive places are handled. Also, using qualifiers is much more convenient than explicit builtin calls :) https://github.com/llvm/llvm-project/pull/100830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Wire -fptrauth-returns to "ptrauth-returns" fn attribute. (PR #102416)
asl wrote: /cherry-pick 2eb6e30fe83ccce3cf01e596e73fa6385facd44b https://github.com/llvm/llvm-project/pull/102416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Wire -fptrauth-returns to "ptrauth-returns" fn attribute. (PR #102416)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/102416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement -fptrauth-auth-traps. (PR #102417)
asl wrote: /cherry-pick d179acd0484bac30c5ebbbed4d29a4734d92ac93 https://github.com/llvm/llvm-project/pull/102417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement -fptrauth-auth-traps. (PR #102417)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/102417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement -fptrauth-auth-traps. (PR #102417)
asl wrote: > Failed to cherry-pick: > [d179acd](https://github.com/llvm/llvm-project/commit/d179acd0484bac30c5ebbbed4d29a4734d92ac93) > > https://github.com/llvm/llvm-project/actions/runs/10324823761 > > Please manually backport the fix and push it to your github fork. Once this > is done, please create a [pull > request](https://github.com/llvm/llvm-project/compare) Depends on https://github.com/llvm/llvm-project/pull/102670 https://github.com/llvm/llvm-project/pull/102417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement -fptrauth-auth-traps. (PR #102417)
https://github.com/asl demilestoned https://github.com/llvm/llvm-project/pull/102417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement -fptrauth-auth-traps. (PR #102417)
asl wrote: /cherry-pick https://github.com/llvm/llvm-project/commit/d179acd0484bac30c5ebbbed4d29a4734d92ac93 https://github.com/llvm/llvm-project/pull/102417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement -fptrauth-auth-traps. (PR #102417)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/102417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Add test for CWG2486 (`noexcept` and function pointer conversion) (PR #107131)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/107131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PAC][Driver] Implement `-mbranch-protection=pauthabi` option (PR #97237)
asl wrote: > Is there any thought on how we want to manage signing schemas going forward? > For example I can imagine looking an environment from the triple to select a > signing schema for a particular platform. I could also see a potential for a > separate command line option to choose from documented named signing schemas. I think we discussed this a bit and the conclusion was that it would be up to the platform to chose the appropriate signing scheme (and do ABI versioning if desired / necessary). However, currently there is no way to ask platform for this and it looks like a chicken-and-egg problem. So we may want to come with some "default" values that are more or less "good enough". These in the future might be fully overriden by a platform or we may chose alternative approach. For now it is just a way to combine different `-fpauth-*` options as it seems to me. https://github.com/llvm/llvm-project/pull/97237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Incorrect codegen for constant global init with polymorphic MI (PR #99741)
https://github.com/asl approved this pull request. Neat! https://github.com/llvm/llvm-project/pull/99741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Incorrect codegen for constant global init with polymorphic MI (PR #99741)
https://github.com/asl closed https://github.com/llvm/llvm-project/pull/99741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement function pointer signing and authenticated function calls (PR #93906)
asl wrote: @ahatanak Will you please take a look into all these issues? https://github.com/llvm/llvm-project/pull/93906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add function type discrimination tests to static destructor tests (PR #99604)
asl wrote: @ojhunt Close or rebase? https://github.com/llvm/llvm-project/pull/99604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
asl wrote: FWIW, we are seeing authentication fails when running musl with pauth enabled and this PR. Working on reproducer. https://github.com/llvm/llvm-project/pull/97647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
https://github.com/asl requested changes to this pull request. https://github.com/llvm/llvm-project/pull/97647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
@@ -10685,6 +10689,26 @@ SDValue AArch64TargetLowering::LowerBR_JT(SDValue Op, return DAG.getNode(ISD::BRIND, DL, MVT::Other, JTInfo, SDValue(Dest, 0)); } +SDValue AArch64TargetLowering::LowerBRIND(SDValue Op, SelectionDAG &DAG) const { + MachineFunction &MF = DAG.getMachineFunction(); + std::optional BADisc = + Subtarget->getPtrAuthBlockAddressDiscriminator(MF.getFunction()); + if (!BADisc) +return SDValue(); + + SDLoc DL(Op); + SDValue Chain = Op.getOperand(0); + SDValue Dest = Op.getOperand(1); + + SDValue Disc = DAG.getTargetConstant(*BADisc, DL, MVT::i64); + SDValue Key = DAG.getTargetConstant(AArch64PACKey::IA, DL, MVT::i32); + SDValue AddrDisc = DAG.getRegister(AArch64::XZR, MVT::i64); + + SDNode *BrA = DAG.getMachineNode(AArch64::BRA, DL, MVT::Other, asl wrote: This is a problematic piece of code. If jump table hardening is not enabled, then jump tables will be codegenerated using `BRIND` (see the code few lines above – directly at the end of `LowerBR_JT`) and the code here does not distinguish between indirect branches that has "register" destination and indirect branches as a result of jump table lowering... The code above might check if `Dest` is `AArch64::JumpTableDest32` and do nothing in such case. https://github.com/llvm/llvm-project/pull/97647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PAC][Driver] Support `pauthtest` ABI for AArch64 Linux triples (PR #97237)
asl wrote: Thanks @smithp35 I opened https://github.com/llvm/llvm-project/issues/99950 to track this https://github.com/llvm/llvm-project/pull/97237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Implement authentication for C++ member function pointers (PR #99576)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/99576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
@@ -10685,6 +10689,26 @@ SDValue AArch64TargetLowering::LowerBR_JT(SDValue Op, return DAG.getNode(ISD::BRIND, DL, MVT::Other, JTInfo, SDValue(Dest, 0)); } +SDValue AArch64TargetLowering::LowerBRIND(SDValue Op, SelectionDAG &DAG) const { + MachineFunction &MF = DAG.getMachineFunction(); + std::optional BADisc = + Subtarget->getPtrAuthBlockAddressDiscriminator(MF.getFunction()); + if (!BADisc) +return SDValue(); + + SDLoc DL(Op); + SDValue Chain = Op.getOperand(0); + SDValue Dest = Op.getOperand(1); + + SDValue Disc = DAG.getTargetConstant(*BADisc, DL, MVT::i64); + SDValue Key = DAG.getTargetConstant(AArch64PACKey::IA, DL, MVT::i32); + SDValue AddrDisc = DAG.getRegister(AArch64::XZR, MVT::i64); + + SDNode *BrA = DAG.getMachineNode(AArch64::BRA, DL, MVT::Other, asl wrote: yeah, having `BR_JT` nodes is certainly more correct way, but seems to be more invasive. Worth a `TODO` added, yes. https://github.com/llvm/llvm-project/pull/97647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/97647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/100204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/100204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC][clang][test] Implement missing tests for some PAuth features (PR #100206)
asl wrote: Tagging @ojhunt https://github.com/llvm/llvm-project/pull/100206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add function type discrimination tests to static destructor tests (PR #99604)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/99604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add function type discrimination tests to static destructor tests (PR #99604)
https://github.com/asl closed https://github.com/llvm/llvm-project/pull/99604 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)
https://github.com/asl closed https://github.com/llvm/llvm-project/pull/100204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)
asl wrote: /cherry-pick 666e3326fedfb6a033494c36c36aa95c4124d642 https://github.com/llvm/llvm-project/pull/100204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)
https://github.com/asl demilestoned https://github.com/llvm/llvm-project/pull/100204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/100204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC][clang][test] Implement missing tests for some PAuth features (PR #100206)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/100206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC][clang] Enable `-fptrauth-indirect-gotos` as part of pauthtest ABI (PR #100480)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/100480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC][clang] Enable `-fptrauth-indirect-gotos` as part of pauthtest ABI (PR #100480)
asl wrote: /cherry-pick 3f6eb13abf643afec17a73448ede380606531226 https://github.com/llvm/llvm-project/pull/100480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC][clang] Enable `-fptrauth-indirect-gotos` as part of pauthtest ABI (PR #100480)
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/100480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC][clang] Enhance preprocessor ptrauth tests (PR #98862)
https://github.com/asl approved this pull request. Thanks https://github.com/llvm/llvm-project/pull/98862 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PAC][Driver] Support `pauthtest` ABI for AArch64 Linux triples (PR #97237)
@@ -324,6 +324,9 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple, case llvm::Triple::GNU: setABI("apcs-gnu"); break; +case llvm::Triple::PAuthTest: asl wrote: Do we really need to touch 32-bit ARM? https://github.com/llvm/llvm-project/pull/97237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Ensure pointers passed to runtime support functions are correctly signed (PR #98276)
@@ -333,7 +338,8 @@ void CodeGenFunction::registerGlobalDtorWithLLVM(const VarDecl &VD, llvm::FunctionCallee Dtor, llvm::Constant *Addr) { // Create a function which calls the destructor. - llvm::Function *dtorStub = createAtExitStub(VD, Dtor, Addr); + llvm::Function *dtorStub = asl wrote: I think it's ok as it is for now. When / if we will really need better abstraction in multiple places we can go via `MaybeSigned` or something like this. https://github.com/llvm/llvm-project/pull/98276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Ensure pointers passed to runtime support functions are correctly signed (PR #98276)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/98276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Ensure pointers passed to runtime support functions are correctly signed (PR #98276)
asl wrote: > I notice the r+, but I haven't fully addressed this feedback - are you > suggesting corrections in a follow up patch, or just conceptually approving > with this PR? :D I think this patch is fine to go as-is. We can re-consider that `MaybeSigned` abstraction further on if it could appear in multiple places. https://github.com/llvm/llvm-project/pull/98276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Implement function pointer signing and authenticated function calls (PR #93906)
@@ -14,10 +14,144 @@ #ifndef LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H #define LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H +#include "clang/Basic/LLVM.h" +#include "clang/Basic/LangOptions.h" +#include "llvm/ADT/STLForwardCompat.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Target/TargetOptions.h" +#include + namespace clang { constexpr unsigned PointerAuthKeyNone = -1; +class PointerAuthSchema { +public: + enum class Kind : unsigned { +None, +ARM8_3, + }; + + /// Hardware pointer-signing keys in ARM8.3. + /// + /// These values are the same used in ptrauth.h. + enum class ARM8_3Key : unsigned { +ASIA = 0, +ASIB = 1, +ASDA = 2, +ASDB = 3 + }; + + /// Forms of extra discrimination. + enum class Discrimination : unsigned { +/// No additional discrimination. +None, + +/// Discriminate using a constant value. +Constant, + }; + +private: + Kind TheKind : 2; + unsigned IsAddressDiscriminated : 1; + unsigned IsIsaPointer : 1; + unsigned AuthenticatesNullValues : 1; + PointerAuthenticationMode SelectedAuthenticationMode : 2; + Discrimination DiscriminationKind : 2; + unsigned Key : 2; + unsigned ConstantDiscriminator : 16; + +public: + PointerAuthSchema() : TheKind(Kind::None) {} + + PointerAuthSchema( + ARM8_3Key Key, bool IsAddressDiscriminated, + PointerAuthenticationMode AuthenticationMode, + Discrimination OtherDiscrimination, + std::optional ConstantDiscriminatorOrNone = std::nullopt, + bool IsIsaPointer = false, bool AuthenticatesNullValues = false) + : TheKind(Kind::ARM8_3), IsAddressDiscriminated(IsAddressDiscriminated), +IsIsaPointer(IsIsaPointer), +AuthenticatesNullValues(AuthenticatesNullValues), +SelectedAuthenticationMode(AuthenticationMode), +DiscriminationKind(OtherDiscrimination), Key(llvm::to_underlying(Key)) { +assert((getOtherDiscrimination() != Discrimination::Constant || +ConstantDiscriminatorOrNone) && + "constant discrimination requires a constant!"); +if (ConstantDiscriminatorOrNone) + ConstantDiscriminator = *ConstantDiscriminatorOrNone; asl wrote: @mikerice1969 The logic is a bit convoluted here. But essentially this field is only initialized when `getOtherDiscrimination() == Discrimination::Constant`. And there is assert above for that and below in `getConstantDiscrimination()`. But probably it would be better to initialize it regardless. https://github.com/llvm/llvm-project/pull/93906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [test][PAC][clang] Add missing tests against linux triples (PR #99482)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/99482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Fix a crash when signing a pointer to a function with an incomplete enum parameter (PR #99595)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/99595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Authenticate function pointers in UBSan type checks (PR #99590)
https://github.com/asl approved this pull request. https://github.com/llvm/llvm-project/pull/99590 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC] Authenticate function pointers in UBSan type checks (PR #99590)
@@ -13,6 +15,8 @@ void fun() {} // ARM: ptrtoint ptr {{.*}} to i32, !nosanitize !5 // ARM: and i32 {{.*}}, -2, !nosanitize !5 // ARM: inttoptr i32 {{.*}} to ptr, !nosanitize !5 +// 64e: %[[STRIPPED:.*]] = ptrtoint ptr {{.*}} to i64, !nosanitize +// 64e: call i64 @llvm.ptrauth.auth(i64 %[[STRIPPED]], i32 0, i64 0), !nosanitize asl wrote: Sadly we are not checking full sequence here :( But this is not a problem of this patch, it is just underlying test done this way https://github.com/llvm/llvm-project/pull/99590 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
asl wrote: > Please make sure you have a testcase for computing the difference between two > blockaddresses (`void g(int*); int f() { static int x = &&A-&&B; > A:g(&x);B:return x; }`). Not sure how you should handle that case. Will you please clarify what is the problem here? `&&A-&&B` will be resolved by a linker (either static or dynamic), so there will be no way to substitute one of addresses in this expression. If this is materialized separately, as in: ``` void* tmp = &&A; tmp -= &&B; static int x = tmp; ``` in some constructor routine, then both `&&A` an `&&B` would be separately authenticated. https://github.com/llvm/llvm-project/pull/97647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
asl wrote: > Under the proposed ABI, `&&A-&&B` is actually "sign(A)-sign(B)". Which is a > constant, but not one which can be represented as a relocation (as far as I > know). Right. The difference should be not be signed IMO as stated above. https://github.com/llvm/llvm-project/pull/97647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Ensure pointers passed to runtime support functions are correctly signed (PR #98276)
@@ -333,7 +338,8 @@ void CodeGenFunction::registerGlobalDtorWithLLVM(const VarDecl &VD, llvm::FunctionCallee Dtor, llvm::Constant *Addr) { // Create a function which calls the destructor. - llvm::Function *dtorStub = createAtExitStub(VD, Dtor, Addr); + llvm::Function *dtorStub = asl wrote: So, `createAtExitStub` might return ptrauth constant expression. And the `cast` here does not fail simply because we do not sign these pointers (yet)? https://github.com/llvm/llvm-project/pull/98276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [clang] Define ptrauth_string_discriminator builtin. (PR #93903)
asl wrote: @ahmedbougacha Will you please rebase https://github.com/llvm/llvm-project/pull/93903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Add arm64e ABI-defined key assignments to ptrauth.h. (PR #93901)
@@ -15,6 +15,29 @@ typedef enum { ptrauth_key_asib = 1, ptrauth_key_asda = 2, ptrauth_key_asdb = 3, + +#ifdef __APPLE__ asl wrote: I believe these are defaults for ELF as well. So, I'd remove ifdef and decide on necessary gating when there will be a precedent. https://github.com/llvm/llvm-project/pull/93901 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [Support] Add SipHash-based 16/64-bit ptrauth stable hash. (PR #93902)
asl wrote: @kbeyls Will you please summarize briefly what we discussed on the sync call from the license standpoint? https://github.com/llvm/llvm-project/pull/93902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Enable LLDB tests in pre-merge CI (PR #94208)
asl wrote: Tagging @slydiman @vvereschaka https://github.com/llvm/llvm-project/pull/94208 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Serialization] Use specialized decl hash function for GlobalDeclID (PR #95730)
@@ -230,7 +230,11 @@ template <> struct DenseMapInfo { } static unsigned getHashValue(const GlobalDeclID &Key) { -return DenseMapInfo::getHashValue(Key.get()); +// Our default hash algorithm for 64 bits integer may not be very good. +// In GlobalDeclID's case, it is pretty common that the lower 32 bits can +// be same. +return DenseMapInfo::getHashValue(Key.getModuleFileIndex()) ^ asl wrote: Can you use `hash_combine` from `llvm/ADT/Hash.h`? https://github.com/llvm/llvm-project/pull/95730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Define ptrauth_string_discriminator builtin. (PR #93903)
https://github.com/asl approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/93903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [PAC][clang][Driver] Add signed GOT flag (PR #96160)
asl wrote: > Do we want a lot of `-fptrauth-xxx` instead of > `-fptrauth-something=xxx,yyy,zzz`? I would lean towards a single flag. However, I do not know how this would affect Apple downstream and what are preferences there. Tagging @ahmedbougacha @ahatanak @ojhunt https://github.com/llvm/llvm-project/pull/96160 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)
asl wrote: Can we have LLVM IR test as well? https://github.com/llvm/llvm-project/pull/96478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin basic support (PR #76943)
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng Message-ID: In-Reply-To: https://github.com/asl requested changes to this pull request. This lacks tests and some references how TLS is implemented on Cygwin https://github.com/llvm/llvm-project/pull/76943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)
@@ -46,64 +46,64 @@ class Triple { enum ArchType { UnknownArch, -arm,// ARM (little endian): arm, armv.*, xscale asl wrote: Please do not do such large code reformatting. It makes impossible to review them https://github.com/llvm/llvm-project/pull/77216 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)
@@ -108,13 +108,9 @@ else() linux/HostInfoLinux.cpp linux/LibcGlue.cpp linux/Support.cpp + android/HostInfoAndroid.cpp + android/LibcGlue.cpp ) -if (CMAKE_SYSTEM_NAME MATCHES "Android") asl wrote: What is wrong with android detection? I doubt this is a proper solution https://github.com/llvm/llvm-project/pull/77216 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)
@@ -46,64 +46,64 @@ class Triple { enum ArchType { UnknownArch, -arm,// ARM (little endian): arm, armv.*, xscale asl wrote: You can ignore these. https://github.com/llvm/llvm-project/pull/77216 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits