File tree 8 files changed +113
-1
lines changed
8 files changed +113
-1
lines changed Original file line number Diff line number Diff line change 25
25
26
26
using namespace llvm ;
27
27
28
+ #ifdef __APPLE__
29
+ #include < Availability.h>
30
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
31
+ static size_t strnlen (const char *s, size_t maxlen) {
32
+ size_t l = 0 ;
33
+ while (l < maxlen && *s) {
34
+ l++;
35
+ s++;
36
+ }
37
+ return l;
38
+ }
39
+ #endif
40
+ #endif
41
+
28
42
namespace {
29
43
30
44
class MachOWriter {
Original file line number Diff line number Diff line change 21
21
#include < cstdint>
22
22
#include < cstring>
23
23
24
+ #ifdef __APPLE__
25
+ #include < Availability.h>
26
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
27
+ static size_t strnlen (const char *s, size_t maxlen) {
28
+ size_t l = 0 ;
29
+ while (l < maxlen && *s) {
30
+ l++;
31
+ s++;
32
+ }
33
+ return l;
34
+ }
35
+ #endif
36
+ #endif
37
+
24
38
namespace llvm {
25
39
26
40
MachOYAML::LoadCommand::~LoadCommand () = default ;
Original file line number Diff line number Diff line change 11
11
#include " llvm/Support/Errc.h"
12
12
#include " llvm/Support/ErrorHandling.h"
13
13
14
+ #ifdef __APPLE__
15
+ #include < Availability.h>
16
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
17
+ static size_t strnlen (const char *s, size_t maxlen) {
18
+ size_t l = 0 ;
19
+ while (l < maxlen && *s) {
20
+ l++;
21
+ s++;
22
+ }
23
+ return l;
24
+ }
25
+ #endif
26
+ #endif
27
+
14
28
namespace llvm {
15
29
namespace objcopy {
16
30
namespace macho {
Original file line number Diff line number Diff line change 13
13
#include " llvm/Support/Errc.h"
14
14
#include < memory>
15
15
16
+ #ifdef __APPLE__
17
+ #include < Availability.h>
18
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
19
+ static size_t strnlen (const char *s, size_t maxlen) {
20
+ size_t l = 0 ;
21
+ while (l < maxlen && *s) {
22
+ l++;
23
+ s++;
24
+ }
25
+ return l;
26
+ }
27
+ #endif
28
+ #endif
29
+
16
30
namespace llvm {
17
31
namespace objcopy {
18
32
namespace macho {
Original file line number Diff line number Diff line change 10
10
#include " llvm/ADT/SmallPtrSet.h"
11
11
#include < unordered_set>
12
12
13
+ #ifdef __APPLE__
14
+ #include < Availability.h>
15
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
16
+ static size_t strnlen (const char *s, size_t maxlen) {
17
+ size_t l = 0 ;
18
+ while (l < maxlen && *s) {
19
+ l++;
20
+ s++;
21
+ }
22
+ return l;
23
+ }
24
+ #endif
25
+ #endif
26
+
13
27
namespace llvm {
14
28
namespace objcopy {
15
29
namespace macho {
Original file line number Diff line number Diff line change @@ -80,6 +80,20 @@ using namespace ELF;
80
80
#define ENUM_ENT_1 (enum ) \
81
81
{ #enum , #enum , ELF::enum }
82
82
83
+ #ifdef __APPLE__
84
+ #include < Availability.h>
85
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
86
+ static size_t strnlen (const char *s, size_t maxlen) {
87
+ size_t l = 0 ;
88
+ while (l < maxlen && *s) {
89
+ l++;
90
+ s++;
91
+ }
92
+ return l;
93
+ }
94
+ #endif
95
+ #endif
96
+
83
97
namespace {
84
98
85
99
template <class ELFT > struct RelSymbol {
Original file line number Diff line number Diff line change 20
20
#include " llvm/Support/raw_ostream.h"
21
21
#include < map>
22
22
23
+ #ifdef __APPLE__
24
+ #include < Availability.h>
25
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
26
+ static size_t strnlen (const char *s, size_t maxlen) {
27
+ size_t l = 0 ;
28
+ while (l < maxlen && *s) {
29
+ l++;
30
+ s++;
31
+ }
32
+ return l;
33
+ }
34
+ #endif
35
+ #endif
36
+
23
37
namespace llvm {
24
38
25
39
static inline Error createError (const Twine &Msg) {
Original file line number Diff line number Diff line change 15
15
#include " llvm/Support/ErrorHandling.h"
16
16
#include " llvm/Support/LEB128.h"
17
17
18
- #include < string.h> // for memcpy
18
+ #include < string.h> // for memcpy and strnlen
19
+
20
+ #ifdef __APPLE__
21
+ #include < Availability.h>
22
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
23
+ static size_t strnlen (const char *s, size_t maxlen) {
24
+ size_t l = 0 ;
25
+ while (l < maxlen && *s) {
26
+ l++;
27
+ s++;
28
+ }
29
+ return l;
30
+ }
31
+ #endif
32
+ #endif
19
33
20
34
using namespace llvm ;
21
35
You can’t perform that action at this time.
0 commit comments