r339979 - [hexagon] restore -fuse-cxa-atexit by default
Author: bcain Date: Thu Aug 16 20:53:51 2018 New Revision: 339979 URL: http://llvm.org/viewvc/llvm-project?rev=339979&view=rev Log: [hexagon] restore -fuse-cxa-atexit by default "-fno-use-cxa-atexit" was a default provided by the initial commit offering hexagon support. This is no longer required. Reviewers: bcahoon, sidneym Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50816 Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/cxa-atexit.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=339979&r1=339978&r2=339979&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Aug 16 20:53:51 2018 @@ -4225,7 +4225,6 @@ void Clang::ConstructJob(Compilation &C, options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, !RawTriple.isOSWindows() && RawTriple.getOS() != llvm::Triple::Solaris && - getToolChain().getArch() != llvm::Triple::hexagon && getToolChain().getArch() != llvm::Triple::xcore && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || Modified: cfe/trunk/test/Driver/cxa-atexit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cxa-atexit.cpp?rev=339979&r1=339978&r2=339979&view=diff == --- cfe/trunk/test/Driver/cxa-atexit.cpp (original) +++ cfe/trunk/test/Driver/cxa-atexit.cpp Thu Aug 16 20:53:51 2018 @@ -20,7 +20,7 @@ // CHECK-WINDOWS: "-fno-use-cxa-atexit" // CHECK-SOLARIS: "-fno-use-cxa-atexit" -// CHECK-HEXAGON: "-fno-use-cxa-atexit" +// CHECK-HEXAGON-NOT: "-fno-use-cxa-atexit" // CHECK-XCORE: "-fno-use-cxa-atexit" // CHECK-MTI: "-fno-use-cxa-atexit" // CHECK-MIPS-NOT: "-fno-use-cxa-atexit" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r312774 - XFAIL tests on SLES11
Author: bcain Date: Thu Sep 7 20:57:02 2017 New Revision: 312774 URL: http://llvm.org/viewvc/llvm-project?rev=312774&view=rev Log: XFAIL tests on SLES11 XFAIL some failing tests for SLES11 (older glibc), also replace spaces in linux distro w/dashes. Modified: libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp libcxx/trunk/utils/libcxx/test/target_info.py Modified: libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp?rev=312774&r1=312773&r2=312774&view=diff == --- libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp (original) +++ libcxx/trunk/test/std/depr/depr.c.headers/uchar_h.pass.cpp Thu Sep 7 20:57:02 2017 @@ -7,6 +7,7 @@ // //===--===// // +// XFAIL: suse-linux-enterprise-server-11 // XFAIL: apple-darwin // XFAIL: newlib Modified: libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp?rev=312774&r1=312773&r2=312774&view=diff == --- libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp (original) +++ libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp Thu Sep 7 20:57:02 2017 @@ -7,6 +7,7 @@ // //===--===// +// XFAIL: suse-linux-enterprise-server-11 // XFAIL: with_system_cxx_lib=macosx10.12 // XFAIL: with_system_cxx_lib=macosx10.11 // XFAIL: with_system_cxx_lib=macosx10.10 Modified: libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp?rev=312774&r1=312773&r2=312774&view=diff == --- libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp (original) +++ libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp Thu Sep 7 20:57:02 2017 @@ -13,6 +13,7 @@ // const error_category& system_category(); +// XFAIL: suse-linux-enterprise-server-11 // XFAIL: with_system_cxx_lib=macosx10.12 // XFAIL: with_system_cxx_lib=macosx10.11 // XFAIL: with_system_cxx_lib=macosx10.10 Modified: libcxx/trunk/utils/libcxx/test/target_info.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/target_info.py?rev=312774&r1=312773&r2=312774&view=diff == --- libcxx/trunk/utils/libcxx/test/target_info.py (original) +++ libcxx/trunk/utils/libcxx/test/target_info.py Thu Sep 7 20:57:02 2017 @@ -190,12 +190,14 @@ class LinuxLocalTI(DefaultTargetInfo): def platform_name(self): name, _, _ = platform.linux_distribution() -name = name.lower().strip() +# Some distros have spaces, e.g. 'SUSE Linux Enterprise Server' +# lit features can't have spaces +name = name.lower().strip().replace(' ', '-') return name # Permitted to be None def platform_ver(self): _, ver, _ = platform.linux_distribution() -ver = ver.lower().strip() +ver = ver.lower().strip().replace(' ', '-') return ver # Permitted to be None. def add_locale_features(self, features): ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r368327 - [llvm-mc] Add reportWarning() to MCContext
Author: bcain Date: Thu Aug 8 12:13:23 2019 New Revision: 368327 URL: http://llvm.org/viewvc/llvm-project?rev=368327&view=rev Log: [llvm-mc] Add reportWarning() to MCContext Adding reportWarning() to MCContext, so that it can be used from the Hexagon assembler backend. Modified: cfe/trunk/tools/driver/cc1as_main.cpp Modified: cfe/trunk/tools/driver/cc1as_main.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=368327&r1=368326&r2=368327&view=diff == --- cfe/trunk/tools/driver/cc1as_main.cpp (original) +++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Aug 8 12:13:23 2019 @@ -374,7 +374,8 @@ static bool ExecuteAssembler(AssemblerIn // MCObjectFileInfo needs a MCContext reference in order to initialize itself. std::unique_ptr MOFI(new MCObjectFileInfo()); - MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr); + MCTargetOptions MCOptions; + MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr, &MCOptions); bool PIC = false; if (Opts.RelocationModel == "static") { @@ -431,7 +432,6 @@ static bool ExecuteAssembler(AssemblerIn raw_pwrite_stream *Out = FDOS.get(); std::unique_ptr BOS; - MCTargetOptions MCOptions; MCOptions.ABIName = Opts.TargetABI; // FIXME: There is a bit of code duplication with addPassesToEmitFile. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r368328 - [clang] Add no-warn support for Wa
Author: bcain Date: Thu Aug 8 12:19:20 2019 New Revision: 368328 URL: http://llvm.org/viewvc/llvm-project?rev=368328&view=rev Log: [clang] Add no-warn support for Wa Added: cfe/trunk/test/Driver/as-no-warnings.c Modified: cfe/trunk/include/clang/Basic/CodeGenOptions.def cfe/trunk/include/clang/Driver/CC1Options.td cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/tools/driver/cc1as_main.cpp Modified: cfe/trunk/include/clang/Basic/CodeGenOptions.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CodeGenOptions.def?rev=368328&r1=368327&r2=368328&view=diff == --- cfe/trunk/include/clang/Basic/CodeGenOptions.def (original) +++ cfe/trunk/include/clang/Basic/CodeGenOptions.def Thu Aug 8 12:19:20 2019 @@ -133,6 +133,7 @@ CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) / CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled. CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is ///< enabled. +CODEGENOPT(NoWarn, 1, 0) ///< Set when -Wa,--no-warn is enabled. CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled. CODEGENOPT(NoImplicitFloat , 1, 0) ///< Set when -mno-implicit-float is enabled. CODEGENOPT(NoInfsFPMath , 1, 0) ///< Assume FP arguments, results not +-Inf. Modified: cfe/trunk/include/clang/Driver/CC1Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=368328&r1=368327&r2=368328&view=diff == --- cfe/trunk/include/clang/Driver/CC1Options.td (original) +++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Aug 8 12:19:20 2019 @@ -200,6 +200,8 @@ def compress_debug_sections_EQ : Joined< HelpText<"DWARF debug sections compression type">; def mno_exec_stack : Flag<["-"], "mnoexecstack">, HelpText<"Mark the file as not needing an executable stack">; +def massembler_no_warn : Flag<["-"], "massembler-no-warn">, + HelpText<"Make assembler not emit warnings">; def massembler_fatal_warnings : Flag<["-"], "massembler-fatal-warnings">, HelpText<"Make assembler warnings fatal">; def mrelax_relocations : Flag<["--"], "mrelax-relocations">, Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=368328&r1=368327&r2=368328&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Aug 8 12:19:20 2019 @@ -493,6 +493,7 @@ static void initTargetOptions(llvm::Targ CodeGenOpts.IncrementalLinkerCompatible; Options.MCOptions.MCPIECopyRelocations = CodeGenOpts.PIECopyRelocations; Options.MCOptions.MCFatalWarnings = CodeGenOpts.FatalWarnings; + Options.MCOptions.MCNoWarn = CodeGenOpts.NoWarn; Options.MCOptions.AsmVerbose = CodeGenOpts.AsmVerbose; Options.MCOptions.PreserveAsmComments = CodeGenOpts.PreserveAsmComments; Options.MCOptions.ABIName = TargetOpts.ABI; Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=368328&r1=368327&r2=368328&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Aug 8 12:19:20 2019 @@ -2169,6 +2169,8 @@ static void CollectArgsForIntegratedAsse CmdArgs.push_back("-msave-temp-labels"); } else if (Value == "--fatal-warnings") { CmdArgs.push_back("-massembler-fatal-warnings"); + } else if (Value == "--no-warn") { +CmdArgs.push_back("-massembler-no-warn"); } else if (Value == "--noexecstack") { UseNoExecStack = true; } else if (Value.startswith("-compress-debug-sections") || Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=368328&r1=368327&r2=368328&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Aug 8 12:19:20 2019 @@ -888,6 +888,7 @@ static bool ParseCodeGenArgs(CodeGenOpti Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags); Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack); Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings); + Opts.NoWarn = Args.hasArg(OPT_massembler_no_warn); Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks); Opts.RelaxAll = Args.hasArg(OPT_mrelax_all); Opts.IncrementalLin
r368332 - [clang] add REQUIRES to driver test case
Author: bcain Date: Thu Aug 8 13:04:39 2019 New Revision: 368332 URL: http://llvm.org/viewvc/llvm-project?rev=368332&view=rev Log: [clang] add REQUIRES to driver test case The test case explicitly leverages x86, so should include it as a test requirement. Modified: cfe/trunk/test/Driver/as-no-warnings.c Modified: cfe/trunk/test/Driver/as-no-warnings.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-no-warnings.c?rev=368332&r1=368331&r2=368332&view=diff == --- cfe/trunk/test/Driver/as-no-warnings.c (original) +++ cfe/trunk/test/Driver/as-no-warnings.c Thu Aug 8 13:04:39 2019 @@ -5,6 +5,9 @@ // RUN: not %clang %s -c -o %t.o -target i686-pc-linux-gnu -integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s // RUN: not %clang %s -c -o %t.o -target i686-pc-linux-gnu -fno-integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target + // CHECK: "-cc1" {{.*}} "-massembler-no-warn" // CHECK-NOIAS: "--no-warn" // CHECK-AS-NOWARN-NOT: warning: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r368334 - [clang] add REQUIRES: linux to driver test case
Author: bcain Date: Thu Aug 8 13:12:54 2019 New Revision: 368334 URL: http://llvm.org/viewvc/llvm-project?rev=368334&view=rev Log: [clang] add REQUIRES: linux to driver test case The test case explicitly leverages linux, so should include it as a test requirement. Modified: cfe/trunk/test/Driver/as-no-warnings.c Modified: cfe/trunk/test/Driver/as-no-warnings.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-no-warnings.c?rev=368334&r1=368333&r2=368334&view=diff == --- cfe/trunk/test/Driver/as-no-warnings.c (original) +++ cfe/trunk/test/Driver/as-no-warnings.c Thu Aug 8 13:12:54 2019 @@ -7,6 +7,7 @@ // REQUIRES: clang-driver // REQUIRES: x86-registered-target +// REQUIRES: linux // CHECK: "-cc1" {{.*}} "-massembler-no-warn" // CHECK-NOIAS: "--no-warn" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] 9107594 - [libunwind] add hexagon support
Author: Brian Cain Date: 2020-04-10T04:24:10-05:00 New Revision: 9107594f376e37e99c71881404c686b306f93ad2 URL: https://github.com/llvm/llvm-project/commit/9107594f376e37e99c71881404c686b306f93ad2 DIFF: https://github.com/llvm/llvm-project/commit/9107594f376e37e99c71881404c686b306f93ad2.diff LOG: [libunwind] add hexagon support Added: Modified: libunwind/include/__libunwind_config.h libunwind/include/libunwind.h libunwind/src/Registers.hpp libunwind/src/UnwindCursor.hpp libunwind/src/UnwindRegistersRestore.S libunwind/src/UnwindRegistersSave.S libunwind/src/assembly.h libunwind/src/config.h libunwind/src/libunwind.cpp Removed: diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 4d03bd83d8c6..71d77ca65118 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -23,6 +23,7 @@ #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K 32 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS 65 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC 31 +#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_HEXAGON 34 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV 64 #if defined(_LIBUNWIND_IS_NATIVE_ONLY) @@ -82,6 +83,12 @@ # define _LIBUNWIND_CONTEXT_SIZE 16 # define _LIBUNWIND_CURSOR_SIZE 24 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K +# elif defined(__hexagon__) +# define _LIBUNWIND_TARGET_HEXAGON 1 +// Values here change when : Registers.hpp - hexagon_thread_state_t change +# define _LIBUNWIND_CONTEXT_SIZE 18 +# define _LIBUNWIND_CURSOR_SIZE 24 +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_HEXAGON # elif defined(__mips__) # if defined(_ABIO32) && _MIPS_SIM == _ABIO32 #define _LIBUNWIND_TARGET_MIPS_O32 1 @@ -142,6 +149,7 @@ # define _LIBUNWIND_TARGET_MIPS_O32 1 # define _LIBUNWIND_TARGET_MIPS_NEWABI 1 # define _LIBUNWIND_TARGET_SPARC 1 +# define _LIBUNWIND_TARGET_HEXAGON 1 # define _LIBUNWIND_TARGET_RISCV 1 # define _LIBUNWIND_CONTEXT_SIZE 167 # define _LIBUNWIND_CURSOR_SIZE 179 diff --git a/libunwind/include/libunwind.h b/libunwind/include/libunwind.h index 1a501b867dda..23ef47f4ac83 100644 --- a/libunwind/include/libunwind.h +++ b/libunwind/include/libunwind.h @@ -832,6 +832,44 @@ enum { UNW_SPARC_I7 = 31, }; +// Hexagon register numbers +enum { + UNW_HEXAGON_R0, + UNW_HEXAGON_R1, + UNW_HEXAGON_R2, + UNW_HEXAGON_R3, + UNW_HEXAGON_R4, + UNW_HEXAGON_R5, + UNW_HEXAGON_R6, + UNW_HEXAGON_R7, + UNW_HEXAGON_R8, + UNW_HEXAGON_R9, + UNW_HEXAGON_R10, + UNW_HEXAGON_R11, + UNW_HEXAGON_R12, + UNW_HEXAGON_R13, + UNW_HEXAGON_R14, + UNW_HEXAGON_R15, + UNW_HEXAGON_R16, + UNW_HEXAGON_R17, + UNW_HEXAGON_R18, + UNW_HEXAGON_R19, + UNW_HEXAGON_R20, + UNW_HEXAGON_R21, + UNW_HEXAGON_R22, + UNW_HEXAGON_R23, + UNW_HEXAGON_R24, + UNW_HEXAGON_R25, + UNW_HEXAGON_R26, + UNW_HEXAGON_R27, + UNW_HEXAGON_R28, + UNW_HEXAGON_R29, + UNW_HEXAGON_R30, + UNW_HEXAGON_R31, + UNW_HEXAGON_P3_0, + UNW_HEXAGON_PC, +}; + // RISC-V registers. These match the DWARF register numbers defined by section // 4 of the RISC-V ELF psABI specification, which can be found at: // diff --git a/libunwind/src/Registers.hpp b/libunwind/src/Registers.hpp index ffc75eee6bf8..26a0fa8f338e 100644 --- a/libunwind/src/Registers.hpp +++ b/libunwind/src/Registers.hpp @@ -34,6 +34,7 @@ enum { REGISTERS_MIPS_O32, REGISTERS_MIPS_NEWABI, REGISTERS_SPARC, + REGISTERS_HEXAGON, REGISTERS_RISCV, }; @@ -3528,6 +3529,187 @@ inline const char *Registers_sparc::getRegisterName(int regNum) { } #endif // _LIBUNWIND_TARGET_SPARC +#if defined(_LIBUNWIND_TARGET_HEXAGON) +/// Registers_hexagon holds the register state of a thread in a Hexagon QDSP6 +/// process. +class _LIBUNWIND_HIDDEN Registers_hexagon { +public: + Registers_hexagon(); + Registers_hexagon(const void *registers); + + boolvalidRegister(int num) const; + uint32_tgetRegister(int num) const; + voidsetRegister(int num, uint32_t value); + boolvalidFloatRegister(int num) const; + double getFloatRegister(int num) const; + voidsetFloatRegister(int num, double value); + boolvalidVectorRegister(int num) const; + v128getVectorRegister(int num) const; + voidsetVectorRegister(int num, v128 value); + const char *getRegisterName(int num); + voidjumpto(); + static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_HEXAGON; } + static int getArch() { return REGISTERS_HEXAGON; } + + uint32_t getSP() const { return _registers.__r[UNW_HEXAGON_R29]; } + void setSP(uint32_t value) { _registers.__r[UNW_HEXAGON_R29] = value; } + uint32_t getIP() const { return _registers.__r[UNW_HEXAGON_PC]; } + void setIP(uint32_t value) { _registers.__r[
[clang] [llvm] [Hexagon] ELF attributes for Hexagon (PR #85359)
https://github.com/androm3da closed https://github.com/llvm/llvm-project/pull/85359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [llvm-dev] Phabricator Creator Pulling the Plug
How far are we from a workflow that leverages Github's Pull Requests? Is there some consensus that it's a desired end goal, but some features are missing? Or do we prefer to use a workflow like this for the long term? On Thu, Sep 30, 2021, 4:54 PM Chris Tetreault via llvm-dev < llvm-...@lists.llvm.org> wrote: > As I, and others have noticed, it seems that as of today, there’s some > certificate issue with arcanist. (See: > https://lists.llvm.org/pipermail/llvm-dev/2021-September/153019.html) The > fix seems simple, and a PR is up, but looking through the PR activity, it > seems that the PR will not be accepted because Phabricator is no longer > being maintained. It seems that arc has become the first casualty of the > discontinuation of maintenance of phabricator. > > > > I know that arc is not universally used, but I think it’s a serious blow > to many people’s workflows. I think that MyDeveloperDay’s question might > have just become a bit more urgent. > > > > I suppose in the short-term, we could fork the phabricator repos in order > to fix little issues like this. Alternately, we should probably stop > recommending arcanist (unless we want to provide instructions on how to fix > any breakages that come along). > > > > Thanks, > >Chris Tetreault > > > > *From:* llvm-dev *On Behalf Of *MyDeveloper > Day via llvm-dev > *Sent:* Wednesday, August 18, 2021 10:17 AM > *To:* llvm-dev ; cfe-commits < > cfe-commits@lists.llvm.org> > *Subject:* [llvm-dev] Phabricator Creator Pulling the Plug > > > > *WARNING:* This email originated from outside of Qualcomm. Please be wary > of any links or attachments, and do not enable macros. > > All > > > > I'm a massive fan of Phabricator, and I know there is often lots of > contentious discussion about its relative merits vs github, > > > > But unless I missed this, was there any discussion regarding the recent > "Winding Down" announcement of Phabricator? and what it might mean for us > in LLVM > > > > See: > > > https://admin.phacility.com/phame/post/view/11/phacility_is_winding_down_operations/ > > https://www.phacility.com/phabricator/ > > > > Personally I'm excited by the concept of a community driven replacement ( > https://we.phorge.it/) . > > epriestley did a truly amazing job, it wasn't open to public > contributions. Perhaps more open development could lead to closing some of > the github gaps that were of concern. > > > > MyDeveloperDay > ___ > LLVM Developers mailing list > llvm-...@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [llvm-dev] Phabricator Creator Pulling the Plug
Does something like Rust's "bors" bot satisfy the herald rules need? re: #2 I have done this on GHE and it's mildly awkward but it does work. And yes normalizing force pushes is the unfortunate state of GitHub PRs. Comments are preserved. Code-anchored comments like review comments are marked as referring to out-of-date code, IIRC. On Thu, Sep 30, 2021, 5:56 PM Mehdi AMINI wrote: > We talked about this with the IWG (Infrastructure Working Group) just > last week coincidentally. > Two major blocking tracks that were identified at the roundtable > during the LLVM Dev Meeting exactly 2 years ago are still an issue > today: > > 1) Replacement for Herald rules. This is what allows us to subscribe > and track new revisions or commits based on paths in the repo or other > criteria. We could build a replacement based on GitHub action or any > other kind of service, but this is a bit tricky (how do you store > emails privately? etc.). I have looked around online but I didn't find > another OSS project (or external company) providing a similar service > for GitHub unfortunately, does anyone know of any? > > 2) Support for stacked commits. I can see how to structure this > somehow assuming we would push pull-request branches in the main repo > (with one new commit per branch and cascading the pull-requests from > one branch to the other), otherwise this will be a major regression > compared to the current workflow. > > What remains unknown to me is the current state of GitHub management > of comments across `git commit --amend` and force push to update a > branch. > > Others may have other items to add! > > -- > Mehdi > > On Thu, Sep 30, 2021 at 3:39 PM Brian Cain via llvm-dev > wrote: > > > > How far are we from a workflow that leverages Github's Pull Requests? > Is there some consensus that it's a desired end goal, but some features are > missing? Or do we prefer to use a workflow like this for the long term? > > > > On Thu, Sep 30, 2021, 4:54 PM Chris Tetreault via llvm-dev < > llvm-...@lists.llvm.org> wrote: > >> > >> As I, and others have noticed, it seems that as of today, there’s some > certificate issue with arcanist. (See: > https://lists.llvm.org/pipermail/llvm-dev/2021-September/153019.html) The > fix seems simple, and a PR is up, but looking through the PR activity, it > seems that the PR will not be accepted because Phabricator is no longer > being maintained. It seems that arc has become the first casualty of the > discontinuation of maintenance of phabricator. > >> > >> > >> > >> I know that arc is not universally used, but I think it’s a serious > blow to many people’s workflows. I think that MyDeveloperDay’s question > might have just become a bit more urgent. > >> > >> > >> > >> I suppose in the short-term, we could fork the phabricator repos in > order to fix little issues like this. Alternately, we should probably stop > recommending arcanist (unless we want to provide instructions on how to fix > any breakages that come along). > >> > >> > >> > >> Thanks, > >> > >>Chris Tetreault > >> > >> > >> > >> From: llvm-dev On Behalf Of > MyDeveloper Day via llvm-dev > >> Sent: Wednesday, August 18, 2021 10:17 AM > >> To: llvm-dev ; cfe-commits < > cfe-commits@lists.llvm.org> > >> Subject: [llvm-dev] Phabricator Creator Pulling the Plug > >> > >> > >> > >> WARNING: This email originated from outside of Qualcomm. Please be wary > of any links or attachments, and do not enable macros. > >> > >> All > >> > >> > >> > >> I'm a massive fan of Phabricator, and I know there is often lots of > contentious discussion about its relative merits vs github, > >> > >> > >> > >> But unless I missed this, was there any discussion regarding the recent > "Winding Down" announcement of Phabricator? and what it might mean for us > in LLVM > >> > >> > >> > >> See: > >> > >> > https://admin.phacility.com/phame/post/view/11/phacility_is_winding_down_operations/ > >> > >> https://www.phacility.com/phabricator/ > >> > >> > >> > >> Personally I'm excited by the concept of a community driven replacement > ( https://we.phorge.it/) . > >> > >> epriestley did a truly amazing job, it wasn't open to public > contributions. Perhaps more open development could lead to closing some of > the github gaps that were of concern. > >> > >> > >> > >> MyDeveloperDay > >> > >> ___ > >> LLVM Developers mailing list > >> llvm-...@lists.llvm.org > >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > > ___ > > LLVM Developers mailing list > > llvm-...@lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [llvm-dev] Phabricator Creator Pulling the Plug
On Thu, Sep 30, 2021, 6:04 PM Brian Cain wrote: > Does something like Rust's "bors" bot satisfy the herald rules need? > sorry, maybe I was thinking of the high-five bot. And it looks like that's not quite a match for herald. > re: #2 I have done this on GHE and it's mildly awkward but it does work. > > And yes normalizing force pushes is the unfortunate state of GitHub PRs. > Comments are preserved. Code-anchored comments like review comments are > marked as referring to out-of-date code, IIRC. > > On Thu, Sep 30, 2021, 5:56 PM Mehdi AMINI wrote: > >> We talked about this with the IWG (Infrastructure Working Group) just >> last week coincidentally. >> Two major blocking tracks that were identified at the roundtable >> during the LLVM Dev Meeting exactly 2 years ago are still an issue >> today: >> >> 1) Replacement for Herald rules. This is what allows us to subscribe >> and track new revisions or commits based on paths in the repo or other >> criteria. We could build a replacement based on GitHub action or any >> other kind of service, but this is a bit tricky (how do you store >> emails privately? etc.). I have looked around online but I didn't find >> another OSS project (or external company) providing a similar service >> for GitHub unfortunately, does anyone know of any? >> >> 2) Support for stacked commits. I can see how to structure this >> somehow assuming we would push pull-request branches in the main repo >> (with one new commit per branch and cascading the pull-requests from >> one branch to the other), otherwise this will be a major regression >> compared to the current workflow. >> >> What remains unknown to me is the current state of GitHub management >> of comments across `git commit --amend` and force push to update a >> branch. >> >> Others may have other items to add! >> >> -- >> Mehdi >> >> On Thu, Sep 30, 2021 at 3:39 PM Brian Cain via llvm-dev >> wrote: >> > >> > How far are we from a workflow that leverages Github's Pull Requests? >> Is there some consensus that it's a desired end goal, but some features are >> missing? Or do we prefer to use a workflow like this for the long term? >> > >> > On Thu, Sep 30, 2021, 4:54 PM Chris Tetreault via llvm-dev < >> llvm-...@lists.llvm.org> wrote: >> >> >> >> As I, and others have noticed, it seems that as of today, there’s some >> certificate issue with arcanist. (See: >> https://lists.llvm.org/pipermail/llvm-dev/2021-September/153019.html) >> The fix seems simple, and a PR is up, but looking through the PR activity, >> it seems that the PR will not be accepted because Phabricator is no longer >> being maintained. It seems that arc has become the first casualty of the >> discontinuation of maintenance of phabricator. >> >> >> >> >> >> >> >> I know that arc is not universally used, but I think it’s a serious >> blow to many people’s workflows. I think that MyDeveloperDay’s question >> might have just become a bit more urgent. >> >> >> >> >> >> >> >> I suppose in the short-term, we could fork the phabricator repos in >> order to fix little issues like this. Alternately, we should probably stop >> recommending arcanist (unless we want to provide instructions on how to fix >> any breakages that come along). >> >> >> >> >> >> >> >> Thanks, >> >> >> >>Chris Tetreault >> >> >> >> >> >> >> >> From: llvm-dev On Behalf Of >> MyDeveloper Day via llvm-dev >> >> Sent: Wednesday, August 18, 2021 10:17 AM >> >> To: llvm-dev ; cfe-commits < >> cfe-commits@lists.llvm.org> >> >> Subject: [llvm-dev] Phabricator Creator Pulling the Plug >> >> >> >> >> >> >> >> WARNING: This email originated from outside of Qualcomm. Please be >> wary of any links or attachments, and do not enable macros. >> >> >> >> All >> >> >> >> >> >> >> >> I'm a massive fan of Phabricator, and I know there is often lots of >> contentious discussion about its relative merits vs github, >> >> >> >> >> >> >> >> But unless I missed this, was there any discussion regarding the >> recent "Winding Down" announcement of Phabricator? and what it might mean >> for us in LLVM >> >> >> >> >> >> >> >> See: >> >> >> >> >> https://admin.phacility.com/phame/post/view/11/phacility_is_winding_down_operations/ >> >> >> >> https://www.phacility.com/phabricator/ >> >> >> >> >> >> >> >> Personally I'm excited by the concept of a community driven >> replacement ( https://we.phorge.it/) . >> >> >> >> epriestley did a truly amazing job, it wasn't open to public >> contributions. Perhaps more open development could lead to closing some of >> the github gaps that were of concern. >> >> >> >> >> >> >> >> MyDeveloperDay >> >> >> >> ___ >> >> LLVM Developers mailing list >> >> llvm-...@lists.llvm.org >> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > >> > ___ >> > LLVM Developers mailing list >> > llvm-...@lists.llvm.org >> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > __
[clang] 888876b - [clang] [hexagon] Add resource include dir
Author: Brian Cain Date: 2021-08-10T08:37:58-05:00 New Revision: 76ba272baf68ff38fcfc36c15ac2510bdea7 URL: https://github.com/llvm/llvm-project/commit/76ba272baf68ff38fcfc36c15ac2510bdea7 DIFF: https://github.com/llvm/llvm-project/commit/76ba272baf68ff38fcfc36c15ac2510bdea7.diff LOG: [clang] [hexagon] Add resource include dir Added: Modified: clang/lib/Driver/ToolChains/Hexagon.cpp clang/test/Driver/hexagon-toolchain-linux.c Removed: diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 828bfdbb05a3c..314d0efce4414 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -588,21 +588,43 @@ void HexagonToolChain::addClangTargetOptions(const ArgList &DriverArgs, void HexagonToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs, ArgStringList &CC1Args) const { - if (DriverArgs.hasArg(options::OPT_nostdinc) || - DriverArgs.hasArg(options::OPT_nostdlibinc)) + if (DriverArgs.hasArg(options::OPT_nostdinc)) return; + const bool IsELF = !getTriple().isMusl() && !getTriple().isOSLinux(); + const bool IsLinuxMusl = getTriple().isMusl() && getTriple().isOSLinux(); + const Driver &D = getDriver(); - if (!D.SysRoot.empty()) { + SmallString<128> ResourceDirInclude(D.ResourceDir); + if (!IsELF) { +llvm::sys::path::append(ResourceDirInclude, "include"); +if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && +(!IsLinuxMusl || DriverArgs.hasArg(options::OPT_nostdlibinc))) + addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude); + } + if (DriverArgs.hasArg(options::OPT_nostdlibinc)) +return; + + const bool HasSysRoot = !D.SysRoot.empty(); + if (HasSysRoot) { SmallString<128> P(D.SysRoot); -if (getTriple().isMusl()) +if (IsLinuxMusl) llvm::sys::path::append(P, "usr/include"); else llvm::sys::path::append(P, "include"); + addExternCSystemInclude(DriverArgs, CC1Args, P.str()); -return; +// LOCAL_INCLUDE_DIR +addSystemInclude(DriverArgs, CC1Args, P + "/usr/local/include"); +// TOOL_INCLUDE_DIR +AddMultilibIncludeArgs(DriverArgs, CC1Args); } + if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && IsLinuxMusl) +addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude); + + if (HasSysRoot) +return; std::string TargetDir = getHexagonTargetDir(D.getInstalledDir(), D.PrefixDirs); addExternCSystemInclude(DriverArgs, CC1Args, TargetDir + "/hexagon/include"); diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index 354a924f12098..da59590371b90 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -1,3 +1,5 @@ +// UNSUPPORTED: system-windows + // - // Passing --musl // - @@ -94,4 +96,26 @@ // RUN: -mcpu=hexagonv60 \ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK007 %s -// CHECK007: "-internal-isystem" "{{.*}}hexagon{{/|}}include{{/|}}c++{{/|}}v1" +// CHECK007: "-internal-isystem" "{{.*}}hexagon{{/|}}include{{/|}}c++{{/|}}v1" +// - +// internal-isystem for linux with and without musl +// - +// RUN: %clang -### -target hexagon-unknown-linux-musl \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK008 %s +// CHECK008: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK008: "-resource-dir" "[[RESOURCE:[^"]+]]" +// CHECK008-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include" +// CHECK008-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include" + +// RUN: %clang -### -target hexagon-unknown-linux \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK009 %s +// CHECK009: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK009: "-resource-dir" "[[RESOURCE:[^"]+]]" +// CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include" +// CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 59dfde7 - [clang] enable sanitizers for hexagon
Author: Brian Cain Date: 2021-08-17T19:59:24-07:00 New Revision: 59dfde7d9460242e75d4fe9b62d77ea0f1e8d7dc URL: https://github.com/llvm/llvm-project/commit/59dfde7d9460242e75d4fe9b62d77ea0f1e8d7dc DIFF: https://github.com/llvm/llvm-project/commit/59dfde7d9460242e75d4fe9b62d77ea0f1e8d7dc.diff LOG: [clang] enable sanitizers for hexagon Added: Modified: clang/lib/Driver/ToolChains/Hexagon.cpp clang/lib/Driver/ToolChains/Hexagon.h clang/lib/Driver/ToolChains/Linux.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 314d0efce4414..5f5964ec982b6 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -146,6 +146,8 @@ void hexagon::Assembler::ConstructJob(Compilation &C, const JobAction &JA, "-mcpu=hexagon" + toolchains::HexagonToolChain::GetTargetCPUVersion(Args))); + addSanitizerRuntimes(HTC, Args, CmdArgs); + if (Output.isFilename()) { CmdArgs.push_back("-o"); CmdArgs.push_back(Output.getFilename()); @@ -223,6 +225,8 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, bool UseShared = IsShared && !IsStatic; StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); + bool NeedsSanitizerDeps = addSanitizerRuntimes(HTC, Args, CmdArgs); + // // Silence warnings for various options // @@ -288,6 +292,12 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, AddLinkerInputs(HTC, Inputs, Args, CmdArgs, JA); if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { + if (NeedsSanitizerDeps) { +linkSanitizerRuntimeDeps(HTC, CmdArgs); + +CmdArgs.push_back("-lunwind"); + } + CmdArgs.push_back("-lclang_rt.builtins-hexagon"); CmdArgs.push_back("-lc"); } @@ -450,6 +460,13 @@ Optional HexagonToolChain::getSmallDataThreshold( return None; } +std::string HexagonToolChain::getCompilerRTPath() const { + SmallString<128> Dir(getDriver().SysRoot); + llvm::sys::path::append(Dir, "usr", "lib"); + Dir += SelectedMultilib.gccSuffix(); + return std::string(Dir.str()); +} + void HexagonToolChain::getHexagonLibraryPaths(const ArgList &Args, ToolChain::path_list &LibPaths) const { const Driver &D = getDriver(); diff --git a/clang/lib/Driver/ToolChains/Hexagon.h b/clang/lib/Driver/ToolChains/Hexagon.h index c32cb7f09591a..9dc9b3ceddde1 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.h +++ b/clang/lib/Driver/ToolChains/Hexagon.h @@ -104,6 +104,8 @@ class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux { void getHexagonLibraryPaths(const llvm::opt::ArgList &Args, ToolChain::path_list &LibPaths) const; + std::string getCompilerRTPath() const override; + static bool isAutoHVXEnabled(const llvm::opt::ArgList &Args); static const StringRef GetDefaultCPU(); static const StringRef GetTargetCPUVersion(const llvm::opt::ArgList &Args); diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index c9360fc67165b..caebab3a9aeb0 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -694,6 +694,7 @@ SanitizerMask Linux::getSupportedSanitizers() const { getTriple().getArch() == llvm::Triple::thumbeb; const bool IsRISCV64 = getTriple().getArch() == llvm::Triple::riscv64; const bool IsSystemZ = getTriple().getArch() == llvm::Triple::systemz; + const bool IsHexagon = getTriple().getArch() == llvm::Triple::hexagon; SanitizerMask Res = ToolChain::getSupportedSanitizers(); Res |= SanitizerKind::Address; Res |= SanitizerKind::PointerCompare; @@ -707,7 +708,7 @@ SanitizerMask Linux::getSupportedSanitizers() const { if (IsX86_64 || IsMIPS64 || IsAArch64) Res |= SanitizerKind::DataFlow; if (IsX86_64 || IsMIPS64 || IsAArch64 || IsX86 || IsArmArch || IsPowerPC64 || - IsRISCV64 || IsSystemZ) + IsRISCV64 || IsSystemZ || IsHexagon) Res |= SanitizerKind::Leak; if (IsX86_64 || IsMIPS64 || IsAArch64 || IsPowerPC64 || IsSystemZ) Res |= SanitizerKind::Thread; @@ -716,7 +717,7 @@ SanitizerMask Linux::getSupportedSanitizers() const { if (IsX86 || IsX86_64) Res |= SanitizerKind::Function; if (IsX86_64 || IsMIPS64 || IsAArch64 || IsX86 || IsMIPS || IsArmArch || - IsPowerPC64) + IsPowerPC64 || IsHexagon) Res |= SanitizerKind::Scudo; if (IsX86_64 || IsAArch64) { Res |= SanitizerKind::HWAddress; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] cd97675 - [hexagon] add a -mcabac flag
Author: Brian Cain Date: 2023-01-31T16:30:35-08:00 New Revision: cd97675e02368f31d56bd8f143c5987649d162d8 URL: https://github.com/llvm/llvm-project/commit/cd97675e02368f31d56bd8f143c5987649d162d8 DIFF: https://github.com/llvm/llvm-project/commit/cd97675e02368f31d56bd8f143c5987649d162d8.diff LOG: [hexagon] add a -mcabac flag For v73 and later, clang users who wish to use the cabac instructions need a way to add the 'cabac' target feature. Reviewed By: kparzysz Differential Revision: https://reviews.llvm.org/D142947 Added: Modified: clang/include/clang/Driver/Options.td clang/test/Driver/hexagon-toolchain-elf.c Removed: diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 9aef70321d525..3dead3fcebb0b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4559,6 +4559,8 @@ def mnvs : Flag<["-"], "mnvs">, Group, Flags<[CC1Option]>, HelpText<"Enable generation of new-value stores">; def mno_nvs : Flag<["-"], "mno-nvs">, Group, Flags<[CC1Option]>, HelpText<"Disable generation of new-value stores">; +def mcabac: Flag<["-"], "mcabac">, Group, + HelpText<"Enable CABAC instructions">; // SPARC feature flags def mfpu : Flag<["-"], "mfpu">, Group; diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c index 477bc8a969b92..9454c33747630 100644 --- a/clang/test/Driver/hexagon-toolchain-elf.c +++ b/clang/test/Driver/hexagon-toolchain-elf.c @@ -581,6 +581,16 @@ // RUN:| FileCheck --check-prefix=CHECK371 %s // CHECK371-NOT: "+reserved-r19" +// - +// mcabac +// - +// RUN: %clang -### -target hexagon-unknown-elf -mcabac %s 2>&1 \ +// RUN:| FileCheck --check-prefix=CHECK372 %s +// CHECK372: "-target-feature" "+cabac" +// RUN: %clang -### -target hexagon-unknown-elf %s 2>&1 \ +// RUN:| FileCheck --check-prefix=CHECK373 %s +// CHECK373-NOT: "+cabac" + // - // Misc Defaults // - ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 96832a6 - [hexagon] restore library path arguments
Author: Brian Cain Date: 2023-07-27T13:26:28-07:00 New Revision: 96832a6bf7e0e7f1e8d634d38c44a1b32d512923 URL: https://github.com/llvm/llvm-project/commit/96832a6bf7e0e7f1e8d634d38c44a1b32d512923 DIFF: https://github.com/llvm/llvm-project/commit/96832a6bf7e0e7f1e8d634d38c44a1b32d512923.diff LOG: [hexagon] restore library path arguments Before applying this fix, clang would not include the specified library path arguments: $ ./bin/clang --target=hexagon-unknown-linux-musl -o tprog tprog.o -L/tmp -### ... clang: warning: argument unused during compilation: '-L/tmp' [-Wunused-command-line-argument] "/local/mnt/workspace/install/clang-latest/bin/ld.lld" "-z" "relro" "-o" "tprog" "-dynamic-linker=/lib/ld-musl-hexagon.so.1" "/usr/lib/crt1.o" "-L/usr/lib" "tprog.o" "-lclang_rt.builtins-hexagon" "-lc" Differential Revision: https://reviews.llvm.org/D156330 Added: Modified: clang/lib/Driver/ToolChains/Hexagon.cpp clang/test/Driver/hexagon-toolchain-linux.c Removed: diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 7acc600a6aa4fe..dab7382532520a 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -383,7 +383,6 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, if (HTC.ShouldLinkCXXStdlib(Args)) HTC.AddCXXStdlibLibArgs(Args, CmdArgs); } -return; } // @@ -441,6 +440,7 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, const ToolChain::path_list &LibPaths = HTC.getFilePaths(); for (const auto &LibPath : LibPaths) CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); + Args.ClaimAllArgs(options::OPT_L); // // diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index 05ae1733992d97..61a5581b009c23 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -119,3 +119,9 @@ // CHECK009: "-resource-dir" "[[RESOURCE:[^"]+]]" // CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include" // CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include" + +// RUN: %clang -fdriver-only -Werror -v -L/tmp \ +// RUN:--target=hexagon-unknown-linux-musl %s 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK010 %s +// CHECK010: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK010: "-L/tmp" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5bc4b34 - [clang][hexagon] Handle library path arguments earlier
Author: Brian Cain Date: 2023-08-07T18:18:59-07:00 New Revision: 5bc4b34a3aa9c6ea10663a252ac46d20862b38d5 URL: https://github.com/llvm/llvm-project/commit/5bc4b34a3aa9c6ea10663a252ac46d20862b38d5 DIFF: https://github.com/llvm/llvm-project/commit/5bc4b34a3aa9c6ea10663a252ac46d20862b38d5.diff LOG: [clang][hexagon] Handle library path arguments earlier The removal of the early return in 96832a6bf7e0e7f1e8d634d38c44a1b32d512923 was an error: it would include the 'standalone' library that's not used by linux. Instead we reproduce the library path handling in the linux/musl block. Differential Revision: https://reviews.llvm.org/D156771 Added: Modified: clang/lib/Driver/ToolChains/Hexagon.cpp clang/test/Driver/hexagon-toolchain-linux.c Removed: diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index dab7382532520a..aed4ab1955b4f3 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -383,6 +383,11 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, if (HTC.ShouldLinkCXXStdlib(Args)) HTC.AddCXXStdlibLibArgs(Args, CmdArgs); } +const ToolChain::path_list &LibPaths = HTC.getFilePaths(); +for (const auto &LibPath : LibPaths) + CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); +Args.ClaimAllArgs(options::OPT_L); +return; } // diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index 61a5581b009c23..423306affdce3a 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -120,8 +120,12 @@ // CHECK009-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]/include" // CHECK009-SAME: {{^}} "-internal-externc-isystem" "[[INSTALLED_DIR]]/../target/hexagon/include" -// RUN: %clang -fdriver-only -Werror -v -L/tmp \ -// RUN:--target=hexagon-unknown-linux-musl %s 2>&1 \ +// RUN: %clang -Werror -L/tmp \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ // RUN:| FileCheck -check-prefix=CHECK010 %s // CHECK010: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK010-NOT: "-lstandalone" +// CHECK010-NOT: crt0_standalone.o +// CHECK010: crt1.o // CHECK010: "-L/tmp" +// CHECK010-NOT: "-lstandalone" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -367,7 +420,7 @@ XRayPatchingStatus mprotectAndPatchFunction(int32_t FuncId, return XRayPatchingStatus::FAILED; } - // Here we compute the minimum sled and maximum sled associated with a + // Here we compute the minumum sled and maximum sled associated with a androm3da wrote: This change has a typo - `minimum` from the baseline was correct as-is. https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -346,8 +392,8 @@ else() # not Apple DEFS ${XRAY_COMMON_DEFINITIONS} OBJECT_LIBS RTXrayBASIC PARENT_TARGET xray) - # Profiler Mode runtime - add_compiler_rt_runtime(clang_rt.xray-profiling +# Profiler Mode runtime +add_compiler_rt_runtime(clang_rt.xray-profiling androm3da wrote: unintentional whitespace change? https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
https://github.com/androm3da edited https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -1520,10 +1520,14 @@ bool tools::addSanitizerRuntimes(const ToolChain &TC, const ArgList &Args, } bool tools::addXRayRuntime(const ToolChain&TC, const ArgList &Args, ArgStringList &CmdArgs) { - if (Args.hasArg(options::OPT_shared)) -return false; - - if (TC.getXRayArgs().needsXRayRt()) { + if (Args.hasArg(options::OPT_shared)) { +if (TC.getXRayArgs().needsXRayDSORt()) { + CmdArgs.push_back("-whole-archive"); androm3da wrote: Why do we use `-whole-archive` here but `--whole-archive` below? Do `ld` and `ld-alikes` all accept both? Probably makes more sense to have `--whole-archive` here. (same goes for `-no-whole-archive` below) https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
https://github.com/androm3da commented: Instead of adding new commits to address feedback - please change the existing commits to alter the content to look as if it would when the PR would be merged. (Unless perhaps there's an LLVM community policy to do it this way) https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -0,0 +1,62 @@ +//===-- xray_init.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of XRay, a dynamic runtime instrumentation system. +// +// XRay initialisation logic for DSOs. +//===--===// + +#include "sanitizer_common/sanitizer_atomic.h" +#include "xray_defs.h" +#include "xray_flags.h" +#include "xray_interface_internal.h" + +using namespace __sanitizer; + +extern "C" { +extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRaySledEntry __stop_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __start_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __stop_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); + +#if SANITIZER_MAC androm3da wrote: Probably should be instead #if defined(SANITIZER_MAC) && SANITIZER_MAC https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -50,14 +52,72 @@ atomic_uint8_t XRayInitialized{0}; // This should always be updated before XRayInitialized is updated. SpinMutex XRayInstrMapMutex; -XRaySledMap XRayInstrMap; +// XRaySledMap XRayInstrMap; +// Contains maps for the main executable as well as DSOs. +// std::vector XRayInstrMaps; androm3da wrote: Please remove these commented-out declarations. https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -63,6 +63,10 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) { << XRayInstrument->getSpelling() << Triple.str(); } + if (Args.hasFlag(options::OPT_fxray_enable_shared, + options::OPT_fno_xray_enable_shared, false)) +XRayEnableShared = true; + androm3da wrote: I think we should emit an error if xray shared is enabled but PIC is not enabled. Could you add a test for that? https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -471,42 +518,123 @@ uint16_t __xray_register_event_type( } XRayPatchingStatus __xray_patch() XRAY_NEVER_INSTRUMENT { - return controlPatching(true); + XRayPatchingStatus CombinedStatus{SUCCESS}; + for (size_t I = 0; I < __xray_num_objects(); ++I) { +if (!isObjectLoaded(I)) + continue; +auto LastStatus = controlPatching(true, I); +switch (LastStatus) { +case FAILED: + CombinedStatus = FAILED; + break; +case NOT_INITIALIZED: + if (CombinedStatus != FAILED) +CombinedStatus = NOT_INITIALIZED; + break; +case ONGOING: + if (CombinedStatus != FAILED && CombinedStatus != NOT_INITIALIZED) +CombinedStatus = ONGOING; + break; +default: + break; androm3da wrote: IMO you should add a `SUCCESS` case that's ignored and make `default` be `LLVM_UNREACHABLE`. (same for unpatch below) https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -471,42 +518,123 @@ uint16_t __xray_register_event_type( } XRayPatchingStatus __xray_patch() XRAY_NEVER_INSTRUMENT { - return controlPatching(true); + XRayPatchingStatus CombinedStatus{SUCCESS}; androm3da wrote: If none of the objects are loaded, `__xray_patch()` will return `SUCCESS`. That's the expected result? (same for unpatch below) https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -0,0 +1,62 @@ +//===-- xray_init.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of XRay, a dynamic runtime instrumentation system. +// +// XRay initialisation logic for DSOs. +//===--===// + +#include "sanitizer_common/sanitizer_atomic.h" +#include "xray_defs.h" +#include "xray_flags.h" +#include "xray_interface_internal.h" + +using namespace __sanitizer; + +extern "C" { +extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRaySledEntry __stop_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __start_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __stop_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); androm3da wrote: These symbols are declared `weak` - so can you help me understand how this would behave in different cases like `RTLD_GLOBAL` vs `RTLD_LOCAL`? How would these be resolved? Is the behavior acceptable in both cases? Say for example I have explicitly linked against liba, libb->libc - all built with `-fxray-enable-shared` and IIRC the loader will load all three libraries with `RTLD_GLOBAL`. Some time later, my program loads libd (built with `-fxray-enable-shared`) via an explicit `dlopen(..., RTLD_LOCAL)` and the loader resolves one of libd's DT_NEEDED to libe (built with `-fxray-enable-shared`). In these cases, do we write to these maps, indices such that the patching, unpatching would work as expected? Can we cover them with tests? https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -111,6 +156,71 @@ void __xray_init() XRAY_NEVER_INSTRUMENT { #endif } +// Default visibility is hidden, so we have to explicitly make it visible to +// DSO. +SANITIZER_INTERFACE_ATTRIBUTE int32_t __xray_register_dso( +const XRaySledEntry *SledsBegin, const XRaySledEntry *SledsEnd, +const XRayFunctionSledIndex *FnIndexBegin, +const XRayFunctionSledIndex *FnIndexEnd, +XRayTrampolines Trampolines) XRAY_NEVER_INSTRUMENT { + // Make sure XRay has been initialized in the main executable. + __xray_init(); + + if (__xray_num_objects() == 0) { +if (Verbosity()) + Report("No XRay instrumentation map in main executable. Not initializing " + "XRay for DSO.\n"); +return -1; + } + + // Register sleds in global map. + int ObjId = __xray_register_sleds(SledsBegin, SledsEnd, FnIndexBegin, + FnIndexEnd, true, Trampolines); + +#ifndef XRAY_NO_PREINIT + if (ObjId >= 0 && flags()->patch_premain) +__xray_patch_object(ObjId); +#endif + + return ObjId; +} + +SANITIZER_INTERFACE_ATTRIBUTE bool +__xray_deregister_dso(int32_t ObjId) XRAY_NEVER_INSTRUMENT { + // Make sure XRay has been initialized in the main executable. + __xray_init(); + + if (ObjId <= 0 || ObjId >= __xray_num_objects()) { +if (Verbosity()) + Report("Can't deregister object with ID %d: ID is invalid.\n", ObjId); +return false; + } + + { +SpinMutexLock Guard(&XRayInstrMapMutex); +auto &Entry = XRayInstrMaps[ObjId]; +if (!Entry.FromDSO) { + if (Verbosity()) +Report("Can't deregister object with ID %d: object does not correspond " + "to a shared library.\n", + ObjId); + return false; +} +if (!Entry.Loaded) { + if (Verbosity()) +Report("Can't deregister object with ID %d: object is not loaded.\n", + ObjId); androm3da wrote: Should this path `return false`? https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -0,0 +1,62 @@ +//===-- xray_init.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of XRay, a dynamic runtime instrumentation system. +// +// XRay initialisation logic for DSOs. +//===--===// + +#include "sanitizer_common/sanitizer_atomic.h" +#include "xray_defs.h" +#include "xray_flags.h" +#include "xray_interface_internal.h" + +using namespace __sanitizer; + +extern "C" { +extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRaySledEntry __stop_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __start_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __stop_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); androm3da wrote: How would this symbol resolution behave in a case where the main executable was not built with `-fxray-enable` and only the shared objects were? If this case is unsupported, can we detect it and log a message or abort()/terminate? https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/94877 >From ffccfde9f5892520f499b6cfc12ba824aafe5fbd Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Sat, 8 Jun 2024 16:25:11 -0700 Subject: [PATCH] [hexagon] Add {con,de}structive interference size defn This support was originally added in 72c373bfdc98 ([C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (#89446), 2024-04-26). We're overriding the values for Hexagon here. Signed-off-by: Brian Cain --- clang/lib/Basic/Targets/Hexagon.cpp | 12 clang/lib/Basic/Targets/Hexagon.h| 10 ++ clang/test/Preprocessor/hexagon-predefines.c | 17 + 3 files changed, 39 insertions(+) diff --git a/clang/lib/Basic/Targets/Hexagon.cpp b/clang/lib/Basic/Targets/Hexagon.cpp index ac747e371fb476..0282ac812c306f 100644 --- a/clang/lib/Basic/Targets/Hexagon.cpp +++ b/clang/lib/Basic/Targets/Hexagon.cpp @@ -238,6 +238,18 @@ static constexpr CPUSuffix Suffixes[] = { {{"hexagonv73"}, {"73"}}, }; +std::optional HexagonTargetInfo::getHexagonCPURev(StringRef Name) { + StringRef Arch = Name; + Arch.consume_front("hexagonv"); + Arch.consume_back("t"); + + unsigned Val; + if (!Arch.getAsInteger(0, Val)) +return Val; + + return std::nullopt; +} + const char *HexagonTargetInfo::getHexagonCPUSuffix(StringRef Name) { const CPUSuffix *Item = llvm::find_if( Suffixes, [Name](const CPUSuffix &S) { return S.Name == Name; }); diff --git a/clang/lib/Basic/Targets/Hexagon.h b/clang/lib/Basic/Targets/Hexagon.h index cdb47dbae79996..e98221eca3cf7e 100644 --- a/clang/lib/Basic/Targets/Hexagon.h +++ b/clang/lib/Basic/Targets/Hexagon.h @@ -17,6 +17,7 @@ #include "clang/Basic/TargetOptions.h" #include "llvm/Support/Compiler.h" #include "llvm/TargetParser/Triple.h" +#include namespace clang { namespace targets { @@ -115,6 +116,7 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo { std::string_view getClobbers() const override { return ""; } static const char *getHexagonCPUSuffix(StringRef Name); + static std::optional getHexagonCPURev(StringRef Name); bool isValidCPUName(StringRef Name) const override { return getHexagonCPUSuffix(Name); @@ -139,6 +141,14 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo { } bool hasBitIntType() const override { return true; } + + std::pair hardwareInterferenceSizes() const override { +std::optional Rev = getHexagonCPURev(CPU); + +// V73 and later have 64-byte cache lines. +unsigned CacheLineSizeBytes = Rev >= 73 ? 64 : 32; +return std::make_pair(CacheLineSizeBytes, CacheLineSizeBytes); + } }; } // namespace targets } // namespace clang diff --git a/clang/test/Preprocessor/hexagon-predefines.c b/clang/test/Preprocessor/hexagon-predefines.c index bd55753a090de8..188f465520056e 100644 --- a/clang/test/Preprocessor/hexagon-predefines.c +++ b/clang/test/Preprocessor/hexagon-predefines.c @@ -169,3 +169,20 @@ // CHECK-ATOMIC: #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2 // CHECK-ATOMIC: #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2 // CHECK-ATOMIC: #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2 + +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-linux-musl \ +// RUN: -target-cpu hexagonv67 | FileCheck \ +// RUN: %s -check-prefix CHECK-INTERFERENCE +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \ +// RUN: -target-cpu hexagonv67 | FileCheck \ +// RUN: %s -check-prefix CHECK-INTERFERENCE +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \ +// RUN: -target-cpu hexagonv71t | FileCheck \ +// RUN: %s -check-prefix CHECK-INTERFERENCE +// CHECK-INTERFERENCE: #define __GCC_CONSTRUCTIVE_SIZE 32 +// CHECK-INTERFERENCE: #define __GCC_DESTRUCTIVE_SIZE 32 +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \ +// RUN: -target-cpu hexagonv73 | FileCheck \ +// RUN: %s -check-prefix CHECK-INTERFERENCE-73 +// CHECK-INTERFERENCE-73: #define __GCC_CONSTRUCTIVE_SIZE 64 +// CHECK-INTERFERENCE-73: #define __GCC_DESTRUCTIVE_SIZE 64 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
https://github.com/androm3da ready_for_review https://github.com/llvm/llvm-project/pull/94877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -346,8 +392,8 @@ else() # not Apple DEFS ${XRAY_COMMON_DEFINITIONS} OBJECT_LIBS RTXrayBASIC PARENT_TARGET xray) - # Profiler Mode runtime - add_compiler_rt_runtime(clang_rt.xray-profiling +# Profiler Mode runtime +add_compiler_rt_runtime(clang_rt.xray-profiling androm3da wrote: no - as long as it's intentional, leave it as-is https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -471,42 +518,123 @@ uint16_t __xray_register_event_type( } XRayPatchingStatus __xray_patch() XRAY_NEVER_INSTRUMENT { - return controlPatching(true); + XRayPatchingStatus CombinedStatus{SUCCESS}; androm3da wrote: > We could add an assertion to make this assumption explicit. What do you think? Yeah - good idea, if it's easily done. https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang, hexagon] Update copyright, license text (PR #107161)
https://github.com/androm3da created https://github.com/llvm/llvm-project/pull/107161 When this file was first contributed - `28b01c59c93d ([hexagon] Add {hvx,}hexagon_{protos,circ_brev...}, 2021-06-30)` - I incorrectly included a QuIC copyright statement with "All rights reserved". I should have contributed this file with the `Apache+LLVM exception` license. >From b4705aa71a261e58930f08056d1fd79c6537a50d Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Tue, 3 Sep 2024 15:37:08 -0700 Subject: [PATCH] [clang, hexagon] Update copyright, license text When this file was first contributed - `28b01c59c93d ([hexagon] Add {hvx,}hexagon_{protos,circ_brev...}, 2021-06-30)` - I incorrectly included a QuIC copyright statement with "All rights reserved". I should have contributed this file with the `Apache+LLVM exception` license. --- clang/lib/Headers/hexagon_types.h | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/clang/lib/Headers/hexagon_types.h b/clang/lib/Headers/hexagon_types.h index 029727cc48176b..8e73fad4bcd424 100644 --- a/clang/lib/Headers/hexagon_types.h +++ b/clang/lib/Headers/hexagon_types.h @@ -1,7 +1,11 @@ -/**/ -/* (c) 2020 Qualcomm Innovation Center, Inc. All rights reserved. */ -/* */ -/**/ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + #ifndef HEXAGON_TYPES_H #define HEXAGON_TYPES_H ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang, hexagon] Update copyright, license text (PR #107161)
androm3da wrote: Note that this was the only source file from the original commit without the correct header. https://github.com/llvm/llvm-project/pull/107161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") androm3da wrote: I'm willing to try that, it makes sense. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") + +set(LIBCXX_HAS_ATOMIC_LIB OFF CACHE BOOL "") androm3da wrote: I suppose it may have been at some point and we ended up with this as a workaround? Hopefully now it works. I'll investigate. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") androm3da wrote: These are build options -- they indicate the scope of what to build - but the defaults are overridden specifically for the hexagon toolchain. This is in order to avoid defects either in the code we're building or in the compiler. There's no existing cache that could know about these architecture-specific bugs, I figure. For example, in `compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h` there's these inline asm statements to alias some functions - the hexagon assembler rejects these. ``` asm("memcpy = __sanitizer_internal_memcpy"); asm("memmove = __sanitizer_internal_memmove"); asm("memset = __sanitizer_internal_memset"); ``` I think it probably makes sense to use a directive instead of this syntax which isn't (as) portable. Or maybe it's a bug in the assembler. In any case, I'd like to punt and just descope the toolchain build for now. But maybe I've misunderstood what you're trying to say about the compiler-rt CMake caches - maybe I should specify these outside of `hexagon-linux-runtimes.cmake` in `hexagon-linux-compiler-rt.cmake`? If so, that's fine w/me (though we'll be loading both cache files when building the runtimes). https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") androm3da wrote: Hmm, so I already have `CMAKE_CXX_COMPILER_TARGET` set this way in `hexagon-linux-cross.cmake` (I left this cache out of this PR but I could include it if it's useful). So omitting `LLVM_DEFAULT_TARGET_TRIPLE` results in the failure below. ``` cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_CMAKE_DIR:PATH=${TOOLCHAIN_LIB} \ -DCMAKE_INSTALL_PREFIX:PATH=${HEX_TOOLS_TARGET_BASE} \ -DCMAKE_CROSSCOMPILING:BOOL=ON \ -DCMAKE_CXX_COMPILER_FORCED:BOOL=ON \ -C ./hexagon-linux-cross.cmake \ -C ./hexagon-linux-runtimes.cmake \ -B ./obj_libs \ -S ./llvm-project/runtimes ... -- Configuring done CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library): Error evaluating generator expression: $ Objects of target "RTSanitizerCommon.x86_64" referenced but no such target exists. Call Stack (most recent call first): /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime) CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library): Error evaluating generator expression: $ Objects of target "RTSanitizerCommon.x86_64" referenced but no such target exists. Call Stack (most recent call first): /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime) CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library): Error evaluating generator expression: $ Objects of target "RTSanitizerCommon.x86_64" referenced but no such target exists. Call Stack (most recent call first): /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime) CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library): No SOURCES given to target: clang_rt.ctx_profile-x86_64 Call Stack (most recent call first): /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime) ``` But `llvm-project/runtimes/CMakeLists.txt` has this, which I think is how I determined that I should be using `LLVM_DEFAULT_TARGET_TRIPLE` (or `LLVM_TARGET_TRIPLE` eventually?). ``` # Host triple is used by tests to check if they are running natively. include(GetHostTriple) get_host_triple(LLVM_HOST_TRIPLE) message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}") # TODO: We shouldn't be using LLVM_DEFAULT_TARGET_TRIPLE for runtimes since we # aren't generating code, LLVM_TARGET_TRIPLE is a better fit. set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING "Default target for which the runtimes will be built.") message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}") set(LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}") ``` https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From bca45b046e8b6092bfa44c01172ecfcad84758d7 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped cross-toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon Signed-off-by: Brian Cain --- ...xagon-unknown-linux-musl-clang-cross.cmake | 11 ++ .../hexagon-unknown-linux-musl-clang.cmake| 15 + .../cmake/caches/hexagon-linux-builtins.cmake | 15 + .../cmake/caches/hexagon-linux-runtimes.cmake | 22 +++ 4 files changed, 63 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 00..2df7d8183baa64 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,11 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 00..9f3eb4678fd17b --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 00..d9c9ff2a4655ee --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/libcxx/cmake/caches/hexagon-linux-runtimes.cmake b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake new file mode 100644 index 00..dbd537b210ffde --- /dev/null +++ b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake @@ -0,0 +1,22 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") + +set(LIBCXX_HAS_ATOMIC_LIB OFF CACHE BOOL "") androm3da wrote: Indeed, they are no longer necessary. These have been removed. Thank you for pointing it out. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") androm3da wrote: Based on your comments it's as if you're saying "compiler-rt isn't part of 'runtimes'" and yet - it certainly *can* be, so I assumed that it *should*. When we specify `LLVM_ENABLE_RUNTIMES` as `libcxx;libcxxabi;libunwind;compiler-rt` then it builds all of them, so it made sense to me that we could/should include all of the `option` inputs here in one place. But for the sake of being able to build them independently, I'm happy to decompose the cache files. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang, hexagon] Update copyright, license text (PR #107161)
androm3da wrote: @SundeepKushwaha or @ronlieb could you review this PR? Should be non-controversial I hope. https://github.com/llvm/llvm-project/pull/107161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") androm3da wrote: Oh, oops - since I put this in `libcxx/cmake/caches/hexagon-linux-runtimes.cmake` it does look like it's intended for libc++. Sorry, that should've been obvious to me but it wasn't. Okay, working on an update that separates these. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From 29554e6a090075993a67126880cfb9e5f93f28f4 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped cross-toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon Signed-off-by: Brian Cain --- .../hexagon-unknown-linux-musl-clang-cross.cmake | 11 +++ .../caches/hexagon-unknown-linux-musl-clang.cmake | 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-clangrt.cmake | 14 ++ libcxx/cmake/caches/hexagon-linux-runtimes.cmake | 15 +++ 5 files changed, 70 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 00..2df7d8183baa64 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,11 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 00..9f3eb4678fd17b --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 00..d9c9ff2a4655ee --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake new file mode 100644 index 00..baf149306f91bb --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake @@ -0,0 +1,14 @@ + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") + +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") + +# Some build failures here, including the inline asm in +# `compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h`, so +# we can just disable these for now: +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") + diff --git a/libcxx/cmake/caches/hexagon-linu
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") androm3da wrote: They're now separated, I think this is how you'll prefer it. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang, hexagon] Update copyright, license text (PR #107161)
https://github.com/androm3da closed https://github.com/llvm/llvm-project/pull/107161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From 29554e6a090075993a67126880cfb9e5f93f28f4 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped cross-toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon Signed-off-by: Brian Cain --- .../hexagon-unknown-linux-musl-clang-cross.cmake | 11 +++ .../caches/hexagon-unknown-linux-musl-clang.cmake | 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-clangrt.cmake | 14 ++ libcxx/cmake/caches/hexagon-linux-runtimes.cmake | 15 +++ 5 files changed, 70 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 00..2df7d8183baa64 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,11 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 00..9f3eb4678fd17b --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 00..d9c9ff2a4655ee --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake new file mode 100644 index 00..baf149306f91bb --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake @@ -0,0 +1,14 @@ + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") + +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") + +# Some build failures here, including the inline asm in +# `compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h`, so +# we can just disable these for now: +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") + diff --git a/libcxx/cmake/caches/hexagon-linu
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
https://github.com/androm3da created https://github.com/llvm/llvm-project/pull/94877 This support was originally added in 72c373bfdc98 ([C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (#89446), 2024-04-26). We're overriding the values for Hexagon here. >From 2641525accd144331dcd1efee03a62835e1e0d65 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Sat, 8 Jun 2024 16:25:11 -0700 Subject: [PATCH] [hexagon] Add {con,de}structive interference size defn This support was originally added in 72c373bfdc98 ([C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (#89446), 2024-04-26). We're overriding the values for Hexagon here. Signed-off-by: Brian Cain --- clang/lib/Basic/Targets/Hexagon.h | 4 1 file changed, 4 insertions(+) diff --git a/clang/lib/Basic/Targets/Hexagon.h b/clang/lib/Basic/Targets/Hexagon.h index cdb47dbae7999..f5e7a8878f01b 100644 --- a/clang/lib/Basic/Targets/Hexagon.h +++ b/clang/lib/Basic/Targets/Hexagon.h @@ -139,6 +139,10 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo { } bool hasBitIntType() const override { return true; } + + std::pair hardwareInterferenceSizes() const override { +return std::make_pair(32, 32); + } }; } // namespace targets } // namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/94877 >From 537cda866200e636cf679fa24f6b857ce6b36339 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Sat, 8 Jun 2024 16:25:11 -0700 Subject: [PATCH] [hexagon] Add {con,de}structive interference size defn This support was originally added in 72c373bfdc98 ([C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (#89446), 2024-04-26). We're overriding the values for Hexagon here. Signed-off-by: Brian Cain --- clang/lib/Basic/Targets/Hexagon.h| 4 clang/test/Preprocessor/hexagon-predefines.c | 9 + 2 files changed, 13 insertions(+) diff --git a/clang/lib/Basic/Targets/Hexagon.h b/clang/lib/Basic/Targets/Hexagon.h index cdb47dbae7999..f5e7a8878f01b 100644 --- a/clang/lib/Basic/Targets/Hexagon.h +++ b/clang/lib/Basic/Targets/Hexagon.h @@ -139,6 +139,10 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo { } bool hasBitIntType() const override { return true; } + + std::pair hardwareInterferenceSizes() const override { +return std::make_pair(32, 32); + } }; } // namespace targets } // namespace clang diff --git a/clang/test/Preprocessor/hexagon-predefines.c b/clang/test/Preprocessor/hexagon-predefines.c index bd55753a090de..0e35e974b6058 100644 --- a/clang/test/Preprocessor/hexagon-predefines.c +++ b/clang/test/Preprocessor/hexagon-predefines.c @@ -169,3 +169,12 @@ // CHECK-ATOMIC: #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2 // CHECK-ATOMIC: #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2 // CHECK-ATOMIC: #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2 + +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-linux-musl \ +// RUN: -target-cpu hexagonv67 | FileCheck \ +// RUN: %s -check-prefix CHECK-INTERFERENCE +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \ +// RUN: -target-cpu hexagonv67 | FileCheck \ +// RUN: %s -check-prefix CHECK-INTERFERENCE +// CHECK-INTERFERENCE: #define __GCC_CONSTRUCTIVE_SIZE 32 +// CHECK-INTERFERENCE: #define __GCC_DESTRUCTIVE_SIZE 32 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
androm3da wrote: > LGTM as far as the code goes, but please add some test coverage for the > changes. Not sure why I omitted it -- thanks. Fixed. https://github.com/llvm/llvm-project/pull/94877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
https://github.com/androm3da converted_to_draft https://github.com/llvm/llvm-project/pull/94877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
androm3da wrote: I was mistaken: it appears that the cache line size is not the same among all CPUs. I'll revise this PR. Since I'm away from the office for a couple of weeks, I've switched this PR to a draft. I'll revisit it when I return and promote it when updated. https://github.com/llvm/llvm-project/pull/94877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") androm3da wrote: The first failure encountered when I remove these is related to `C_SUPPORTS_NODEFAULTLIBS_FLAG`. And I think it's `llvm_check_compiler_linker_flag(C "-nodefaultlibs" C_SUPPORTS_NODEFAULTLIBS_FLAG)` from `llvm-project/libunwind/cmake/config-ix.cmake` failing. Sorry if I'm being dense here but if the compiler feature test tries to build an executable using `-nodefaultlibs` but without providing the necessary libraries to satisfy a trivial C executable, wouldn't we expect it to fail? I mean, I guess other compilers must be succeeding here, so I'll have to try and understand how. Or maybe it could be that `-nodefaultlibs` is mishandled by the hexagon driver? I guess I'd figure it would remove at least `-lc` though, which seems like it should fail something like this. ``` Change Dir: /local/mnt/workspace/upstream/toolchain_for_hexagon/obj_libs/CMakeFiles/CMakeScratch/TryCompile-z4nhCq Run Build Command(s):/pkg/qct/software/ninja/1.8.2/ninja cmTC_11433 && [1/2] Building C object CMakeFiles/cmTC_11433.dir/src.c.o [2/2] Linking C executable cmTC_11433 FAILED: cmTC_11433 : && /local/mnt/workspace/upstream/toolchain_for_hexagon/clang+llvm-19.0.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/hexagon-unknown-linux-musl-clang --target=hexagon-unknown-linux-musl -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections --start-no-unused-arguments --unwindlib=none --end-no-unused-arguments -nodefaultlibs CMakeFiles/cmTC_11433.dir/src.c.o -o cmTC_11433 && : ld.lld: error: undefined symbol: __libc_start_main >>> referenced by crt1.c >>> >>> /local/mnt/workspace/upstream/toolchain_for_hexagon/clang+llvm-19.0.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/crt1.o:(_start_c) >>> referenced by crt1.c >>> >>> /local/mnt/workspace/upstream/toolchain_for_hexagon/clang+llvm-19.0.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/crt1.o:(_start_c) hexagon-unknown-linux-musl-clang: error: hexagon-ld command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. Source file was: int main(void) { return 0; } ``` https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") androm3da wrote: Thanks for the suggestion, it looks like this uncovers a driver bug. I'll take a look at that first. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From c01c1ee772c86ac637578fca866588b8191b15c4 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon Signed-off-by: Brian Cain --- ...xagon-unknown-linux-musl-clang-cross.cmake | 11 +++ .../hexagon-unknown-linux-musl-clang.cmake| 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-runtimes.cmake | 19 +++ 4 files changed, 60 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 0..2df7d8183baa6 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,11 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 0..9f3eb4678fd17 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 0..d9c9ff2a4655e --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/libcxx/cmake/caches/hexagon-linux-runtimes.cmake b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake new file mode 100644 index 0..99b07b0c05be2 --- /dev/null +++ b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake @@ -0,0 +1,19 @@ + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES "libcxx;libcxxabi;libunwind;compiler-rt" CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS ON CACHE BOOL "") + +set(LIBCXX_HAS_ATOMIC_LIB OFF CACHE BOOL "") +set(LIBCXXABI_HAS_ATOMIC_LIB OFF CACHE BOOL "") +set(LIBUNWIND_HAS_ATOMIC_LIB OFF CACHE BOOL "") +set(LIBCXX_USE_COMPILER_RT
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") androm3da wrote: Ok, I think the driver bug (`--unwindlib=none` was ignored) might not have been the critical factor. I'll open a PR for that regardless. But I made a few fixes to address these and perhaps some of the other concerns you raised. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da edited https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From bfe841f7b917940716b0662cdbaa9fd0597a255f Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon Signed-off-by: Brian Cain --- ...xagon-unknown-linux-musl-clang-cross.cmake | 11 .../hexagon-unknown-linux-musl-clang.cmake| 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-runtimes.cmake | 25 +++ 4 files changed, 66 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 0..2df7d8183baa6 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,11 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 0..9f3eb4678fd17 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 0..d9c9ff2a4655e --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/libcxx/cmake/caches/hexagon-linux-runtimes.cmake b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake new file mode 100644 index 0..d1c5b0d563035 --- /dev/null +++ b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake @@ -0,0 +1,25 @@ + +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES libcxx;libcxxabi;libunwind;compiler-rt CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBUNWIND_INCLUDE_TESTS OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") + +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL
[clang] [clang] [hexagon] handle --unwindlib arg (PR #99552)
https://github.com/androm3da created https://github.com/llvm/llvm-project/pull/99552 None >From 304b87ca8eab37f499dc202bc184c66f45b574e5 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 17 Jul 2024 08:08:30 -0500 Subject: [PATCH] [clang] [hexagon] handle --unwindlib arg Signed-off-by: Brian Cain --- .../clang/Basic/DiagnosticDriverKinds.td | 2 ++ clang/lib/Driver/ToolChains/Hexagon.cpp | 18 -- clang/test/Driver/hexagon-toolchain-linux.c | 33 +++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 359c0de7f811c..2a1f58ade74a2 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -156,6 +156,8 @@ def err_drv_unsupported_rtlib_for_platform : Error< "unsupported runtime library '%0' for platform '%1'">; def err_drv_invalid_unwindlib_name : Error< "invalid unwind library name in argument '%0'">; +def err_drv_unsupported_unwind_for_platform : Error< + "unwind library '%0' is not supported by this platform">; def err_drv_incompatible_unwindlib : Error< "--rtlib=libgcc requires --unwindlib=libgcc">; def err_drv_incompatible_options : Error< diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 12b3b99df7ca1..6df60c3e945ee 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -366,11 +366,14 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, options::OPT_t, options::OPT_u_Group}); AddLinkerInputs(HTC, Inputs, Args, CmdArgs, JA); +ToolChain::UnwindLibType UNW = HTC.GetUnwindLibType(Args); + if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { if (NeedsSanitizerDeps) { linkSanitizerRuntimeDeps(HTC, Args, CmdArgs); -CmdArgs.push_back("-lunwind"); + if (UNW != ToolChain::UNW_None) + CmdArgs.push_back("-lunwind"); } if (NeedsXRayDeps) linkXRayRuntimeDeps(HTC, Args, CmdArgs); @@ -618,13 +621,24 @@ HexagonToolChain::~HexagonToolChain() {} void HexagonToolChain::AddCXXStdlibLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { CXXStdlibType Type = GetCXXStdlibType(Args); + ToolChain::UnwindLibType UNW = GetUnwindLibType(Args); + if (UNW != ToolChain::UNW_None && UNW != ToolChain::UNW_CompilerRT) { +const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ); +if (A) { + getDriver().Diag(diag::err_drv_unsupported_unwind_for_platform) + << A->getValue(); + return; +} + } + switch (Type) { case ToolChain::CST_Libcxx: CmdArgs.push_back("-lc++"); if (Args.hasArg(options::OPT_fexperimental_library)) CmdArgs.push_back("-lc++experimental"); CmdArgs.push_back("-lc++abi"); -CmdArgs.push_back("-lunwind"); +if (UNW != ToolChain::UNW_None) + CmdArgs.push_back("-lunwind"); break; case ToolChain::CST_Libstdcxx: diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index fe32638417ea4..edbd333628747 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -119,3 +119,36 @@ // CHECK010: crt1.o // CHECK010: "-L/tmp" // CHECK010-NOT: "-lstandalone" + +// - +// unwindlib +// - +// RUN: %clangxx --unwindlib=none \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK011 %s +// CHECK011: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK011: crt1.o +// CHECK011-NOT: "-lunwind" +// CHECK011-NOT: "-lgcc_eh" +// CHECK012-NOT: "-lgcc_s" + + +// RUN: %clangxx --rtlib=compiler-rt --unwindlib=libunwind \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK012 %s +// RUN: %clangxx \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK012 %s +// CHECK012: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK012: crt1.o +// CHECK012: "-lunwind" +// CHECK012-NOT: "-lgcc_eh" +// CHECK012-NOT: "-lgcc_s" + +// RUN: not %clangxx --rtlib=compiler-rt --unwindlib=libgcc \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK013 %s +// CHECK013: error: unwind library 'libgcc' is not supported by this platform +// CHECK013-NOT: "-lgcc_eh" +// CHECK013-NOT: "-lgcc_s" +// CHECK013-NOT: "-lunwind" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] [hexagon] handle --unwindlib arg (PR #99552)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/99552 >From 4729e43f3904774dbe5a06ed18a12cbddae8db03 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 17 Jul 2024 08:08:30 -0500 Subject: [PATCH] [clang] [hexagon] handle --unwindlib arg Signed-off-by: Brian Cain --- .../clang/Basic/DiagnosticDriverKinds.td | 2 ++ clang/lib/Driver/ToolChains/Hexagon.cpp | 18 -- clang/test/Driver/hexagon-toolchain-linux.c | 33 +++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 359c0de7f811c..2a1f58ade74a2 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -156,6 +156,8 @@ def err_drv_unsupported_rtlib_for_platform : Error< "unsupported runtime library '%0' for platform '%1'">; def err_drv_invalid_unwindlib_name : Error< "invalid unwind library name in argument '%0'">; +def err_drv_unsupported_unwind_for_platform : Error< + "unwind library '%0' is not supported by this platform">; def err_drv_incompatible_unwindlib : Error< "--rtlib=libgcc requires --unwindlib=libgcc">; def err_drv_incompatible_options : Error< diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 12b3b99df7ca1..691d114b7050e 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -366,11 +366,14 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, options::OPT_t, options::OPT_u_Group}); AddLinkerInputs(HTC, Inputs, Args, CmdArgs, JA); +ToolChain::UnwindLibType UNW = HTC.GetUnwindLibType(Args); + if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { if (NeedsSanitizerDeps) { linkSanitizerRuntimeDeps(HTC, Args, CmdArgs); -CmdArgs.push_back("-lunwind"); +if (UNW != ToolChain::UNW_None) + CmdArgs.push_back("-lunwind"); } if (NeedsXRayDeps) linkXRayRuntimeDeps(HTC, Args, CmdArgs); @@ -618,13 +621,24 @@ HexagonToolChain::~HexagonToolChain() {} void HexagonToolChain::AddCXXStdlibLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { CXXStdlibType Type = GetCXXStdlibType(Args); + ToolChain::UnwindLibType UNW = GetUnwindLibType(Args); + if (UNW != ToolChain::UNW_None && UNW != ToolChain::UNW_CompilerRT) { +const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ); +if (A) { + getDriver().Diag(diag::err_drv_unsupported_unwind_for_platform) + << A->getValue(); + return; +} + } + switch (Type) { case ToolChain::CST_Libcxx: CmdArgs.push_back("-lc++"); if (Args.hasArg(options::OPT_fexperimental_library)) CmdArgs.push_back("-lc++experimental"); CmdArgs.push_back("-lc++abi"); -CmdArgs.push_back("-lunwind"); +if (UNW != ToolChain::UNW_None) + CmdArgs.push_back("-lunwind"); break; case ToolChain::CST_Libstdcxx: diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index fe32638417ea4..edbd333628747 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -119,3 +119,36 @@ // CHECK010: crt1.o // CHECK010: "-L/tmp" // CHECK010-NOT: "-lstandalone" + +// - +// unwindlib +// - +// RUN: %clangxx --unwindlib=none \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK011 %s +// CHECK011: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK011: crt1.o +// CHECK011-NOT: "-lunwind" +// CHECK011-NOT: "-lgcc_eh" +// CHECK012-NOT: "-lgcc_s" + + +// RUN: %clangxx --rtlib=compiler-rt --unwindlib=libunwind \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK012 %s +// RUN: %clangxx \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK012 %s +// CHECK012: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK012: crt1.o +// CHECK012: "-lunwind" +// CHECK012-NOT: "-lgcc_eh" +// CHECK012-NOT: "-lgcc_s" + +// RUN: not %clangxx --rtlib=compiler-rt --unwindlib=libgcc \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK013 %s +// CHECK013: error: unwind library 'libgcc' is not supported by this platform +// CHECK013-NOT: "-lgcc_eh" +// CHECK013-NOT: "-lgcc_s" +// CHECK013-NOT: "-lunwind" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] [hexagon] handle --unwindlib arg (PR #99552)
@@ -156,6 +156,8 @@ def err_drv_unsupported_rtlib_for_platform : Error< "unsupported runtime library '%0' for platform '%1'">; def err_drv_invalid_unwindlib_name : Error< "invalid unwind library name in argument '%0'">; +def err_drv_unsupported_unwind_for_platform : Error< + "unwind library '%0' is not supported by this platform">; androm3da wrote: I deliberately changed it because I didn't know how to describe this platform in the `%1`. But yeah I can make it like that and use the triple I guess. https://github.com/llvm/llvm-project/pull/99552 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] [hexagon] handle --unwindlib arg (PR #99552)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/99552 >From c7fae87eadc5931902d8b0adb555f7ce4b0b99c1 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 17 Jul 2024 08:08:30 -0500 Subject: [PATCH] [clang] [hexagon] handle --unwindlib arg Signed-off-by: Brian Cain --- .../clang/Basic/DiagnosticDriverKinds.td | 2 ++ clang/lib/Driver/ToolChains/Hexagon.cpp | 18 -- clang/test/Driver/hexagon-toolchain-linux.c | 33 +++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 359c0de7f811c..c9de06c1f7413 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -156,6 +156,8 @@ def err_drv_unsupported_rtlib_for_platform : Error< "unsupported runtime library '%0' for platform '%1'">; def err_drv_invalid_unwindlib_name : Error< "invalid unwind library name in argument '%0'">; +def err_drv_unsupported_unwind_for_platform : Error< + "unsupported unwind library '%0' for platform '%1'">; def err_drv_incompatible_unwindlib : Error< "--rtlib=libgcc requires --unwindlib=libgcc">; def err_drv_incompatible_options : Error< diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 12b3b99df7ca1..29781399cbab4 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -366,11 +366,14 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, options::OPT_t, options::OPT_u_Group}); AddLinkerInputs(HTC, Inputs, Args, CmdArgs, JA); +ToolChain::UnwindLibType UNW = HTC.GetUnwindLibType(Args); + if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { if (NeedsSanitizerDeps) { linkSanitizerRuntimeDeps(HTC, Args, CmdArgs); -CmdArgs.push_back("-lunwind"); +if (UNW != ToolChain::UNW_None) + CmdArgs.push_back("-lunwind"); } if (NeedsXRayDeps) linkXRayRuntimeDeps(HTC, Args, CmdArgs); @@ -618,13 +621,24 @@ HexagonToolChain::~HexagonToolChain() {} void HexagonToolChain::AddCXXStdlibLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { CXXStdlibType Type = GetCXXStdlibType(Args); + ToolChain::UnwindLibType UNW = GetUnwindLibType(Args); + if (UNW != ToolChain::UNW_None && UNW != ToolChain::UNW_CompilerRT) { +const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ); +if (A) { + getDriver().Diag(diag::err_drv_unsupported_unwind_for_platform) + << A->getValue() << getTriple().normalize(); + return; +} + } + switch (Type) { case ToolChain::CST_Libcxx: CmdArgs.push_back("-lc++"); if (Args.hasArg(options::OPT_fexperimental_library)) CmdArgs.push_back("-lc++experimental"); CmdArgs.push_back("-lc++abi"); -CmdArgs.push_back("-lunwind"); +if (UNW != ToolChain::UNW_None) + CmdArgs.push_back("-lunwind"); break; case ToolChain::CST_Libstdcxx: diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index fe32638417ea4..86cc9a30e932c 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -119,3 +119,36 @@ // CHECK010: crt1.o // CHECK010: "-L/tmp" // CHECK010-NOT: "-lstandalone" + +// - +// unwindlib +// - +// RUN: %clangxx --unwindlib=none \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK011 %s +// CHECK011: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK011: crt1.o +// CHECK011-NOT: "-lunwind" +// CHECK011-NOT: "-lgcc_eh" +// CHECK012-NOT: "-lgcc_s" + + +// RUN: %clangxx --rtlib=compiler-rt --unwindlib=libunwind \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK012 %s +// RUN: %clangxx \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK012 %s +// CHECK012: InstalledDir: [[INSTALLED_DIR:.+]] +// CHECK012: crt1.o +// CHECK012: "-lunwind" +// CHECK012-NOT: "-lgcc_eh" +// CHECK012-NOT: "-lgcc_s" + +// RUN: not %clangxx --rtlib=compiler-rt --unwindlib=libgcc \ +// RUN:--target=hexagon-unknown-linux-musl %s -### 2>&1 \ +// RUN:| FileCheck -check-prefix=CHECK013 %s +// CHECK013: error: unsupported unwind library 'libgcc' for platform 'hexagon-unknown-linux-musl' +// CHECK013-NOT: "-lgcc_eh" +// CHECK013-NOT: "-lgcc_s" +// CHECK013-NOT: "-lunwind" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail
[clang] [clang] [hexagon] handle --unwindlib arg (PR #99552)
https://github.com/androm3da closed https://github.com/llvm/llvm-project/pull/99552 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET hexagon-unknown-linux-musl CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES "libcxx;libcxxabi;libunwind;compiler-rt" CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS ON CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS ON CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL OFF CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS ON CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") androm3da wrote: > I don't think those settings belong in this cache? This comment refers to all five of those? `COMPILER_RT_DEFAULT_TARGET_TRIPLE`, `COMPILER_RT_BUILD_BUILTINS`, `COMPILER_RT_BUILD_SANITIZERS`, `COMPILER_RT_SUPPORTED_ARCH`, `COMPILER_RT_USE_LLVM_UNWINDER`? Of those, `COMPILER_RT_BUILD_BUILTINS`, `COMPILER_RT_BUILD_SANITIZERS` are `option()`s used to control the build scope - those can stay, right? And `COMPILER_RT_USE_LLVM_UNWINDER` - this is an `option()` too. Can't we set this here? `COMPILER_RT_SUPPORTED_ARCH`: this has been removed. `COMPILER_RT_DEFAULT_TARGET_TRIPLE` is still present, but if it's not allowed/expected I will explore removing it. It may be redundant with `LLVM_TARGET_TRIPLE`? https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)
https://github.com/androm3da closed https://github.com/llvm/llvm-project/pull/94877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da created https://github.com/llvm/llvm-project/pull/98712 These can be used to create a fully-bootstrapped toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon >From 3cb0ce53c66815496ac0b5296ee36aaa2f255935 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon Signed-off-by: Brian Cain --- ...xagon-unknown-linux-musl-clang-cross.cmake | 11 .../hexagon-unknown-linux-musl-clang.cmake| 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-runtimes.cmake | 25 +++ 4 files changed, 66 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 0..2df7d8183baa6 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,11 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 0..9f3eb4678fd17 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 0..d9c9ff2a4655e --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/libcxx/cmake/caches/hexagon-linux-runtimes.cmake b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake new file mode 100644 index 0..fc669ecab737e --- /dev/null +++ b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake @@ -0,0 +1,25 @@ + +set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET hexagon-unknown-linux-musl CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES "libcxx;libcxxabi;libunwind;compiler-rt" CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS ON CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS ON CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING ""
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -0,0 +1,62 @@ +//===-- xray_init.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of XRay, a dynamic runtime instrumentation system. +// +// XRay initialisation logic for DSOs. +//===--===// + +#include "sanitizer_common/sanitizer_atomic.h" +#include "xray_defs.h" +#include "xray_flags.h" +#include "xray_interface_internal.h" + +using namespace __sanitizer; + +extern "C" { +extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRaySledEntry __stop_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __start_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __stop_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); androm3da wrote: > With -fxray-enable, are you refering to the general -fxray-instrument flag or > -fxray-enable-shared? Yes, the general flag. > If the main executable was built entirely without -fxray-instrument, linking > the DSO will fail, as the __xray_register_dso and __xray_deregister_dso > functions could not be resolved. Ok, right - that makes sense. > However, this would probably be best as a separate PR. Agreed - if you decide it's appropriate, good for a follow-up. https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
@@ -0,0 +1,62 @@ +//===-- xray_init.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of XRay, a dynamic runtime instrumentation system. +// +// XRay initialisation logic for DSOs. +//===--===// + +#include "sanitizer_common/sanitizer_atomic.h" +#include "xray_defs.h" +#include "xray_flags.h" +#include "xray_interface_internal.h" + +using namespace __sanitizer; + +extern "C" { +extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRaySledEntry __stop_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __start_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __stop_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); + +#if SANITIZER_MAC androm3da wrote: If undefined it defaults to `0`. If that's safe then you can leave it as-is. https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
https://github.com/androm3da approved this pull request. You might want to get approval from someone else - I'm not even remotely close to a maintainer here. https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET hexagon-unknown-linux-musl CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_ENABLE_RUNTIMES "libcxx;libcxxabi;libunwind;compiler-rt" CACHE STRING "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "") +set(LIBCXX_INCLUDE_TESTS ON CACHE BOOL "") +set(LIBCXXABI_INCLUDE_TESTS ON CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL OFF CACHE BOOL "") androm3da wrote: These are overrides that were necessary at one time, perhaps necessary still. Or possibly they're masking a bug somewhere else. Good point - I'll take some time to investigate these and see about omitting them. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + androm3da wrote: IMO landing these cache files are baby steps towards having such a CI job. I'll look into what it would take, yes. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + +set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "") androm3da wrote: I'll double check these too - I recall they were necessary during bootstrapping, but could have been due to driver bugs fixed since we added that. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
androm3da wrote: @ldionne ping https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 543a9ad - [xray] add support for hexagon
Author: Brian Cain Date: 2021-12-09T05:47:53-08:00 New Revision: 543a9ad7c460bb8d641b1b7c67bbc032c9bfdb45 URL: https://github.com/llvm/llvm-project/commit/543a9ad7c460bb8d641b1b7c67bbc032c9bfdb45 DIFF: https://github.com/llvm/llvm-project/commit/543a9ad7c460bb8d641b1b7c67bbc032c9bfdb45.diff LOG: [xray] add support for hexagon Adds x-ray support for hexagon to llvm codegen, clang driver, compiler-rt libs. Differential Revision: https://reviews.llvm.org/D113638 Added: compiler-rt/lib/xray/xray_hexagon.cpp compiler-rt/lib/xray/xray_trampoline_hexagon.S llvm/test/CodeGen/Hexagon/xray-pred-ret.ll llvm/test/CodeGen/Hexagon/xray.ll Modified: clang/lib/Driver/ToolChains/Hexagon.cpp clang/lib/Driver/XRayArgs.cpp compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake compiler-rt/lib/xray/CMakeLists.txt compiler-rt/lib/xray/xray_interface.cpp compiler-rt/lib/xray/xray_tsc.h llvm/lib/CodeGen/XRayInstrumentation.cpp llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp llvm/lib/Target/Hexagon/HexagonAsmPrinter.h llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp llvm/lib/Target/Hexagon/HexagonInstrInfo.h llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp llvm/lib/Target/Hexagon/HexagonSubtarget.h llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 18270818d1589..2ce7904ecc40d 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -226,6 +226,7 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); bool NeedsSanitizerDeps = addSanitizerRuntimes(HTC, Args, CmdArgs); + bool NeedsXRayDeps = addXRayRuntime(HTC, Args, CmdArgs); // // Silence warnings for various options @@ -297,6 +298,8 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lunwind"); } + if (NeedsXRayDeps) +linkXRayRuntimeDeps(HTC, CmdArgs); CmdArgs.push_back("-lclang_rt.builtins-hexagon"); CmdArgs.push_back("-lc"); diff --git a/clang/lib/Driver/XRayArgs.cpp b/clang/lib/Driver/XRayArgs.cpp index b44509ad3b881..63b575178bd12 100644 --- a/clang/lib/Driver/XRayArgs.cpp +++ b/clang/lib/Driver/XRayArgs.cpp @@ -40,6 +40,7 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) { case llvm::Triple::x86_64: case llvm::Triple::arm: case llvm::Triple::aarch64: +case llvm::Triple::hexagon: case llvm::Triple::ppc64le: case llvm::Triple::mips: case llvm::Triple::mipsel: diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake index 45226b4158d74..3e86cf63c789b 100644 --- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake @@ -73,7 +73,8 @@ set(ALL_SCUDO_STANDALONE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} if(APPLE) set(ALL_XRAY_SUPPORTED_ARCH ${X86_64}) else() -set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} powerpc64le) +set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} + powerpc64le ${HEXAGON}) endif() set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64}) diff --git a/compiler-rt/lib/xray/CMakeLists.txt b/compiler-rt/lib/xray/CMakeLists.txt index 204e5b17c7970..ca9389747a5ee 100644 --- a/compiler-rt/lib/xray/CMakeLists.txt +++ b/compiler-rt/lib/xray/CMakeLists.txt @@ -73,6 +73,11 @@ set(powerpc64le_SOURCES xray_trampoline_powerpc64_asm.S ) +set(hexagon_SOURCES + xray_hexagon.cpp + xray_trampoline_hexagon.S + ) + set(XRAY_IMPL_HEADERS xray_allocator.h xray_basic_flags.h @@ -111,6 +116,7 @@ set(XRAY_ALL_SOURCE_FILES ${x86_64_SOURCES} ${arm_SOURCES} ${armhf_SOURCES} + ${hexagon_SOURCES} ${mips_SOURCES} ${mipsel_SOURCES} ${mips64_SOURCES} diff --git a/compiler-rt/lib/xray/xray_hexagon.cpp b/compiler-rt/lib/xray/xray_hexagon.cpp new file mode 100644 index 0..7f127b2b499cd --- /dev/null +++ b/compiler-rt/lib/xray/xray_hexagon.cpp @@ -0,0 +1,168 @@ +//===-- xray_hexagon.cpp --*- C++ ---*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of XRay, a dynamic runtime instrumentation system. +// +// Implementation of hexagon-specific routines (32-bit). +// +//===
[clang] ab28cb1 - Revert "[xray] add support for hexagon"
Author: Brian Cain Date: 2021-12-09T07:30:40-08:00 New Revision: ab28cb1c5c4dc7181fae3d47f0601982996739db URL: https://github.com/llvm/llvm-project/commit/ab28cb1c5c4dc7181fae3d47f0601982996739db DIFF: https://github.com/llvm/llvm-project/commit/ab28cb1c5c4dc7181fae3d47f0601982996739db.diff LOG: Revert "[xray] add support for hexagon" This reverts commit 543a9ad7c460bb8d641b1b7c67bbc032c9bfdb45. Added: Modified: clang/lib/Driver/ToolChains/Hexagon.cpp clang/lib/Driver/XRayArgs.cpp compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake compiler-rt/lib/xray/CMakeLists.txt compiler-rt/lib/xray/xray_interface.cpp compiler-rt/lib/xray/xray_tsc.h llvm/lib/CodeGen/XRayInstrumentation.cpp llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp llvm/lib/Target/Hexagon/HexagonAsmPrinter.h llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp llvm/lib/Target/Hexagon/HexagonInstrInfo.h llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp llvm/lib/Target/Hexagon/HexagonSubtarget.h llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp Removed: compiler-rt/lib/xray/xray_hexagon.cpp compiler-rt/lib/xray/xray_trampoline_hexagon.S llvm/test/CodeGen/Hexagon/xray-pred-ret.ll llvm/test/CodeGen/Hexagon/xray.ll diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 2ce7904ecc40d..18270818d1589 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -226,7 +226,6 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); bool NeedsSanitizerDeps = addSanitizerRuntimes(HTC, Args, CmdArgs); - bool NeedsXRayDeps = addXRayRuntime(HTC, Args, CmdArgs); // // Silence warnings for various options @@ -298,8 +297,6 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lunwind"); } - if (NeedsXRayDeps) -linkXRayRuntimeDeps(HTC, CmdArgs); CmdArgs.push_back("-lclang_rt.builtins-hexagon"); CmdArgs.push_back("-lc"); diff --git a/clang/lib/Driver/XRayArgs.cpp b/clang/lib/Driver/XRayArgs.cpp index 63b575178bd12..b44509ad3b881 100644 --- a/clang/lib/Driver/XRayArgs.cpp +++ b/clang/lib/Driver/XRayArgs.cpp @@ -40,7 +40,6 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) { case llvm::Triple::x86_64: case llvm::Triple::arm: case llvm::Triple::aarch64: -case llvm::Triple::hexagon: case llvm::Triple::ppc64le: case llvm::Triple::mips: case llvm::Triple::mipsel: diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake index 3e86cf63c789b..45226b4158d74 100644 --- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake @@ -73,8 +73,7 @@ set(ALL_SCUDO_STANDALONE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} if(APPLE) set(ALL_XRAY_SUPPORTED_ARCH ${X86_64}) else() -set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} - powerpc64le ${HEXAGON}) +set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} powerpc64le) endif() set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64}) diff --git a/compiler-rt/lib/xray/CMakeLists.txt b/compiler-rt/lib/xray/CMakeLists.txt index ca9389747a5ee..204e5b17c7970 100644 --- a/compiler-rt/lib/xray/CMakeLists.txt +++ b/compiler-rt/lib/xray/CMakeLists.txt @@ -73,11 +73,6 @@ set(powerpc64le_SOURCES xray_trampoline_powerpc64_asm.S ) -set(hexagon_SOURCES - xray_hexagon.cpp - xray_trampoline_hexagon.S - ) - set(XRAY_IMPL_HEADERS xray_allocator.h xray_basic_flags.h @@ -116,7 +111,6 @@ set(XRAY_ALL_SOURCE_FILES ${x86_64_SOURCES} ${arm_SOURCES} ${armhf_SOURCES} - ${hexagon_SOURCES} ${mips_SOURCES} ${mipsel_SOURCES} ${mips64_SOURCES} diff --git a/compiler-rt/lib/xray/xray_hexagon.cpp b/compiler-rt/lib/xray/xray_hexagon.cpp deleted file mode 100644 index 7f127b2b499cd..0 --- a/compiler-rt/lib/xray/xray_hexagon.cpp +++ /dev/null @@ -1,168 +0,0 @@ -//===-- xray_hexagon.cpp --*- C++ ---*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===--===// -// -// This file is a part of XRay, a dynamic runtime instrumentation system. -// -// Implementation of hexagon-specific routines (32-bit). -// -//===--===// -#include "sanitizer_common/saniti
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
androm3da wrote: > @ldionne ping @ldionne let me know if it would be helpful for me to decompose this change into a smaller one that would be easier to review. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
androm3da wrote: > @androm3da @MaskRay I'm tagging you because I'm having trouble to get > feedback to this PR, and you seem to be the most recent contributors to XRay. > Would one of you be willing to review it? Any other pointers on who to get in > touch with are also much appreciated. I'm happy to take a look - but I'm traveling this week and won't be able to until this weekend. https://github.com/llvm/llvm-project/pull/90959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
androm3da wrote: @ldionne I think you'll be satisfied with the changes I've made. Previously I didn't think your feedback made sense, but I've come around 😉 https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From 3d8388d723b3c5dc3d51a6d3e80051dfe7da8a4c Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped cross-toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon --- .../hexagon-unknown-linux-musl-clang-cross.cmake | 15 +++ .../caches/hexagon-unknown-linux-musl-clang.cmake | 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-clangrt.cmake | 14 ++ libcxx/cmake/caches/hexagon-linux-runtimes.cmake | 15 +++ 5 files changed, 74 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 00..91bbe26b621054 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,15 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-linux-musl-clang++ +hexagon-linux-musl-clang +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-none-elf-clang++ +hexagon-none-elf-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 00..9f3eb4678fd17b --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 00..d9c9ff2a4655ee --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake new file mode 100644 index 00..baf149306f91bb --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake @@ -0,0 +1,14 @@ + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") + +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") + +# Some build failures here, including the inline asm in +# `compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h`, so +# we can just disable these for now: +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
@@ -0,0 +1,25 @@ + androm3da wrote: Absolutely. That's been the status quo and this PR on its own can't change that. The intent of this pull req is to allow anyone to build a toolchain for targeting hexagon (of which libc++, libc++abi, libunwind are a part). But another benefit can be that we should be able to setup CI job(s) leveraging this, indeed. We can enable regression tests for the entire toolchain including compiler, linker *and* target libraries. https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
androm3da wrote: @ldionne please take a look when you get a chance. Thanks! https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From 8fab99299900ef7312dc0503d829bae99d67cd60 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped cross-toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon --- .../hexagon-unknown-linux-musl-clang-cross.cmake | 15 +++ .../caches/hexagon-unknown-linux-musl-clang.cmake | 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-clangrt.cmake | 14 ++ libcxx/cmake/caches/hexagon-linux-runtimes.cmake | 15 +++ 5 files changed, 74 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 00..91bbe26b621054 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,15 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-linux-musl-clang++ +hexagon-linux-musl-clang +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-none-elf-clang++ +hexagon-none-elf-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 00..9f3eb4678fd17b --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 00..d9c9ff2a4655ee --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake new file mode 100644 index 00..baf149306f91bb --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake @@ -0,0 +1,14 @@ + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") + +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") + +# Some build failures here, including the inline asm in +# `compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h`, so +# we can just disable these for now: +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/98712 >From 62c2ffac958ee5a235db254ad001875bb2980c1b Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 12 Jul 2024 21:34:56 -0700 Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files These can be used to create a fully-bootstrapped cross-toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon --- .../hexagon-unknown-linux-musl-clang-cross.cmake | 15 +++ .../caches/hexagon-unknown-linux-musl-clang.cmake | 15 +++ .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++ .../cmake/caches/hexagon-linux-clangrt.cmake | 14 ++ libcxx/cmake/caches/hexagon-linux-runtimes.cmake | 15 +++ 5 files changed, 74 insertions(+) create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake create mode 100644 compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake new file mode 100644 index 00..91bbe26b621054 --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake @@ -0,0 +1,15 @@ +# This file is for the llvm+clang options that are specific to building +# a cross-toolchain targeting hexagon linux. +set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") +set(CLANG_LINKS_TO_CREATE +hexagon-linux-musl-clang++ +hexagon-linux-musl-clang +hexagon-unknown-linux-musl-clang++ +hexagon-unknown-linux-musl-clang +hexagon-none-elf-clang++ +hexagon-none-elf-clang +hexagon-unknown-none-elf-clang++ +hexagon-unknown-none-elf-clang +CACHE STRING "") + +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake new file mode 100644 index 00..9f3eb4678fd17b --- /dev/null +++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake @@ -0,0 +1,15 @@ + +set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") +set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") +set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") +set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") +set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") + +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +# Enabling toolchain-only causes problems when doing some of the +# subsequent builds, will need to investigate: +set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake new file mode 100644 index 00..d9c9ff2a4655ee --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake @@ -0,0 +1,15 @@ +set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "") + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") +set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") +set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "") +set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "") diff --git a/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake new file mode 100644 index 00..baf149306f91bb --- /dev/null +++ b/compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake @@ -0,0 +1,14 @@ + +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "") +set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "") + +set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") + +# Some build failures here, including the inline asm in +# `compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h`, so +# we can just disable these for now: +set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") +set(COMPILER_RT
[clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)
https://github.com/androm3da closed https://github.com/llvm/llvm-project/pull/98712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] hexagon: fix link order for libc/builtins (PR #117057)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/117057 >From 8ec280dc6c15d7279afe332615497704739aee63 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 20 Nov 2024 13:23:39 -0800 Subject: [PATCH] [clang] hexagon: fix link order for libc/builtins When linking programs with eld, we get a link error like below: Error: /inst/clang+llvm-19.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/libc.a(scalbn.lo)(.text.scalbn+0x3c): undefined reference to `__hexagon_muldf3' libc has references to the clang_rt builtins library, so the order of the libraries should be reversed. --- clang/lib/Driver/ToolChains/Hexagon.cpp | 2 +- clang/test/Driver/hexagon-toolchain-linux.c | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 29781399cbab44..383dc8387e75e7 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -378,9 +378,9 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, if (NeedsXRayDeps) linkXRayRuntimeDeps(HTC, Args, CmdArgs); - CmdArgs.push_back("-lclang_rt.builtins-hexagon"); if (!Args.hasArg(options::OPT_nolibc)) CmdArgs.push_back("-lc"); + CmdArgs.push_back("-lclang_rt.builtins-hexagon"); } if (D.CCCIsCXX()) { if (HTC.ShouldLinkCXXStdlib(Args)) diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index 86cc9a30e932c6..6f7f3b20f9141f 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -11,7 +11,7 @@ // CHECK000-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o // CHECK000: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK000: "{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o" -// CHECK000: "-lclang_rt.builtins-hexagon" "-lc" +// CHECK000: "-lc" "-lclang_rt.builtins-hexagon" // - // Passing --musl --shared // - @@ -21,7 +21,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -shared %s 2>&1 | FileCheck -check-prefix=CHECK001 %s // CHECK001-NOT:-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1 // CHECK001: "{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o" -// CHECK001:"-lclang_rt.builtins-hexagon" "-lc" +// CHECK001:"-lc" "-lclang_rt.builtins-hexagon" // CHECK001-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o // - // Passing --musl -nostdlib @@ -33,8 +33,8 @@ // CHECK002: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o -// CHECK002-NOT: "-lclang_rt.builtins-hexagon" // CHECK002-NOT: "-lc" +// CHECK002-NOT: "-lclang_rt.builtins-hexagon" // - // Passing --musl -nostartfiles // - @@ -45,7 +45,7 @@ // CHECK003: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}Scrt1.o // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o -// CHECK003: "-lclang_rt.builtins-hexagon" "-lc" +// CHECK003: "-lc" "-lclang_rt.builtins-hexagon" // - // Passing --musl -nodefaultlibs // - @@ -55,8 +55,8 @@ // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=CHECK004 %s // CHECK004: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK004: "{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o" -// CHECK004-NOT: "-lclang_rt.builtins-hexagon" // CHECK004-NOT: "-lc" +// CHECK004-NOT: "-lclang_rt.builtins-hexagon" // - // Passing --musl -nolibc // - ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] hexagon: fix link order for libc/builtins (PR #117057)
https://github.com/androm3da closed https://github.com/llvm/llvm-project/pull/117057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] recognize any *-ld.lld variant (PR #117338)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/117338 >From 6f5c0375547337afbaa9b3f2446be6bbe79b4300 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Thu, 21 Nov 2024 19:46:04 -0800 Subject: [PATCH] [clang] recognize any *-ld.lld variant If we create a cross toolchain with a ${triple}-ld.lld symlink, clang finds that symlink and when it uses it, it's not recognized as "lld". Let's resolve that symlink and consider it when determining lld-ness. For example, clang provides hexagon-link specific link arguments such as `-mcpu=hexagonv65` and `-march=hexagon` when hexagon-unknown-linux-musl-ld.lld is found. lld rejects this with the following error: hexagon-unknown-linux-musl-ld.lld: error: unknown emulation: cpu=hexagonv65 --- clang/lib/Driver/ToolChain.cpp | 20 +--- clang/lib/Driver/ToolChains/Hexagon.cpp | 7 --- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 0d426a467e9a3b..387d0d690f89ff 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -964,7 +964,7 @@ std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const { StringRef UseLinker = A ? A->getValue() : CLANG_DEFAULT_LINKER; // --ld-path= takes precedence over -fuse-ld= and specifies the executable - // name. -B, COMPILER_PATH and PATH and consulted if the value does not + // name. -B, COMPILER_PATH and PATH are consulted if the value does not // contain a path component separator. // -fuse-ld=lld can be used with --ld-path= to inform clang that the binary // that --ld-path= points to is lld. @@ -974,8 +974,15 @@ std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const { if (llvm::sys::path::parent_path(Path).empty()) Path = GetProgramPath(A->getValue()); if (llvm::sys::fs::can_execute(Path)) { -if (LinkerIsLLD) +SmallString<1024> RealPath; +if (LinkerIsLLD) { *LinkerIsLLD = UseLinker == "lld"; + if (!*LinkerIsLLD) +if (llvm::sys::fs::real_path(Path, RealPath)) { + RealPath = llvm::sys::path::stem(RealPath); + *LinkerIsLLD = RealPath == "lld"; +} +} return std::string(Path); } } @@ -1014,8 +1021,15 @@ std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const { std::string LinkerPath(GetProgramPath(LinkerName.c_str())); if (llvm::sys::fs::can_execute(LinkerPath)) { - if (LinkerIsLLD) + SmallString<1024> RealPath; + if (LinkerIsLLD) { *LinkerIsLLD = UseLinker == "lld"; +if (!*LinkerIsLLD) + if (llvm::sys::fs::real_path(LinkerPath, RealPath)) { +RealPath = llvm::sys::path::stem(RealPath); +*LinkerIsLLD = RealPath == "lld"; + } + } return LinkerPath; } } diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 29781399cbab44..bd635573376967 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -294,9 +294,10 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles); bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs); bool UseG0 = false; - const char *Exec = Args.MakeArgString(HTC.GetLinkerPath()); - bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") || - llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")); + bool UseLLD = false; + const char *Exec = Args.MakeArgString(HTC.GetLinkerPath(&UseLLD)); + UseLLD = UseLLD || llvm::sys::path::filename(Exec) == "ld.lld" || + llvm::sys::path::stem(Exec) == "ld.lld"; bool UseShared = IsShared && !IsStatic; StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] recognize any *-ld.lld variant (PR #117338)
@@ -0,0 +1,80 @@ +if (NOT DEFINED LLVM_PATH) androm3da wrote: That was a careless mistake, failed to keep different development branches separate. Fixed. https://github.com/llvm/llvm-project/pull/117338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [libunwind] [llvm] [clang] recognize any *-ld.lld variant (PR #117338)
@@ -0,0 +1,80 @@ +if (NOT DEFINED LLVM_PATH) androm3da wrote: ugh! sorry, this was unintentional. I'll fix it. https://github.com/llvm/llvm-project/pull/117338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] hexagon: fix link order for libc/builtins (PR #117057)
https://github.com/androm3da created https://github.com/llvm/llvm-project/pull/117057 When linking programs with qcld, we get a link error like below: Error: /inst/clang+llvm-19.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/libc.a(scalbn.lo)(.text.scalbn+0x3c): undefined reference to `__hexagon_muldf3' libc has references to the clang_rt builtins library, so the order of the libraries should be reversed. >From 8160738a7cce18bcc10ff25ccf670a8808c67467 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 20 Nov 2024 13:23:39 -0800 Subject: [PATCH] [clang] hexagon: fix link order for libc/builtins When linking programs with qcld, we get a link error like below: Error: /inst/clang+llvm-19.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/libc.a(scalbn.lo)(.text.scalbn+0x3c): undefined reference to `__hexagon_muldf3' libc has references to the clang_rt builtins library, so the order of the libraries should be reversed. --- clang/lib/Driver/ToolChains/Hexagon.cpp | 2 +- clang/test/Driver/hexagon-toolchain-linux.c | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 29781399cbab44..383dc8387e75e7 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -378,9 +378,9 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, if (NeedsXRayDeps) linkXRayRuntimeDeps(HTC, Args, CmdArgs); - CmdArgs.push_back("-lclang_rt.builtins-hexagon"); if (!Args.hasArg(options::OPT_nolibc)) CmdArgs.push_back("-lc"); + CmdArgs.push_back("-lclang_rt.builtins-hexagon"); } if (D.CCCIsCXX()) { if (HTC.ShouldLinkCXXStdlib(Args)) diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index 86cc9a30e932c6..6f7f3b20f9141f 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -11,7 +11,7 @@ // CHECK000-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o // CHECK000: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK000: "{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o" -// CHECK000: "-lclang_rt.builtins-hexagon" "-lc" +// CHECK000: "-lc" "-lclang_rt.builtins-hexagon" // - // Passing --musl --shared // - @@ -21,7 +21,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -shared %s 2>&1 | FileCheck -check-prefix=CHECK001 %s // CHECK001-NOT:-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1 // CHECK001: "{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o" -// CHECK001:"-lclang_rt.builtins-hexagon" "-lc" +// CHECK001:"-lc" "-lclang_rt.builtins-hexagon" // CHECK001-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o // - // Passing --musl -nostdlib @@ -33,8 +33,8 @@ // CHECK002: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o -// CHECK002-NOT: "-lclang_rt.builtins-hexagon" // CHECK002-NOT: "-lc" +// CHECK002-NOT: "-lclang_rt.builtins-hexagon" // - // Passing --musl -nostartfiles // - @@ -45,7 +45,7 @@ // CHECK003: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}Scrt1.o // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o -// CHECK003: "-lclang_rt.builtins-hexagon" "-lc" +// CHECK003: "-lc" "-lclang_rt.builtins-hexagon" // - // Passing --musl -nodefaultlibs // - @@ -55,8 +55,8 @@ // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=CHECK004 %s // CHECK004: "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1" // CHECK004: "{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o" -// CHECK004-NOT: "-lclang_rt.builtins-hexagon" // CHECK004-NOT: "-lc" +// CHECK004-NOT: "-lclang_rt.builtins-h
[clang] [clang] recognize any *-ld.lld variant (PR #117338)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/117338 >From 607746891ed8683262c468be8d2848c7ad88b320 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Thu, 21 Nov 2024 19:46:04 -0800 Subject: [PATCH] [clang] recognize hexagon-*-ld.lld variants If we create a cross toolchain with a ${triple}-ld.lld symlink, clang finds that symlink and when it uses it, it's not recognized as "lld". Let's resolve that symlink and consider it when determining lld-ness. For example, clang provides hexagon-link specific link arguments such as `-mcpu=hexagonv65` and `-march=hexagon` when hexagon-unknown-linux-musl-ld.lld is found. lld rejects this with the following error: hexagon-unknown-linux-musl-ld.lld: error: unknown emulation: cpu=hexagonv65 --- clang/lib/Driver/ToolChains/Hexagon.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 29781399cbab44..829703d25b1516 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -294,9 +294,10 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles); bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs); bool UseG0 = false; - const char *Exec = Args.MakeArgString(HTC.GetLinkerPath()); - bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") || - llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")); + bool UseLLD = false; + const char *Exec = Args.MakeArgString(HTC.GetLinkerPath(&UseLLD)); + UseLLD = UseLLD || llvm::sys::path::filename(Exec).endswith("ld.lld") || + llvm::sys::path::stem(Exec).endswith("ld.lld"); bool UseShared = IsShared && !IsStatic; StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] recognize hexagon-*-ld.lld variants (PR #117338)
https://github.com/androm3da edited https://github.com/llvm/llvm-project/pull/117338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] recognize hexagon-*-ld.lld variants (PR #117338)
androm3da wrote: > I am still not sure about this change. > > I think this common utility is only to make `-fuse-ld=lld` recognize > LinkerIsLLD. Toolchains/Hexagon.cpp detects ld.lld and you can make the > change there? Okay - the scope is now reduced to `Toolchains/Hexagon.cpp` only. https://github.com/llvm/llvm-project/pull/117338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] recognize hexagon-*-ld.lld variants (PR #117338)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/117338 >From fa2c015073b1afa282d76c2c2b462fb84feeb688 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Thu, 21 Nov 2024 19:46:04 -0800 Subject: [PATCH] [clang] recognize hexagon-*-ld.lld variants If we create a cross toolchain with a ${triple}-ld.lld symlink, clang finds that symlink and when it uses it, it's not recognized as "lld". Let's consider it as lld as long as it ends in "ld.lld". For example, clang provides hexagon-link specific link arguments such as `-mcpu=hexagonv65` and `-march=hexagon` when hexagon-unknown-linux-musl-ld.lld is found. lld rejects this with the following error: hexagon-unknown-linux-musl-ld.lld: error: unknown emulation: cpu=hexagonv65 --- clang/lib/Driver/ToolChains/Hexagon.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 29781399cbab44..be7851adecea66 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -294,9 +294,10 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles); bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs); bool UseG0 = false; - const char *Exec = Args.MakeArgString(HTC.GetLinkerPath()); - bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") || - llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")); + bool UseLLD = false; + const char *Exec = Args.MakeArgString(HTC.GetLinkerPath(&UseLLD)); + UseLLD = UseLLD || llvm::sys::path::filename(Exec).ends_with("ld.lld") || + llvm::sys::path::stem(Exec).ends_with("ld.lld"); bool UseShared = IsShared && !IsStatic; StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] recognize hexagon-*-ld.lld variants (PR #117338)
https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/117338 >From af213f3a80964faa3b80c95f8575a08c3dbd18c8 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Thu, 21 Nov 2024 19:46:04 -0800 Subject: [PATCH] [clang] recognize hexagon-*-ld.lld variants If we create a cross toolchain with a ${triple}-ld.lld symlink, clang finds that symlink and when it uses it, it's not recognized as "lld". Let's consider it as lld as long as it ends in "ld.lld". For example, clang provides hexagon-link specific link arguments such as `-mcpu=hexagonv65` and `-march=hexagon` when hexagon-unknown-linux-musl-ld.lld is found. lld rejects this with the following error: hexagon-unknown-linux-musl-ld.lld: error: unknown emulation: cpu=hexagonv65 --- clang/lib/Driver/ToolChains/Hexagon.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 29781399cbab44..829703d25b1516 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -294,9 +294,10 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles); bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs); bool UseG0 = false; - const char *Exec = Args.MakeArgString(HTC.GetLinkerPath()); - bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") || - llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")); + bool UseLLD = false; + const char *Exec = Args.MakeArgString(HTC.GetLinkerPath(&UseLLD)); + UseLLD = UseLLD || llvm::sys::path::filename(Exec).endswith("ld.lld") || + llvm::sys::path::stem(Exec).endswith("ld.lld"); bool UseShared = IsShared && !IsStatic; StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] recognize hexagon-*-ld.lld variants (PR #117338)
https://github.com/androm3da closed https://github.com/llvm/llvm-project/pull/117338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] hexagon: fix link order for libc/builtins (PR #117057)
https://github.com/androm3da edited https://github.com/llvm/llvm-project/pull/117057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Switch builtin strings to use string tables (PR #118734)
androm3da wrote: cc @llvm/pr-subscribers-backend-hexagon and @iajbar https://github.com/llvm/llvm-project/pull/118734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [Hexagon] Set the default compilation target to V68 (PR #125239)
androm3da wrote: > Done. Thanks Brian. Are you sure the release notes change has landed? I don't see a commit on `main` with it yet. https://github.com/llvm/llvm-project/blob/main/llvm/docs/ReleaseNotes.md#changes-to-the-hexagon-backend Is there a pull req open for this change? https://github.com/llvm/llvm-project/pull/125239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits