[PATCH] D123902: [llvm-objcopy][mips] Add MIPS specific ELF section indexes
Anubhab Ghosh via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 10:41:04 PDT 2022
argentite updated this revision to Diff 423672.
argentite added a comment.
Fix comment capitalization
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123902/new/
https://reviews.llvm.org/D123902
Files:
llvm/include/llvm/BinaryFormat/ELF.h
llvm/lib/ObjCopy/ELF/ELFObject.cpp
llvm/lib/ObjCopy/ELF/ELFObject.h
llvm/lib/ObjectYAML/ELFYAML.cpp
Index: llvm/lib/ObjectYAML/ELFYAML.cpp
===================================================================
--- llvm/lib/ObjectYAML/ELFYAML.cpp
+++ llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -751,6 +751,8 @@
void ScalarEnumerationTraits<ELFYAML::ELF_SHN>::enumeration(
IO &IO, ELFYAML::ELF_SHN &Value) {
+ const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
+ assert(Object && "The IO context is not initialized");
#define ECase(X) IO.enumCase(Value, #X, ELF::X)
ECase(SHN_UNDEF);
ECase(SHN_LORESERVE);
@@ -763,6 +765,11 @@
ECase(SHN_XINDEX);
ECase(SHN_HIRESERVE);
ECase(SHN_AMDGPU_LDS);
+ //ECase(SHN_MIPS_ACOMMON);
+ //ECase(SHN_MIPS_TEXT);
+ //ECase(SHN_MIPS_DATA);
+ //ECase(SHN_MIPS_SCOMMON);
+ //ECase(SHN_MIPS_SUNDEFINED);
ECase(SHN_HEXAGON_SCOMMON);
ECase(SHN_HEXAGON_SCOMMON_1);
ECase(SHN_HEXAGON_SCOMMON_2);
Index: llvm/lib/ObjCopy/ELF/ELFObject.h
===================================================================
--- llvm/lib/ObjCopy/ELF/ELFObject.h
+++ llvm/lib/ObjCopy/ELF/ELFObject.h
@@ -617,6 +617,11 @@
SYMBOL_COMMON = ELF::SHN_COMMON,
SYMBOL_LOPROC = ELF::SHN_LOPROC,
SYMBOL_AMDGPU_LDS = ELF::SHN_AMDGPU_LDS,
+ SYMBOL_MIPS_ACOMMON = ELF::SHN_MIPS_ACOMMON,
+ SYMBOL_MIPS_TEXT = ELF::SHN_MIPS_TEXT,
+ SYMBOL_MIPS_DATA = ELF::SHN_MIPS_DATA,
+ SYMBOL_MIPS_SCOMMON = ELF::SHN_MIPS_SCOMMON,
+ SYMBOL_MIPS_SUNDEFINED = ELF::SHN_MIPS_SUNDEFINED,
SYMBOL_HEXAGON_SCOMMON = ELF::SHN_HEXAGON_SCOMMON,
SYMBOL_HEXAGON_SCOMMON_2 = ELF::SHN_HEXAGON_SCOMMON_2,
SYMBOL_HEXAGON_SCOMMON_4 = ELF::SHN_HEXAGON_SCOMMON_4,
Index: llvm/lib/ObjCopy/ELF/ELFObject.cpp
===================================================================
--- llvm/lib/ObjCopy/ELF/ELFObject.cpp
+++ llvm/lib/ObjCopy/ELF/ELFObject.cpp
@@ -655,6 +655,15 @@
return Index == SHN_AMDGPU_LDS;
}
+ if (Machine == EM_MIPS) {
+ switch (Index) {
+ case SHN_MIPS_ACOMMON:
+ case SHN_MIPS_SCOMMON:
+ case SHN_MIPS_SUNDEFINED:
+ return true;
+ }
+ }
+
if (Machine == EM_HEXAGON) {
switch (Index) {
case SHN_HEXAGON_SCOMMON:
Index: llvm/include/llvm/BinaryFormat/ELF.h
===================================================================
--- llvm/include/llvm/BinaryFormat/ELF.h
+++ llvm/include/llvm/BinaryFormat/ELF.h
@@ -564,6 +564,15 @@
EF_MIPS_ARCH = 0xf0000000 // Mask for applying EF_MIPS_ARCH_ variant
};
+// MIPS-specific section indexes
+enum {
+ SHN_MIPS_ACOMMON = 0xff00, // Common symbols which are defined and allocated
+ SHN_MIPS_TEXT = 0xff01, // Not ABI compliant
+ SHN_MIPS_DATA = 0xff02, // Not ABI compliant
+ SHN_MIPS_SCOMMON = 0xff03, // Common symbols for global data area
+ SHN_MIPS_SUNDEFINED = 0xff04 // Undefined symbols for global data area
+};
+
// ELF Relocation types for Mips
enum {
#include "ELFRelocs/Mips.def"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123902.423672.patch
Type: text/x-patch
Size: 2853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/98ff35f1/attachment.bin>
More information about the llvm-commits
mailing list