From 1a6b7318dddda1d1461b41c238505fbfa7f1d611 Mon Sep 17 00:00:00 2001 From: Kai Wang Date: Thu, 26 Mar 2020 09:39:46 +0800 Subject: [PATCH] [NFC] Clang format for the ELF header and ARM build attributes. Differential Revision: https://reviews.llvm.org/D76819 --- llvm/include/llvm/BinaryFormat/ELF.h | 91 +++++++++++------------ llvm/include/llvm/Support/ARMBuildAttributes.h | 92 ++++++++++++------------ llvm/lib/Support/ARMBuildAttrs.cpp | 99 +++++++++++++------------- 3 files changed, 141 insertions(+), 141 deletions(-) diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h index a943f55..d72deeb 100644 --- a/llvm/include/llvm/BinaryFormat/ELF.h +++ b/llvm/include/llvm/BinaryFormat/ELF.h @@ -816,50 +816,51 @@ enum { // Section types. enum : unsigned { - SHT_NULL = 0, // No associated section (inactive entry). - SHT_PROGBITS = 1, // Program-defined contents. - SHT_SYMTAB = 2, // Symbol table. - SHT_STRTAB = 3, // String table. - SHT_RELA = 4, // Relocation entries; explicit addends. - SHT_HASH = 5, // Symbol hash table. - SHT_DYNAMIC = 6, // Information for dynamic linking. - SHT_NOTE = 7, // Information about the file. - SHT_NOBITS = 8, // Data occupies no space in the file. - SHT_REL = 9, // Relocation entries; no explicit addends. - SHT_SHLIB = 10, // Reserved. - SHT_DYNSYM = 11, // Symbol table. - SHT_INIT_ARRAY = 14, // Pointers to initialization functions. - SHT_FINI_ARRAY = 15, // Pointers to termination functions. - SHT_PREINIT_ARRAY = 16, // Pointers to pre-init functions. - SHT_GROUP = 17, // Section group. - SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries. + SHT_NULL = 0, // No associated section (inactive entry). + SHT_PROGBITS = 1, // Program-defined contents. + SHT_SYMTAB = 2, // Symbol table. + SHT_STRTAB = 3, // String table. + SHT_RELA = 4, // Relocation entries; explicit addends. + SHT_HASH = 5, // Symbol hash table. + SHT_DYNAMIC = 6, // Information for dynamic linking. + SHT_NOTE = 7, // Information about the file. + SHT_NOBITS = 8, // Data occupies no space in the file. + SHT_REL = 9, // Relocation entries; no explicit addends. + SHT_SHLIB = 10, // Reserved. + SHT_DYNSYM = 11, // Symbol table. + SHT_INIT_ARRAY = 14, // Pointers to initialization functions. + SHT_FINI_ARRAY = 15, // Pointers to termination functions. + SHT_PREINIT_ARRAY = 16, // Pointers to pre-init functions. + SHT_GROUP = 17, // Section group. + SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries. // Experimental support for SHT_RELR sections. For details, see proposal // at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg - SHT_RELR = 19, // Relocation entries; only offsets. - SHT_LOOS = 0x60000000, // Lowest operating system-specific type. + SHT_RELR = 19, // Relocation entries; only offsets. + SHT_LOOS = 0x60000000, // Lowest operating system-specific type. // Android packed relocation section types. // https://android.googlesource.com/platform/bionic/+/6f12bfece5dcc01325e0abba56a46b1bcf991c69/tools/relocation_packer/src/elf_file.cc#37 SHT_ANDROID_REL = 0x60000001, SHT_ANDROID_RELA = 0x60000002, - SHT_LLVM_ODRTAB = 0x6fff4c00, // LLVM ODR table. - SHT_LLVM_LINKER_OPTIONS = 0x6fff4c01, // LLVM Linker Options. + SHT_LLVM_ODRTAB = 0x6fff4c00, // LLVM ODR table. + SHT_LLVM_LINKER_OPTIONS = 0x6fff4c01, // LLVM Linker Options. SHT_LLVM_CALL_GRAPH_PROFILE = 0x6fff4c02, // LLVM Call Graph Profile. - SHT_LLVM_ADDRSIG = 0x6fff4c03, // List of address-significant symbols - // for safe ICF. - SHT_LLVM_DEPENDENT_LIBRARIES = 0x6fff4c04, // LLVM Dependent Library Specifiers. - SHT_LLVM_SYMPART = 0x6fff4c05, // Symbol partition specification. - SHT_LLVM_PART_EHDR = 0x6fff4c06, // ELF header for loadable partition. - SHT_LLVM_PART_PHDR = 0x6fff4c07, // Phdrs for loadable partition. + SHT_LLVM_ADDRSIG = 0x6fff4c03, // List of address-significant symbols + // for safe ICF. + SHT_LLVM_DEPENDENT_LIBRARIES = + 0x6fff4c04, // LLVM Dependent Library Specifiers. + SHT_LLVM_SYMPART = 0x6fff4c05, // Symbol partition specification. + SHT_LLVM_PART_EHDR = 0x6fff4c06, // ELF header for loadable partition. + SHT_LLVM_PART_PHDR = 0x6fff4c07, // Phdrs for loadable partition. // Android's experimental support for SHT_RELR sections. // https://android.googlesource.com/platform/bionic/+/b7feec74547f84559a1467aca02708ff61346d2a/libc/include/elf.h#512 - SHT_ANDROID_RELR = 0x6fffff00, // Relocation entries; only offsets. - SHT_GNU_ATTRIBUTES = 0x6ffffff5, // Object attributes. - SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table. - SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions. - SHT_GNU_verneed = 0x6ffffffe, // GNU version references. - SHT_GNU_versym = 0x6fffffff, // GNU symbol versions table. - SHT_HIOS = 0x6fffffff, // Highest operating system-specific type. - SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type. + SHT_ANDROID_RELR = 0x6fffff00, // Relocation entries; only offsets. + SHT_GNU_ATTRIBUTES = 0x6ffffff5, // Object attributes. + SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table. + SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions. + SHT_GNU_verneed = 0x6ffffffe, // GNU version references. + SHT_GNU_versym = 0x6fffffff, // GNU symbol versions table. + SHT_HIOS = 0x6fffffff, // Highest operating system-specific type. + SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type. // Fixme: All this is duplicated in MCSectionELF. Why?? // Exception Index table SHT_ARM_EXIDX = 0x70000001U, @@ -869,20 +870,20 @@ enum : unsigned { SHT_ARM_ATTRIBUTES = 0x70000003U, SHT_ARM_DEBUGOVERLAY = 0x70000004U, SHT_ARM_OVERLAYSECTION = 0x70000005U, - SHT_HEX_ORDERED = 0x70000000, // Link editor is to sort the entries in - // this section based on their sizes - SHT_X86_64_UNWIND = 0x70000001, // Unwind information + SHT_HEX_ORDERED = 0x70000000, // Link editor is to sort the entries in + // this section based on their sizes + SHT_X86_64_UNWIND = 0x70000001, // Unwind information - SHT_MIPS_REGINFO = 0x70000006, // Register usage information - SHT_MIPS_OPTIONS = 0x7000000d, // General options - SHT_MIPS_DWARF = 0x7000001e, // DWARF debugging section. - SHT_MIPS_ABIFLAGS = 0x7000002a, // ABI information. + SHT_MIPS_REGINFO = 0x70000006, // Register usage information + SHT_MIPS_OPTIONS = 0x7000000d, // General options + SHT_MIPS_DWARF = 0x7000001e, // DWARF debugging section. + SHT_MIPS_ABIFLAGS = 0x7000002a, // ABI information. SHT_MSP430_ATTRIBUTES = 0x70000003U, - SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type. - SHT_LOUSER = 0x80000000, // Lowest type reserved for applications. - SHT_HIUSER = 0xffffffff // Highest type reserved for applications. + SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type. + SHT_LOUSER = 0x80000000, // Lowest type reserved for applications. + SHT_HIUSER = 0xffffffff // Highest type reserved for applications. }; // Section flags. diff --git a/llvm/include/llvm/Support/ARMBuildAttributes.h b/llvm/include/llvm/Support/ARMBuildAttributes.h index 90481ea..dc0c3e3 100644 --- a/llvm/include/llvm/Support/ARMBuildAttributes.h +++ b/llvm/include/llvm/Support/ARMBuildAttributes.h @@ -31,55 +31,55 @@ enum SpecialAttr { enum AttrType { // Rest correspond to ELF/.ARM.attributes - File = 1, - CPU_raw_name = 4, - CPU_name = 5, - CPU_arch = 6, - CPU_arch_profile = 7, - ARM_ISA_use = 8, - THUMB_ISA_use = 9, - FP_arch = 10, - WMMX_arch = 11, - Advanced_SIMD_arch = 12, - PCS_config = 13, - ABI_PCS_R9_use = 14, - ABI_PCS_RW_data = 15, - ABI_PCS_RO_data = 16, - ABI_PCS_GOT_use = 17, - ABI_PCS_wchar_t = 18, - ABI_FP_rounding = 19, - ABI_FP_denormal = 20, - ABI_FP_exceptions = 21, - ABI_FP_user_exceptions = 22, - ABI_FP_number_model = 23, - ABI_align_needed = 24, - ABI_align_preserved = 25, - ABI_enum_size = 26, - ABI_HardFP_use = 27, - ABI_VFP_args = 28, - ABI_WMMX_args = 29, - ABI_optimization_goals = 30, + File = 1, + CPU_raw_name = 4, + CPU_name = 5, + CPU_arch = 6, + CPU_arch_profile = 7, + ARM_ISA_use = 8, + THUMB_ISA_use = 9, + FP_arch = 10, + WMMX_arch = 11, + Advanced_SIMD_arch = 12, + PCS_config = 13, + ABI_PCS_R9_use = 14, + ABI_PCS_RW_data = 15, + ABI_PCS_RO_data = 16, + ABI_PCS_GOT_use = 17, + ABI_PCS_wchar_t = 18, + ABI_FP_rounding = 19, + ABI_FP_denormal = 20, + ABI_FP_exceptions = 21, + ABI_FP_user_exceptions = 22, + ABI_FP_number_model = 23, + ABI_align_needed = 24, + ABI_align_preserved = 25, + ABI_enum_size = 26, + ABI_HardFP_use = 27, + ABI_VFP_args = 28, + ABI_WMMX_args = 29, + ABI_optimization_goals = 30, ABI_FP_optimization_goals = 31, - compatibility = 32, - CPU_unaligned_access = 34, - FP_HP_extension = 36, - ABI_FP_16bit_format = 38, - MPextension_use = 42, // recoded from 70 (ABI r2.08) - DIV_use = 44, - DSP_extension = 46, - MVE_arch = 48, - also_compatible_with = 65, - conformance = 67, - Virtualization_use = 68, + compatibility = 32, + CPU_unaligned_access = 34, + FP_HP_extension = 36, + ABI_FP_16bit_format = 38, + MPextension_use = 42, // recoded from 70 (ABI r2.08) + DIV_use = 44, + DSP_extension = 46, + MVE_arch = 48, + also_compatible_with = 65, + conformance = 67, + Virtualization_use = 68, /// Legacy Tags - Section = 2, // deprecated (ABI r2.09) - Symbol = 3, // deprecated (ABI r2.09) - ABI_align8_needed = 24, // renamed to ABI_align_needed (ABI r2.09) - ABI_align8_preserved = 25, // renamed to ABI_align_preserved (ABI r2.09) - nodefaults = 64, // deprecated (ABI r2.09) - T2EE_use = 66, // deprecated (ABI r2.09) - MPextension_use_old = 70 // recoded to MPextension_use (ABI r2.08) + Section = 2, // deprecated (ABI r2.09) + Symbol = 3, // deprecated (ABI r2.09) + ABI_align8_needed = 24, // renamed to ABI_align_needed (ABI r2.09) + ABI_align8_preserved = 25, // renamed to ABI_align_preserved (ABI r2.09) + nodefaults = 64, // deprecated (ABI r2.09) + T2EE_use = 66, // deprecated (ABI r2.09) + MPextension_use_old = 70 // recoded to MPextension_use (ABI r2.08) }; StringRef AttrTypeAsString(unsigned Attr, bool HasTagPrefix = true); diff --git a/llvm/lib/Support/ARMBuildAttrs.cpp b/llvm/lib/Support/ARMBuildAttrs.cpp index d0c4fb7..9a21bab 100644 --- a/llvm/lib/Support/ARMBuildAttrs.cpp +++ b/llvm/lib/Support/ARMBuildAttrs.cpp @@ -16,56 +16,56 @@ const struct { ARMBuildAttrs::AttrType Attr; StringRef TagName; } ARMAttributeTags[] = { - { ARMBuildAttrs::File, "Tag_File" }, - { ARMBuildAttrs::Section, "Tag_Section" }, - { ARMBuildAttrs::Symbol, "Tag_Symbol" }, - { ARMBuildAttrs::CPU_raw_name, "Tag_CPU_raw_name" }, - { ARMBuildAttrs::CPU_name, "Tag_CPU_name" }, - { ARMBuildAttrs::CPU_arch, "Tag_CPU_arch" }, - { ARMBuildAttrs::CPU_arch_profile, "Tag_CPU_arch_profile" }, - { ARMBuildAttrs::ARM_ISA_use, "Tag_ARM_ISA_use" }, - { ARMBuildAttrs::THUMB_ISA_use, "Tag_THUMB_ISA_use" }, - { ARMBuildAttrs::FP_arch, "Tag_FP_arch" }, - { ARMBuildAttrs::WMMX_arch, "Tag_WMMX_arch" }, - { ARMBuildAttrs::Advanced_SIMD_arch, "Tag_Advanced_SIMD_arch" }, - { ARMBuildAttrs::MVE_arch, "Tag_MVE_arch" }, - { ARMBuildAttrs::PCS_config, "Tag_PCS_config" }, - { ARMBuildAttrs::ABI_PCS_R9_use, "Tag_ABI_PCS_R9_use" }, - { ARMBuildAttrs::ABI_PCS_RW_data, "Tag_ABI_PCS_RW_data" }, - { ARMBuildAttrs::ABI_PCS_RO_data, "Tag_ABI_PCS_RO_data" }, - { ARMBuildAttrs::ABI_PCS_GOT_use, "Tag_ABI_PCS_GOT_use" }, - { ARMBuildAttrs::ABI_PCS_wchar_t, "Tag_ABI_PCS_wchar_t" }, - { ARMBuildAttrs::ABI_FP_rounding, "Tag_ABI_FP_rounding" }, - { ARMBuildAttrs::ABI_FP_denormal, "Tag_ABI_FP_denormal" }, - { ARMBuildAttrs::ABI_FP_exceptions, "Tag_ABI_FP_exceptions" }, - { ARMBuildAttrs::ABI_FP_user_exceptions, "Tag_ABI_FP_user_exceptions" }, - { ARMBuildAttrs::ABI_FP_number_model, "Tag_ABI_FP_number_model" }, - { ARMBuildAttrs::ABI_align_needed, "Tag_ABI_align_needed" }, - { ARMBuildAttrs::ABI_align_preserved, "Tag_ABI_align_preserved" }, - { ARMBuildAttrs::ABI_enum_size, "Tag_ABI_enum_size" }, - { ARMBuildAttrs::ABI_HardFP_use, "Tag_ABI_HardFP_use" }, - { ARMBuildAttrs::ABI_VFP_args, "Tag_ABI_VFP_args" }, - { ARMBuildAttrs::ABI_WMMX_args, "Tag_ABI_WMMX_args" }, - { ARMBuildAttrs::ABI_optimization_goals, "Tag_ABI_optimization_goals" }, - { ARMBuildAttrs::ABI_FP_optimization_goals, "Tag_ABI_FP_optimization_goals" }, - { ARMBuildAttrs::compatibility, "Tag_compatibility" }, - { ARMBuildAttrs::CPU_unaligned_access, "Tag_CPU_unaligned_access" }, - { ARMBuildAttrs::FP_HP_extension, "Tag_FP_HP_extension" }, - { ARMBuildAttrs::ABI_FP_16bit_format, "Tag_ABI_FP_16bit_format" }, - { ARMBuildAttrs::MPextension_use, "Tag_MPextension_use" }, - { ARMBuildAttrs::DIV_use, "Tag_DIV_use" }, - { ARMBuildAttrs::DSP_extension, "Tag_DSP_extension" }, - { ARMBuildAttrs::nodefaults, "Tag_nodefaults" }, - { ARMBuildAttrs::also_compatible_with, "Tag_also_compatible_with" }, - { ARMBuildAttrs::T2EE_use, "Tag_T2EE_use" }, - { ARMBuildAttrs::conformance, "Tag_conformance" }, - { ARMBuildAttrs::Virtualization_use, "Tag_Virtualization_use" }, + {ARMBuildAttrs::File, "Tag_File"}, + {ARMBuildAttrs::Section, "Tag_Section"}, + {ARMBuildAttrs::Symbol, "Tag_Symbol"}, + {ARMBuildAttrs::CPU_raw_name, "Tag_CPU_raw_name"}, + {ARMBuildAttrs::CPU_name, "Tag_CPU_name"}, + {ARMBuildAttrs::CPU_arch, "Tag_CPU_arch"}, + {ARMBuildAttrs::CPU_arch_profile, "Tag_CPU_arch_profile"}, + {ARMBuildAttrs::ARM_ISA_use, "Tag_ARM_ISA_use"}, + {ARMBuildAttrs::THUMB_ISA_use, "Tag_THUMB_ISA_use"}, + {ARMBuildAttrs::FP_arch, "Tag_FP_arch"}, + {ARMBuildAttrs::WMMX_arch, "Tag_WMMX_arch"}, + {ARMBuildAttrs::Advanced_SIMD_arch, "Tag_Advanced_SIMD_arch"}, + {ARMBuildAttrs::MVE_arch, "Tag_MVE_arch"}, + {ARMBuildAttrs::PCS_config, "Tag_PCS_config"}, + {ARMBuildAttrs::ABI_PCS_R9_use, "Tag_ABI_PCS_R9_use"}, + {ARMBuildAttrs::ABI_PCS_RW_data, "Tag_ABI_PCS_RW_data"}, + {ARMBuildAttrs::ABI_PCS_RO_data, "Tag_ABI_PCS_RO_data"}, + {ARMBuildAttrs::ABI_PCS_GOT_use, "Tag_ABI_PCS_GOT_use"}, + {ARMBuildAttrs::ABI_PCS_wchar_t, "Tag_ABI_PCS_wchar_t"}, + {ARMBuildAttrs::ABI_FP_rounding, "Tag_ABI_FP_rounding"}, + {ARMBuildAttrs::ABI_FP_denormal, "Tag_ABI_FP_denormal"}, + {ARMBuildAttrs::ABI_FP_exceptions, "Tag_ABI_FP_exceptions"}, + {ARMBuildAttrs::ABI_FP_user_exceptions, "Tag_ABI_FP_user_exceptions"}, + {ARMBuildAttrs::ABI_FP_number_model, "Tag_ABI_FP_number_model"}, + {ARMBuildAttrs::ABI_align_needed, "Tag_ABI_align_needed"}, + {ARMBuildAttrs::ABI_align_preserved, "Tag_ABI_align_preserved"}, + {ARMBuildAttrs::ABI_enum_size, "Tag_ABI_enum_size"}, + {ARMBuildAttrs::ABI_HardFP_use, "Tag_ABI_HardFP_use"}, + {ARMBuildAttrs::ABI_VFP_args, "Tag_ABI_VFP_args"}, + {ARMBuildAttrs::ABI_WMMX_args, "Tag_ABI_WMMX_args"}, + {ARMBuildAttrs::ABI_optimization_goals, "Tag_ABI_optimization_goals"}, + {ARMBuildAttrs::ABI_FP_optimization_goals, "Tag_ABI_FP_optimization_goals"}, + {ARMBuildAttrs::compatibility, "Tag_compatibility"}, + {ARMBuildAttrs::CPU_unaligned_access, "Tag_CPU_unaligned_access"}, + {ARMBuildAttrs::FP_HP_extension, "Tag_FP_HP_extension"}, + {ARMBuildAttrs::ABI_FP_16bit_format, "Tag_ABI_FP_16bit_format"}, + {ARMBuildAttrs::MPextension_use, "Tag_MPextension_use"}, + {ARMBuildAttrs::DIV_use, "Tag_DIV_use"}, + {ARMBuildAttrs::DSP_extension, "Tag_DSP_extension"}, + {ARMBuildAttrs::nodefaults, "Tag_nodefaults"}, + {ARMBuildAttrs::also_compatible_with, "Tag_also_compatible_with"}, + {ARMBuildAttrs::T2EE_use, "Tag_T2EE_use"}, + {ARMBuildAttrs::conformance, "Tag_conformance"}, + {ARMBuildAttrs::Virtualization_use, "Tag_Virtualization_use"}, - // Legacy Names - { ARMBuildAttrs::FP_arch, "Tag_VFP_arch" }, - { ARMBuildAttrs::FP_HP_extension, "Tag_VFP_HP_extension" }, - { ARMBuildAttrs::ABI_align_needed, "Tag_ABI_align8_needed" }, - { ARMBuildAttrs::ABI_align_preserved, "Tag_ABI_align8_preserved" }, + // Legacy Names + {ARMBuildAttrs::FP_arch, "Tag_VFP_arch"}, + {ARMBuildAttrs::FP_HP_extension, "Tag_VFP_HP_extension"}, + {ARMBuildAttrs::ABI_align_needed, "Tag_ABI_align8_needed"}, + {ARMBuildAttrs::ABI_align_preserved, "Tag_ABI_align8_preserved"}, }; } @@ -99,4 +99,3 @@ int AttrTypeFromString(StringRef Tag) { } } } - -- 2.7.4