[llvm-branch-commits] [libcxx] [libc++][chrono] Completes the tzdb class. (PR #82157)
https://github.com/mordante created https://github.com/llvm/llvm-project/pull/82157 It adds the missing member functions of the tzdb class and adds the free functions that use these member functions. Implements parts of: - P0355 Extending to Calendars and Time Zones >From fa05466984bcd3a73a81994e352892fd609effbf Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Fri, 23 Sep 2022 18:33:20 +0200 Subject: [PATCH] [libc++][chrono] Completes the tzdb class. It adds the missing member functions of the tzdb class and adds the free functions that use these member functions. Implements parts of: - P0355 Extending to Calendars and Time Zones --- libcxx/include/__chrono/tzdb.h| 35 libcxx/include/__chrono/tzdb_list.h | 10 +++ libcxx/include/chrono | 5 ++ libcxx/modules/std/chrono.inc | 4 +- libcxx/src/tzdb.cpp | 59 ++ ...rono.nodiscard_extensions.compile.pass.cpp | 8 ++ .../chrono.nodiscard_extensions.verify.cpp| 8 ++ .../time.zone.db.access/current_zone.pass.cpp | 77 ++ .../time.zone.db.access/locate_zone.pass.cpp | 62 +++ .../time.zone.db.tzdb/current_zone.pass.cpp | 79 +++ .../time.zone.db.tzdb/locate_zone.pass.cpp| 64 +++ 11 files changed, 409 insertions(+), 2 deletions(-) create mode 100644 libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/current_zone.pass.cpp create mode 100644 libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/locate_zone.pass.cpp create mode 100644 libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.tzdb/current_zone.pass.cpp create mode 100644 libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.tzdb/locate_zone.pass.cpp diff --git a/libcxx/include/__chrono/tzdb.h b/libcxx/include/__chrono/tzdb.h index 45c20f279f9c96..667d2406645658 100644 --- a/libcxx/include/__chrono/tzdb.h +++ b/libcxx/include/__chrono/tzdb.h @@ -16,6 +16,7 @@ // Enable the contents of the header only when libc++ was built with experimental features enabled. #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) +# include <__algorithm/ranges_lower_bound.h> # include <__chrono/leap_second.h> # include <__chrono/time_zone.h> # include <__chrono/time_zone_link.h> @@ -43,6 +44,40 @@ struct tzdb { vector links; vector leap_seconds; + + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const time_zone* __locate_zone(string_view __name) const { +if (const time_zone* __result = __find_in_zone(__name); __result) + return __result; + +if (auto __it = ranges::lower_bound(links, __name, {}, &time_zone_link::name); +__it != links.end() && __it->name() == __name) + if (const time_zone* __result = __find_in_zone(__it->target()); __result) +return __result; + +return nullptr; + } + + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI const time_zone* locate_zone(string_view __name) const { +if (const time_zone* __result = __locate_zone(__name)) + return __result; + +std::__throw_runtime_error("tzdb: requested time zone not found"); + } + + _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI const time_zone* current_zone() const { +return __current_zone(); + } + +private: + _LIBCPP_HIDE_FROM_ABI const time_zone* __find_in_zone(string_view __name) const noexcept { +if (auto __it = ranges::lower_bound(zones, __name, {}, &time_zone::name); +__it != zones.end() && __it->name() == __name) + return std::addressof(*__it); + +return nullptr; + } + + [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const time_zone* __current_zone() const; }; } // namespace chrono diff --git a/libcxx/include/__chrono/tzdb_list.h b/libcxx/include/__chrono/tzdb_list.h index 112e04ff2ee6ac..d812312287f16e 100644 --- a/libcxx/include/__chrono/tzdb_list.h +++ b/libcxx/include/__chrono/tzdb_list.h @@ -17,6 +17,7 @@ #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) # include <__availability> +# include <__chrono/time_zone.h> # include <__chrono/tzdb.h> # include <__config> # include <__fwd/string.h> @@ -74,6 +75,15 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline con return get_tzdb_list().front(); } +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* +locate_zone(string_view __name) { + return get_tzdb().locate_zone(__name); +} + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* current_zone() { + return get_tzdb().current_zone(); +} + _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb(); _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version(); diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 01ba15d97f3d20..e115e7a3831339 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono
[llvm-branch-commits] [libcxx] [libc++][chrono] Completes the tzdb class. (PR #82157)
llvmbot wrote: @llvm/pr-subscribers-libcxx Author: Mark de Wever (mordante) Changes It adds the missing member functions of the tzdb class and adds the free functions that use these member functions. Implements parts of: - P0355 Extendingto Calendars and Time Zones --- Full diff: https://github.com/llvm/llvm-project/pull/82157.diff 11 Files Affected: - (modified) libcxx/include/__chrono/tzdb.h (+35) - (modified) libcxx/include/__chrono/tzdb_list.h (+10) - (modified) libcxx/include/chrono (+5) - (modified) libcxx/modules/std/chrono.inc (+2-2) - (modified) libcxx/src/tzdb.cpp (+59) - (modified) libcxx/test/libcxx/diagnostics/chrono.nodiscard_extensions.compile.pass.cpp (+8) - (modified) libcxx/test/libcxx/diagnostics/chrono.nodiscard_extensions.verify.cpp (+8) - (added) libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/current_zone.pass.cpp (+77) - (added) libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/locate_zone.pass.cpp (+62) - (added) libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.tzdb/current_zone.pass.cpp (+79) - (added) libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.tzdb/locate_zone.pass.cpp (+64) ``diff diff --git a/libcxx/include/__chrono/tzdb.h b/libcxx/include/__chrono/tzdb.h index 45c20f279f9c96..667d2406645658 100644 --- a/libcxx/include/__chrono/tzdb.h +++ b/libcxx/include/__chrono/tzdb.h @@ -16,6 +16,7 @@ // Enable the contents of the header only when libc++ was built with experimental features enabled. #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) +# include <__algorithm/ranges_lower_bound.h> # include <__chrono/leap_second.h> # include <__chrono/time_zone.h> # include <__chrono/time_zone_link.h> @@ -43,6 +44,40 @@ struct tzdb { vector links; vector leap_seconds; + + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const time_zone* __locate_zone(string_view __name) const { +if (const time_zone* __result = __find_in_zone(__name); __result) + return __result; + +if (auto __it = ranges::lower_bound(links, __name, {}, &time_zone_link::name); +__it != links.end() && __it->name() == __name) + if (const time_zone* __result = __find_in_zone(__it->target()); __result) +return __result; + +return nullptr; + } + + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI const time_zone* locate_zone(string_view __name) const { +if (const time_zone* __result = __locate_zone(__name)) + return __result; + +std::__throw_runtime_error("tzdb: requested time zone not found"); + } + + _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI const time_zone* current_zone() const { +return __current_zone(); + } + +private: + _LIBCPP_HIDE_FROM_ABI const time_zone* __find_in_zone(string_view __name) const noexcept { +if (auto __it = ranges::lower_bound(zones, __name, {}, &time_zone::name); +__it != zones.end() && __it->name() == __name) + return std::addressof(*__it); + +return nullptr; + } + + [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const time_zone* __current_zone() const; }; } // namespace chrono diff --git a/libcxx/include/__chrono/tzdb_list.h b/libcxx/include/__chrono/tzdb_list.h index 112e04ff2ee6ac..d812312287f16e 100644 --- a/libcxx/include/__chrono/tzdb_list.h +++ b/libcxx/include/__chrono/tzdb_list.h @@ -17,6 +17,7 @@ #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB) # include <__availability> +# include <__chrono/time_zone.h> # include <__chrono/tzdb.h> # include <__config> # include <__fwd/string.h> @@ -74,6 +75,15 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline con return get_tzdb_list().front(); } +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* +locate_zone(string_view __name) { + return get_tzdb().locate_zone(__name); +} + +_LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* current_zone() { + return get_tzdb().current_zone(); +} + _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb(); _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version(); diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 01ba15d97f3d20..e115e7a3831339 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -689,6 +689,9 @@ struct tzdb { vector zones; vector links; vectorleap_seconds; + + const time_zone* locate_zone(string_view tz_name) const; + const time_zone* current_zone() const; }; class tzdb_list { // C++20 @@ -714,6 +717,8 @@ public: // [time.zone.db.access], time zone database access const tzdb& get_tzdb(); // C++20 tzdb_list& get_tzdb_list(); // C++20 +const time
[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/82187 Linux kernel fs/binfmt_elf_fdpic.c supports FDPIC for MMU-less systems. GCC/binutils/qemu support FDPIC ABI for ARM (https://github.com/mickael-guene/fdpic_doc). _ARM FDPIC Toolchain and ABI_ provides a summary. This patch implements FDPIC relocations to the integrated assembler. There are 6 static relocations and 2 dynamic relocations, with R_ARM_FUNCDESC as both static and dynamic. gas requires `--fdpic` to assemble data relocations like `.word f(FUNCDESC)`. This patch adds `MCTargetOptions::FDPIC` and reports an error if FDPIC is not set. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Driver] Support -Wa, --fdpic for ARM FDPIC ABI (PR #82188)
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/82188 `arm-linux-gnueabihf-gcc -c -fpic -mfdpic -Wa,--fdpic a.c` compiles a.c with FDPIC codegen and assembles the assembly file with `--fdpic`. This patch implements -Wa,--fdpic for the driver when using the integrated assembler. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Driver] Support -Wa, --fdpic for ARM FDPIC ABI (PR #82188)
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Fangrui Song (MaskRay) Changes `arm-linux-gnueabihf-gcc -c -fpic -mfdpic -Wa,--fdpic a.c` compiles a.c with FDPIC codegen and assembles the assembly file with `--fdpic`. This patch implements -Wa,--fdpic for the driver when using the integrated assembler. --- Full diff: https://github.com/llvm/llvm-project/pull/82188.diff 5 Files Affected: - (modified) clang/include/clang/Driver/Options.td (+2) - (modified) clang/lib/Driver/ToolChains/Clang.cpp (+4) - (modified) clang/test/Driver/arm-ias-Wa.s (+2) - (added) clang/test/Misc/cc1as-arm-fdpic.s (+10) - (modified) clang/tools/driver/cc1as_main.cpp (+4) ``diff diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 53f23f9abb4c96..da0ebbc1f0b607 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -7954,6 +7954,8 @@ def dwarf_debug_producer : Separate<["-"], "dwarf-debug-producer">, def defsym : Separate<["-"], "defsym">, HelpText<"Define a value for a symbol">; +def fdpic : Flag<["--"], "fdpic">, HelpText<"Enable FDPIC ABI (ARM only)">; + } // let Visibility = [CC1AsOption] //===--===// diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 47305f798c5fee..b4cc79df8dab7b 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2530,6 +2530,10 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, case llvm::Triple::thumbeb: case llvm::Triple::arm: case llvm::Triple::armeb: +if (Value == "--fdpic") { + CmdArgs.push_back("--fdpic"); + continue; +} if (Value.starts_with("-mimplicit-it=")) { // Only store the value; the last value set takes effect. ImplicitIt = Value.split("=").second; diff --git a/clang/test/Driver/arm-ias-Wa.s b/clang/test/Driver/arm-ias-Wa.s index b82ce8dfb31ab3..73d6bb88045176 100644 --- a/clang/test/Driver/arm-ias-Wa.s +++ b/clang/test/Driver/arm-ias-Wa.s @@ -79,3 +79,5 @@ // RUN: | FileCheck -check-prefix=CHECK-M-PROFILE %s // CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}" +// RUN: %clang --target=arm-unknown-linuxfdpiceabi -Wa,--fdpic -c %s -### 2>&1 | FileCheck --check-prefix=FDPIC %s +// FDPIC: "--fdpic" diff --git a/clang/test/Misc/cc1as-arm-fdpic.s b/clang/test/Misc/cc1as-arm-fdpic.s new file mode 100644 index 00..cc6438558eeb58 --- /dev/null +++ b/clang/test/Misc/cc1as-arm-fdpic.s @@ -0,0 +1,10 @@ +// REQUIRES: arm-registered-target + +// RUN: %clang -cc1as -triple armv7-unknown-linuxfdpiceabi -filetype obj --fdpic %s -o %t +// RUN: llvm-readelf -h -r %t | FileCheck %s + +// CHECK: OS/ABI: ARM FDPIC +// CHECK: R_ARM_FUNCDESC + +.data +.word f(FUNCDESC) diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index a55e06500d9d92..2d97769b786265 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -154,6 +154,8 @@ struct AssemblerInvocation { LLVM_PREFERRED_TYPE(bool) unsigned IncrementalLinkerCompatible : 1; LLVM_PREFERRED_TYPE(bool) + unsigned FDPIC : 1; + LLVM_PREFERRED_TYPE(bool) unsigned EmbedBitcode : 1; /// Whether to emit DWARF unwind info. @@ -346,6 +348,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings); Opts.NoWarn = Args.hasArg(OPT_massembler_no_warn); Opts.NoTypeCheck = Args.hasArg(OPT_mno_type_check); + Opts.FDPIC = Args.hasArg(OPT_fdpic); Opts.RelocationModel = std::string(Args.getLastArgValue(OPT_mrelocation_model, "pic")); Opts.TargetABI = std::string(Args.getLastArgValue(OPT_target_abi)); @@ -520,6 +523,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts, MCOptions.MCNoWarn = Opts.NoWarn; MCOptions.MCFatalWarnings = Opts.FatalWarnings; MCOptions.MCNoTypeCheck = Opts.NoTypeCheck; + MCOptions.FDPIC = Opts.FDPIC; MCOptions.ABIName = Opts.TargetABI; // FIXME: There is a bit of code duplication with addPassesToEmitFile. `` https://github.com/llvm/llvm-project/pull/82188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)
llvmbot wrote: @llvm/pr-subscribers-mc @llvm/pr-subscribers-llvm-binary-utilities @llvm/pr-subscribers-objectyaml Author: Fangrui Song (MaskRay) Changes Linux kernel fs/binfmt_elf_fdpic.c supports FDPIC for MMU-less systems. GCC/binutils/qemu support FDPIC ABI for ARM (https://github.com/mickael-guene/fdpic_doc). _ARM FDPIC Toolchain and ABI_ provides a summary. This patch implements FDPIC relocations to the integrated assembler. There are 6 static relocations and 2 dynamic relocations, with R_ARM_FUNCDESC as both static and dynamic. gas requires `--fdpic` to assemble data relocations like `.word f(FUNCDESC)`. This patch adds `MCTargetOptions::FDPIC` and reports an error if FDPIC is not set. --- Full diff: https://github.com/llvm/llvm-project/pull/82187.diff 18 Files Affected: - (modified) llvm/include/llvm/BinaryFormat/ELF.h (+1) - (modified) llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def (+7) - (modified) llvm/include/llvm/MC/MCExpr.h (+6) - (modified) llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h (+4) - (modified) llvm/include/llvm/MC/MCTargetOptions.h (+1) - (modified) llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h (+2) - (modified) llvm/lib/MC/MCExpr.cpp (+8-7) - (modified) llvm/lib/MC/MCParser/AsmParser.cpp (+1-1) - (modified) llvm/lib/MC/MCTargetOptions.cpp (+1-1) - (modified) llvm/lib/MC/MCTargetOptionsCommandFlags.cpp (+5) - (modified) llvm/lib/ObjectYAML/ELFYAML.cpp (+1) - (modified) llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (+34) - (modified) llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (+4-1) - (modified) llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp (+23) - (added) llvm/test/MC/ARM/fdpic.s (+31) - (modified) llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test (+7) - (modified) llvm/test/tools/llvm-readobj/ELF/reloc-types-arm.test (+14) - (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+2-1) ``diff diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h index 124bba76c1774c..bace3a92677a82 100644 --- a/llvm/include/llvm/BinaryFormat/ELF.h +++ b/llvm/include/llvm/BinaryFormat/ELF.h @@ -362,6 +362,7 @@ enum { ELFOSABI_AMDGPU_PAL = 65,// AMD PAL runtime ELFOSABI_AMDGPU_MESA3D = 66, // AMD GCN GPUs (GFX6+) for MESA runtime ELFOSABI_ARM = 97, // ARM + ELFOSABI_ARM_FDPIC = 65, // ARM FDPIC ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000 ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000 ELFOSABI_STANDALONE = 255, // Standalone (embedded) application diff --git a/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def b/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def index 47084d1eb0aad5..7e9fe965241f25 100644 --- a/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def +++ b/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def @@ -143,3 +143,10 @@ ELF_RELOC(R_ARM_THM_BF16, 0x88) ELF_RELOC(R_ARM_THM_BF12, 0x89) ELF_RELOC(R_ARM_THM_BF18, 0x8a) ELF_RELOC(R_ARM_IRELATIVE, 0xa0) +ELF_RELOC(R_ARM_GOTFUNCDESC,0xa1) +ELF_RELOC(R_ARM_GOTOFFFUNCDESC, 0xa2) +ELF_RELOC(R_ARM_FUNCDESC, 0xa3) +ELF_RELOC(R_ARM_FUNCDESC_VALUE, 0xa4) +ELF_RELOC(R_ARM_TLS_GD32_FDPIC, 0xa5) +ELF_RELOC(R_ARM_TLS_LDM32_FDPIC,0xa6) +ELF_RELOC(R_ARM_TLS_IE32_FDPIC, 0xa7) diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h index 67836292874f5f..b3119609372049 100644 --- a/llvm/include/llvm/MC/MCExpr.h +++ b/llvm/include/llvm/MC/MCExpr.h @@ -223,6 +223,12 @@ class MCSymbolRefExpr : public MCExpr { VK_SECREL, VK_SIZE,// symbol@SIZE VK_WEAKREF, // The link between the symbols in .weakref foo, bar +VK_FUNCDESC, +VK_GOTFUNCDESC, +VK_GOTOFFFUNCDESC, +VK_TLSGD_FDPIC, +VK_TLSLDM_FDPIC, +VK_GOTTPOFF_FDPIC, VK_X86_ABS8, VK_X86_PLTOFF, diff --git a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h index fe905f2c3ba5fe..7edd3f8ce4904c 100644 --- a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h +++ b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h @@ -525,6 +525,10 @@ class MCTargetAsmParser : public MCAsmParserExtension { // Return whether this parser accept star as start of statement virtual bool starIsStartOfStatement() { return false; }; + virtual MCSymbolRefExpr::VariantKind + getVariantKindForName(StringRef Name) const { +return MCSymbolRefExpr::getVariantKindForName(Name); + } virtual const MCExpr *applyModifierToExpr(const MCExpr *E, MCSymbolRefExpr::VariantKind, MCContext &Ctx) { diff --git a/llvm/include/llvm/MC/MCTargetOptions.h b/llvm/include/llvm/MC/MCTargetOptions.h index e2dd1e0433dbe4..a7295879e15f0f 100644 --- a/llvm/include/llvm/MC/MCTargetOptions.h +++ b/llvm/include/llvm/MC/MCTargetOptions.h @@ -51,6 +51,7 @@ class MCTargetOptio
[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)
llvmbot wrote: @llvm/pr-subscribers-backend-arm Author: Fangrui Song (MaskRay) Changes Linux kernel fs/binfmt_elf_fdpic.c supports FDPIC for MMU-less systems. GCC/binutils/qemu support FDPIC ABI for ARM (https://github.com/mickael-guene/fdpic_doc). _ARM FDPIC Toolchain and ABI_ provides a summary. This patch implements FDPIC relocations to the integrated assembler. There are 6 static relocations and 2 dynamic relocations, with R_ARM_FUNCDESC as both static and dynamic. gas requires `--fdpic` to assemble data relocations like `.word f(FUNCDESC)`. This patch adds `MCTargetOptions::FDPIC` and reports an error if FDPIC is not set. --- Full diff: https://github.com/llvm/llvm-project/pull/82187.diff 18 Files Affected: - (modified) llvm/include/llvm/BinaryFormat/ELF.h (+1) - (modified) llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def (+7) - (modified) llvm/include/llvm/MC/MCExpr.h (+6) - (modified) llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h (+4) - (modified) llvm/include/llvm/MC/MCTargetOptions.h (+1) - (modified) llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h (+2) - (modified) llvm/lib/MC/MCExpr.cpp (+8-7) - (modified) llvm/lib/MC/MCParser/AsmParser.cpp (+1-1) - (modified) llvm/lib/MC/MCTargetOptions.cpp (+1-1) - (modified) llvm/lib/MC/MCTargetOptionsCommandFlags.cpp (+5) - (modified) llvm/lib/ObjectYAML/ELFYAML.cpp (+1) - (modified) llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (+34) - (modified) llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (+4-1) - (modified) llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp (+23) - (added) llvm/test/MC/ARM/fdpic.s (+31) - (modified) llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test (+7) - (modified) llvm/test/tools/llvm-readobj/ELF/reloc-types-arm.test (+14) - (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+2-1) ``diff diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h index 124bba76c1774c..bace3a92677a82 100644 --- a/llvm/include/llvm/BinaryFormat/ELF.h +++ b/llvm/include/llvm/BinaryFormat/ELF.h @@ -362,6 +362,7 @@ enum { ELFOSABI_AMDGPU_PAL = 65,// AMD PAL runtime ELFOSABI_AMDGPU_MESA3D = 66, // AMD GCN GPUs (GFX6+) for MESA runtime ELFOSABI_ARM = 97, // ARM + ELFOSABI_ARM_FDPIC = 65, // ARM FDPIC ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000 ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000 ELFOSABI_STANDALONE = 255, // Standalone (embedded) application diff --git a/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def b/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def index 47084d1eb0aad5..7e9fe965241f25 100644 --- a/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def +++ b/llvm/include/llvm/BinaryFormat/ELFRelocs/ARM.def @@ -143,3 +143,10 @@ ELF_RELOC(R_ARM_THM_BF16, 0x88) ELF_RELOC(R_ARM_THM_BF12, 0x89) ELF_RELOC(R_ARM_THM_BF18, 0x8a) ELF_RELOC(R_ARM_IRELATIVE, 0xa0) +ELF_RELOC(R_ARM_GOTFUNCDESC,0xa1) +ELF_RELOC(R_ARM_GOTOFFFUNCDESC, 0xa2) +ELF_RELOC(R_ARM_FUNCDESC, 0xa3) +ELF_RELOC(R_ARM_FUNCDESC_VALUE, 0xa4) +ELF_RELOC(R_ARM_TLS_GD32_FDPIC, 0xa5) +ELF_RELOC(R_ARM_TLS_LDM32_FDPIC,0xa6) +ELF_RELOC(R_ARM_TLS_IE32_FDPIC, 0xa7) diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h index 67836292874f5f..b3119609372049 100644 --- a/llvm/include/llvm/MC/MCExpr.h +++ b/llvm/include/llvm/MC/MCExpr.h @@ -223,6 +223,12 @@ class MCSymbolRefExpr : public MCExpr { VK_SECREL, VK_SIZE,// symbol@SIZE VK_WEAKREF, // The link between the symbols in .weakref foo, bar +VK_FUNCDESC, +VK_GOTFUNCDESC, +VK_GOTOFFFUNCDESC, +VK_TLSGD_FDPIC, +VK_TLSLDM_FDPIC, +VK_GOTTPOFF_FDPIC, VK_X86_ABS8, VK_X86_PLTOFF, diff --git a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h index fe905f2c3ba5fe..7edd3f8ce4904c 100644 --- a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h +++ b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h @@ -525,6 +525,10 @@ class MCTargetAsmParser : public MCAsmParserExtension { // Return whether this parser accept star as start of statement virtual bool starIsStartOfStatement() { return false; }; + virtual MCSymbolRefExpr::VariantKind + getVariantKindForName(StringRef Name) const { +return MCSymbolRefExpr::getVariantKindForName(Name); + } virtual const MCExpr *applyModifierToExpr(const MCExpr *E, MCSymbolRefExpr::VariantKind, MCContext &Ctx) { diff --git a/llvm/include/llvm/MC/MCTargetOptions.h b/llvm/include/llvm/MC/MCTargetOptions.h index e2dd1e0433dbe4..a7295879e15f0f 100644 --- a/llvm/include/llvm/MC/MCTargetOptions.h +++ b/llvm/include/llvm/MC/MCTargetOptions.h @@ -51,6 +51,7 @@ class MCTargetOptions { bool MCNoTypeCheck : 1; bool MCSaveTempLabels : 1; b
[llvm-branch-commits] [BOLT][NFC] Expose YAMLProfileWriter::convert function (PR #76909)
https://github.com/dcci commented: No problems with this, but do we really need 8 commits? It clutters history. Can you merge in a single one? https://github.com/llvm/llvm-project/pull/76909 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][NFC] Expose YAMLProfileWriter::convert function (PR #76909)
aaupov wrote: These are artifacts of Stacked PR workflow that's endorsed by LLVM, sorry about that. They will all be squashed into one prior to committing to main. https://github.com/llvm/llvm-project/pull/76909 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits