Skip to content

Commit 9260bae

Browse files
committed
Fix #define conflicts
1 parent 14bbcab commit 9260bae

File tree

13 files changed

+49
-25
lines changed

13 files changed

+49
-25
lines changed

api/python/lief/MachO/__init__.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,9 +1532,9 @@ class Section(lief.Section):
15321532

15331533
CSTRING_LITERALS = 2
15341534

1535-
S_4BYTE_LITERALS = 3
1535+
IS_4BYTE_LITERALS = 3
15361536

1537-
S_8BYTE_LITERALS = 4
1537+
IS_8BYTE_LITERALS = 4
15381538

15391539
LITERAL_POINTERS = 5
15401540

@@ -1554,7 +1554,7 @@ class Section(lief.Section):
15541554

15551555
INTERPOSING = 13
15561556

1557-
S_16BYTE_LITERALS = 14
1557+
IS_16BYTE_LITERALS = 14
15581558

15591559
DTRACE_DOF = 15
15601560

@@ -2085,7 +2085,7 @@ class Symbol(lief.Symbol):
20852085

20862086
DYLD_BIND = 2
20872087

2088-
LC_SYMTAB = 3
2088+
SYMTAB = 3
20892089

20902090
class TYPE(enum.Enum):
20912091
@staticmethod

api/python/src/MachO/objects/pySection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ void create<Section>(nb::module_& m) {
5151
.value(PY_ENUM(Section::TYPE::REGULAR))
5252
.value(PY_ENUM(Section::TYPE::ZEROFILL))
5353
.value(PY_ENUM(Section::TYPE::CSTRING_LITERALS))
54-
.value(PY_ENUM(Section::TYPE::S_4BYTE_LITERALS))
55-
.value(PY_ENUM(Section::TYPE::S_8BYTE_LITERALS))
54+
.value(PY_ENUM(Section::TYPE::IS_4BYTE_LITERALS))
55+
.value(PY_ENUM(Section::TYPE::IS_8BYTE_LITERALS))
5656
.value(PY_ENUM(Section::TYPE::LITERAL_POINTERS))
5757
.value(PY_ENUM(Section::TYPE::NON_LAZY_SYMBOL_POINTERS))
5858
.value(PY_ENUM(Section::TYPE::LAZY_SYMBOL_POINTERS))
@@ -62,7 +62,7 @@ void create<Section>(nb::module_& m) {
6262
.value(PY_ENUM(Section::TYPE::COALESCED))
6363
.value(PY_ENUM(Section::TYPE::GB_ZEROFILL))
6464
.value(PY_ENUM(Section::TYPE::INTERPOSING))
65-
.value(PY_ENUM(Section::TYPE::S_16BYTE_LITERALS))
65+
.value(PY_ENUM(Section::TYPE::IS_16BYTE_LITERALS))
6666
.value(PY_ENUM(Section::TYPE::DTRACE_DOF))
6767
.value(PY_ENUM(Section::TYPE::LAZY_DYLIB_SYMBOL_POINTERS))
6868
.value(PY_ENUM(Section::TYPE::THREAD_LOCAL_REGULAR))

api/python/src/MachO/objects/pySymbol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void create<Symbol>(nb::module_& m) {
5757
.value("UNKNOWN", Symbol::ORIGIN::UNKNOWN)
5858
.value("DYLD_EXPORT", Symbol::ORIGIN::DYLD_EXPORT)
5959
.value("DYLD_BIND", Symbol::ORIGIN::DYLD_BIND)
60-
.value("LC_SYMTAB", Symbol::ORIGIN::LC_SYMTAB)
60+
.value("SYMTAB", Symbol::ORIGIN::SYMTAB)
6161
;
6262

6363
enum_<Symbol::TYPE>(symbol, "TYPE")

doc/sphinx/changelog.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@
6363
- lief.MachO.FAT_CIGAM
6464
+ lief.MachO.CIGAM_FAT
6565
66+
- lief.MachO.Symbol.ORIGIN.LC_SYMTAB
67+
+ lief.MachO.Symbol.ORIGIN.SYMTAB
68+
69+
- lief.MachO.Section.TYPE.S_4BYTE_LITERALS
70+
+ lief.MachO.Section.TYPE.IS_4BYTE_LITERALS
71+
72+
- lief.MachO.Section.TYPE.S_8BYTE_LITERALS
73+
+ lief.MachO.Section.TYPE.IS_8BYTE_LITERALS
74+
75+
- lief.MachO.Section.TYPE.S_16BYTE_LITERALS
76+
+ lief.MachO.Section.TYPE.IS_16BYTE_LITERALS
77+
6678
6779
.. tab:: :fa:`regular fa-file-code` C++
6880

@@ -82,6 +94,18 @@
8294
+ MACHO_TYPES::MAGIC_FAT
8395
+ MACHO_TYPES::CIGAM_FAT
8496
97+
- Section::TYPE::S_16BYTE_LITERALS
98+
+ Section::TYPE::IS_16BYTE_LITERALS
99+
100+
- Section::TYPE::S_4BYTE_LITERALS
101+
+ Section::TYPE::IS_4BYTE_LITERALS
102+
103+
- Section::TYPE::S_8BYTE_LITERALS
104+
+ Section::TYPE::IS_8BYTE_LITERALS
105+
106+
- Symbol::ORIGIN::LC_SYMTAB
107+
+ Symbol::ORIGIN::SYMTAB
108+
85109
:ELF:
86110

87111
* LIEF inserted sections are not compatible with a ``strip`` after the

include/LIEF/MachO/Binary.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ class LIEF_API Binary : public LIEF::Binary {
952952
/// Check if the binary is supporting ARM64 pointer authentication (arm64e)
953953
bool support_arm64_ptr_auth() const {
954954
return header().cpu_type() == Header::CPU_TYPE::ARM64 &&
955-
(header().cpu_subtype() & ~Header::CPU_SUBTYPE_MASK) == Header::CPU_SUBTYPE_ARM64_ARM64E;
955+
(header().cpu_subtype() & ~Header::SUBTYPE_MASK) == Header::CPU_SUBTYPE_ARM64_ARM64E;
956956
}
957957

958958
/// Return an iterator over the binding info which can come from either

include/LIEF/MachO/Header.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ class LIEF_API Header : public Object {
108108
POWERPC64 = 18 | ABI64,
109109
};
110110

111-
static constexpr uint32_t CPU_SUBTYPE_MASK = 0xff000000;
112-
static constexpr uint32_t CPU_SUBTYPE_LIB64 = 0x80000000;
111+
static constexpr uint32_t SUBTYPE_MASK = 0xff000000;
112+
static constexpr uint32_t SUBTYPE_LIB64 = 0x80000000;
113113

114114
static constexpr auto CPU_SUBTYPE_ARM64_ARM64E = 2;
115115

include/LIEF/MachO/Section.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class LIEF_API Section : public LIEF::Section {
6868
REGULAR = 0x00u, ///< Regular section.
6969
ZEROFILL = 0x01u, ///< Zero fill on demand section.
7070
CSTRING_LITERALS = 0x02u, ///< Section with literal C strings.
71-
S_4BYTE_LITERALS = 0x03u, ///< Section with 4 byte literals.
72-
S_8BYTE_LITERALS = 0x04u, ///< Section with 8 byte literals.
71+
IS_4BYTE_LITERALS = 0x03u, ///< Section with 4 byte literals.
72+
IS_8BYTE_LITERALS = 0x04u, ///< Section with 8 byte literals.
7373
LITERAL_POINTERS = 0x05u, ///< Section with pointers to literals.
7474
NON_LAZY_SYMBOL_POINTERS = 0x06u, ///< Section with non-lazy symbol pointers.
7575
LAZY_SYMBOL_POINTERS = 0x07u, ///< Section with lazy symbol pointers.
@@ -79,7 +79,7 @@ class LIEF_API Section : public LIEF::Section {
7979
COALESCED = 0x0bu, ///< Section contains symbols that are to be coalesced.
8080
GB_ZEROFILL = 0x0cu, ///< Zero fill on demand section (that can be larger than 4 gigabytes).
8181
INTERPOSING = 0x0du, ///< Section with only pairs of function pointers for interposing.
82-
S_16BYTE_LITERALS = 0x0eu, ///< Section with only 16 byte literals.
82+
IS_16BYTE_LITERALS = 0x0eu, ///< Section with only 16 byte literals.
8383
DTRACE_DOF = 0x0fu, ///< Section contains DTrace Object Format.
8484
LAZY_DYLIB_SYMBOL_POINTERS = 0x10u, ///< Section with lazy symbol pointers to lazy loaded dylibs.
8585
THREAD_LOCAL_REGULAR = 0x11u, ///< Thread local data section.

include/LIEF/MachO/Symbol.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class LIEF_API Symbol : public LIEF::Symbol {
7171
UNKNOWN = 0,
7272
DYLD_EXPORT = 1,
7373
DYLD_BIND = 2, /// The symbol comes from the binding opcodes
74-
LC_SYMTAB = 3,
74+
SYMTAB = 3, /// The symbol comes from the LC_SYMTAB command
7575
};
7676

7777
enum class TYPE : uint32_t{
@@ -94,7 +94,7 @@ class LIEF_API Symbol : public LIEF::Symbol {
9494
type_{n_type},
9595
numberof_sections_{n_sect},
9696
description_{n_desc},
97-
origin_{ORIGIN::LC_SYMTAB}
97+
origin_{ORIGIN::SYMTAB}
9898
{
9999
value_ = value;
100100
}

src/MachO/Binary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2385,7 +2385,7 @@ Symbol* Binary::add_local_symbol(uint64_t address, const std::string& name) {
23852385

23862386
auto sym = std::make_unique<Symbol>();
23872387
sym->category_ = Symbol::CATEGORY::LOCAL;
2388-
sym->origin_ = Symbol::ORIGIN::LC_SYMTAB;
2388+
sym->origin_ = Symbol::ORIGIN::SYMTAB;
23892389
sym->numberof_sections_ = 0;
23902390
sym->description_ = static_cast<uint16_t>(/* N_NO_DEAD_STRIP */0x20);
23912391

src/MachO/BinaryParser.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3569,7 +3569,7 @@ ok_error_t BinaryParser::post_process(DynamicSymbolCommand& cmd) {
35693569
symtab.reserve(binary_->symbols_.size());
35703570
size_t isym = 0;
35713571
for (const std::unique_ptr<Symbol>& sym : binary_->symbols_) {
3572-
if (sym->origin() != Symbol::ORIGIN::LC_SYMTAB) {
3572+
if (sym->origin() != Symbol::ORIGIN::SYMTAB) {
35733573
continue;
35743574
}
35753575

0 commit comments

Comments
 (0)