Skip to content

Commit 66b4cd4

Browse files
committed
Fix enums conflicts
Enums changes (C++/C): ELF: * s/SECTION_TYPES/ELF_SECTION_TYPES/ * s/SECTION_FLAGS/ELF_SECTION_FLAGS/ * s/SYMBOL_TYPES/ELF_SYMBOL_TYPES/ * s/SEGMENT_FLAGS/ELF_SEGMENT_FLAGS/ MachO: * s/SECTION_TYPES/MACHO_SECTION_TYPES/ * s/SECTION_FLAGS/MACHO_SECTION_FLAGS/ * s/SYMBOL_TYPES/MACHO_SYMBOL_TYPES/ * s/SEGMENTS_FLAGS/MACHO_SEGMENTS_FLAGS/ PE: * s/SECTION_TYPES/PE_SECTION_TYPES/ Resolve #32
1 parent 117f866 commit 66b4cd4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+523
-524
lines changed

api/c/ELF/EnumToString.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ extern "C"
4646
return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_TAGS>(e));
4747
}
4848

49-
const char* SECTION_TYPES_to_string(enum SECTION_TYPES e) {
50-
return LIEF::ELF::to_string(static_cast<LIEF::ELF::SECTION_TYPES>(e));
49+
const char* ELF_SECTION_TYPES_to_string(enum ELF_SECTION_TYPES e) {
50+
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_TYPES>(e));
5151
}
5252

53-
const char* SECTION_FLAGS_to_string(enum SECTION_FLAGS e) {
54-
return LIEF::ELF::to_string(static_cast<LIEF::ELF::SECTION_FLAGS>(e));
53+
const char* ELF_SECTION_FLAGS_to_string(enum ELF_SECTION_FLAGS e) {
54+
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_FLAGS>(e));
5555
}
5656

57-
const char* SYMBOL_TYPES_to_string(enum SYMBOL_TYPES e) {
58-
return LIEF::ELF::to_string(static_cast<LIEF::ELF::SYMBOL_TYPES>(e));
57+
const char* ELF_SYMBOL_TYPES_to_string(enum ELF_SYMBOL_TYPES e) {
58+
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SYMBOL_TYPES>(e));
5959
}
6060

6161
const char* ELF_CLASS_to_string(enum ELF_CLASS e) {

api/c/ELF/Section.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void init_c_sections(Elf_Binary_t* c_binary, Binary* binary) {
3636

3737
c_binary->sections[i]->name = b_section.name().c_str();
3838
c_binary->sections[i]->flags = b_section.flags();
39-
c_binary->sections[i]->type = static_cast<enum ::SECTION_TYPES>(b_section.type());
39+
c_binary->sections[i]->type = static_cast<enum ::ELF_SECTION_TYPES>(b_section.type());
4040
c_binary->sections[i]->virtual_address = b_section.virtual_address();
4141
c_binary->sections[i]->offset = b_section.file_offset();
4242
c_binary->sections[i]->original_size = b_section.original_size();

api/c/ELF/Symbol.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void init_c_dynamic_symbols(Elf_Binary_t* c_binary, Binary* binary) {
2828
Symbol& b_sym = dyn_symb[i];
2929
c_binary->dynamic_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
3030
c_binary->dynamic_symbols[i]->name = b_sym.name().c_str();
31-
c_binary->dynamic_symbols[i]->type = static_cast<enum ::SYMBOL_TYPES>(b_sym.type());
31+
c_binary->dynamic_symbols[i]->type = static_cast<enum ::ELF_SYMBOL_TYPES>(b_sym.type());
3232
c_binary->dynamic_symbols[i]->binding = static_cast<enum ::SYMBOL_BINDINGS>(b_sym.binding());
3333
c_binary->dynamic_symbols[i]->other = b_sym.other();
3434
c_binary->dynamic_symbols[i]->shndx = b_sym.shndx();
@@ -55,7 +55,7 @@ void init_c_static_symbols(Elf_Binary_t* c_binary, Binary* binary) {
5555
Symbol& b_sym = static_symb[i];
5656
c_binary->static_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
5757
c_binary->static_symbols[i]->name = b_sym.name().c_str();
58-
c_binary->static_symbols[i]->type = static_cast<enum ::SYMBOL_TYPES>(b_sym.type());
58+
c_binary->static_symbols[i]->type = static_cast<enum ::ELF_SYMBOL_TYPES>(b_sym.type());
5959
c_binary->static_symbols[i]->binding = static_cast<enum ::SYMBOL_BINDINGS>(b_sym.binding());
6060
c_binary->static_symbols[i]->other = b_sym.other();
6161
c_binary->static_symbols[i]->shndx = b_sym.shndx();

api/c/MachO/EnumToString.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ const char* HEADER_FLAGS_to_string(enum HEADER_FLAGS e) {
4848
}
4949

5050

51-
const char* MachO_SECTION_TYPES_to_string(enum SECTION_TYPES e) {
52-
return LIEF::MachO::to_string(static_cast<LIEF::MachO::SECTION_TYPES>(e));
51+
const char* MACHO_SECTION_TYPES_to_string(enum MACHO_SECTION_TYPES e) {
52+
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_SECTION_TYPES>(e));
5353
}
5454

5555

56-
const char* MachO_SYMBOL_TYPES_to_string(enum SYMBOL_TYPES e) {
57-
return LIEF::MachO::to_string(static_cast<LIEF::MachO::SYMBOL_TYPES>(e));
56+
const char* MACHO_SYMBOL_TYPES_to_string(enum MACHO_SYMBOL_TYPES e) {
57+
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_SYMBOL_TYPES>(e));
5858
}
5959

6060

api/c/MachO/Section.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void init_c_sections(Macho_Binary_t* c_binary, Binary* binary) {
3939
c_binary->sections[i]->relocation_offset = section.relocation_offset();
4040
c_binary->sections[i]->numberof_relocations = section.numberof_relocations();
4141
c_binary->sections[i]->flags = section.flags();
42-
c_binary->sections[i]->type = static_cast<enum ::SECTION_TYPES>(section.type());
42+
c_binary->sections[i]->type = static_cast<enum ::MACHO_SECTION_TYPES>(section.type());
4343
c_binary->sections[i]->reserved1 = section.reserved1();
4444
c_binary->sections[i]->reserved2 = section.reserved2();
4545
c_binary->sections[i]->reserved3 = section.reserved3();

api/c/include/LIEF/ELF/EnumToString.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ DLL_PUBLIC const char* VERSION_to_string(enum VERSION e);
3030
DLL_PUBLIC const char* ARCH_to_string(enum ARCH e);
3131
DLL_PUBLIC const char* SEGMENT_TYPES_to_string(enum SEGMENT_TYPES e);
3232
DLL_PUBLIC const char* DYNAMIC_TAGS_to_string(enum DYNAMIC_TAGS e);
33-
DLL_PUBLIC const char* SECTION_TYPES_to_string(enum SECTION_TYPES e);
34-
DLL_PUBLIC const char* SECTION_FLAGS_to_string(enum SECTION_FLAGS e);
35-
DLL_PUBLIC const char* SYMBOL_TYPES_to_string(enum SYMBOL_TYPES e);
33+
DLL_PUBLIC const char* ELF_SECTION_TYPES_to_string(enum ELF_SECTION_TYPES e);
34+
DLL_PUBLIC const char* ELF_SECTION_FLAGS_to_string(enum ELF_SECTION_FLAGS e);
35+
DLL_PUBLIC const char* ELF_SYMBOL_TYPES_to_string(enum ELF_SYMBOL_TYPES e);
3636
DLL_PUBLIC const char* ELF_CLASS_to_string(enum ELF_CLASS e);
3737
DLL_PUBLIC const char* ELF_DATA_to_string(enum ELF_DATA e);
3838
DLL_PUBLIC const char* OS_ABI_to_string(enum OS_ABI e);

api/c/include/LIEF/ELF/Section.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ extern "C" {
3333
#endif
3434

3535
struct Elf_Section_t {
36-
const char* name;
37-
uint32_t flags;
38-
enum SECTION_TYPES type;
39-
uint64_t virtual_address;
40-
uint64_t offset;
41-
uint64_t original_size;
42-
uint32_t link;
43-
uint32_t info;
44-
uint64_t alignment;
45-
uint64_t entry_size;
46-
uint64_t size;
47-
uint8_t* content;
48-
double entropy;
36+
const char* name;
37+
uint32_t flags;
38+
enum ELF_SECTION_TYPES type;
39+
uint64_t virtual_address;
40+
uint64_t offset;
41+
uint64_t original_size;
42+
uint32_t link;
43+
uint32_t info;
44+
uint64_t alignment;
45+
uint64_t entry_size;
46+
uint64_t size;
47+
uint8_t* content;
48+
double entropy;
4949
};
5050

5151
typedef struct Elf_Section_t Elf_Section_t;

api/c/include/LIEF/ELF/Symbol.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ extern "C" {
3333
#endif
3434

3535
struct Elf_Symbol_t {
36-
const char* name;
37-
enum SYMBOL_TYPES type;
38-
enum SYMBOL_BINDINGS binding;
39-
uint8_t information;
40-
uint8_t other;
41-
uint16_t shndx;
42-
uint64_t value;
43-
uint64_t size;
44-
bool is_exported; /**< Whether or not the symbol is exported */
45-
bool is_imported; /**< Whether or not the symbol is imported */
36+
const char* name;
37+
enum ELF_SYMBOL_TYPES type;
38+
enum SYMBOL_BINDINGS binding;
39+
uint8_t information;
40+
uint8_t other;
41+
uint16_t shndx;
42+
uint64_t value;
43+
uint64_t size;
44+
bool is_exported; /**< Whether or not the symbol is exported */
45+
bool is_imported; /**< Whether or not the symbol is imported */
4646
};
4747

4848
typedef struct Elf_Symbol_t Elf_Symbol_t;

api/c/include/LIEF/MachO/EnumToString.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ DLL_PUBLIC const char* MACHO_TYPES_to_string(enum MACHO_TYPES e);
2828
DLL_PUBLIC const char* FILE_TYPES_to_string(enum FILE_TYPES e);
2929
DLL_PUBLIC const char* CPU_TYPES_to_string(enum CPU_TYPES e);
3030
DLL_PUBLIC const char* HEADER_FLAGS_to_string(enum HEADER_FLAGS e);
31-
DLL_PUBLIC const char* MachO_SECTION_TYPES_to_string(enum SECTION_TYPES e);
32-
DLL_PUBLIC const char* MachO_SYMBOL_TYPES_to_string(enum SYMBOL_TYPES e);
31+
DLL_PUBLIC const char* MACHO_SECTION_TYPES_to_string(enum MACHO_SECTION_TYPES e);
32+
DLL_PUBLIC const char* MACHO_SYMBOL_TYPES_to_string(enum MACHO_SYMBOL_TYPES e);
3333
DLL_PUBLIC const char* N_LIST_TYPES_to_string(enum N_LIST_TYPES e);
3434
DLL_PUBLIC const char* SYMBOL_DESCRIPTIONS_to_string(enum SYMBOL_DESCRIPTIONS e);
3535

api/c/include/LIEF/MachO/Section.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ extern "C" {
3232

3333
struct Macho_Section_t {
3434

35-
const char* name;
36-
uint32_t alignment;
37-
uint32_t relocation_offset;
38-
uint32_t numberof_relocations;
39-
uint32_t flags;
40-
enum SECTION_TYPES type;
41-
uint32_t reserved1;
42-
uint32_t reserved2;
43-
uint32_t reserved3;
44-
uint64_t virtual_address;
45-
uint64_t offset;
46-
uint64_t size;
47-
uint8_t* content;
48-
double entropy;
35+
const char* name;
36+
uint32_t alignment;
37+
uint32_t relocation_offset;
38+
uint32_t numberof_relocations;
39+
uint32_t flags;
40+
enum MACHO_SECTION_TYPES type;
41+
uint32_t reserved1;
42+
uint32_t reserved2;
43+
uint32_t reserved3;
44+
uint64_t virtual_address;
45+
uint64_t offset;
46+
uint64_t size;
47+
uint8_t* content;
48+
double entropy;
4949
};
5050

5151
typedef struct Macho_Section_t Macho_Section_t;

api/python/ELF/objects/pySection.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ void init_ELF_Section_class(py::module& m) {
4949
".. warning:: The value will probably change when re-building binary.")
5050

5151
.def_property("type",
52-
static_cast<getter_t<SECTION_TYPES>>(&Section::type),
53-
static_cast<setter_t<SECTION_TYPES>>(&Section::type),
52+
static_cast<getter_t<ELF_SECTION_TYPES>>(&Section::type),
53+
static_cast<setter_t<ELF_SECTION_TYPES>>(&Section::type),
5454
"Return a " RST_CLASS_REF(lief.ELF.SECTION_TYPES) "")
5555

5656
.def_property("flags",
@@ -118,7 +118,7 @@ void init_ELF_Section_class(py::module& m) {
118118

119119

120120
.def("has",
121-
static_cast<bool (Section::*)(SECTION_FLAGS) const>(&Section::has),
121+
static_cast<bool (Section::*)(ELF_SECTION_FLAGS) const>(&Section::has),
122122
"Check if the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " is present",
123123
"flag"_a)
124124

@@ -135,11 +135,11 @@ void init_ELF_Section_class(py::module& m) {
135135
return LIEF::Hash::hash(section);
136136
})
137137

138-
.def(py::self += SECTION_FLAGS())
139-
.def(py::self -= SECTION_FLAGS())
138+
.def(py::self += ELF_SECTION_FLAGS())
139+
.def(py::self -= ELF_SECTION_FLAGS())
140140

141141
.def("__contains__",
142-
static_cast<bool (Section::*)(SECTION_FLAGS) const>(&Section::has),
142+
static_cast<bool (Section::*)(ELF_SECTION_FLAGS) const>(&Section::has),
143143
"Check if the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " is present")
144144

145145

api/python/ELF/objects/pySegment.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void init_ELF_Segment_class(py::module& m) {
104104

105105

106106
.def("has",
107-
static_cast<bool (Segment::*)(SEGMENT_FLAGS) const>(&Segment::has),
107+
static_cast<bool (Segment::*)(ELF_SEGMENT_FLAGS) const>(&Segment::has),
108108
"Check if the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " is present",
109109
"flag"_a)
110110

@@ -132,11 +132,11 @@ void init_ELF_Segment_class(py::module& m) {
132132
return LIEF::Hash::hash(segment);
133133
})
134134

135-
.def(py::self += SEGMENT_FLAGS())
136-
.def(py::self -= SEGMENT_FLAGS())
135+
.def(py::self += ELF_SEGMENT_FLAGS())
136+
.def(py::self -= ELF_SEGMENT_FLAGS())
137137

138138
.def("__contains__",
139-
static_cast<bool (Segment::*)(SEGMENT_FLAGS) const>(&Segment::has),
139+
static_cast<bool (Segment::*)(ELF_SEGMENT_FLAGS) const>(&Segment::has),
140140
"Check if the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " is present")
141141

142142
.def("__contains__",

api/python/ELF/objects/pySymbol.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ void init_ELF_Symbol_class(py::module& m) {
3939
"Symbol's unmangled name")
4040

4141
.def_property("type",
42-
static_cast<getter_t<SYMBOL_TYPES>>(&Symbol::type),
43-
static_cast<setter_t<SYMBOL_TYPES>>(&Symbol::type),
42+
static_cast<getter_t<ELF_SYMBOL_TYPES>>(&Symbol::type),
43+
static_cast<setter_t<ELF_SYMBOL_TYPES>>(&Symbol::type),
4444
"A symbol's type provides a general classification for the associated entity")
4545

4646
.def_property("binding",

0 commit comments

Comments
 (0)