Skip to content

Commit 4c80839

Browse files
committed
[compiler-rt] Fix purecap compilation for CheriBSD
This commit fixes type mismatches between uptr and usize.
1 parent 0aa31b6 commit 4c80839

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void NORETURN ReportInternalAllocatorOutOfMemory(uptr requested_size) {
8484
Die();
8585
}
8686

87-
void *InternalAlloc(uptr size, InternalAllocatorCache *cache, usize alignment) {
87+
void *InternalAlloc(usize size, InternalAllocatorCache *cache, usize alignment) {
8888
void *p = RawInternalAlloc(size, cache, alignment);
8989
if (UNLIKELY(!p))
9090
ReportInternalAllocatorOutOfMemory(size);

compiler-rt/lib/sanitizer_common/sanitizer_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ usize ReadBinaryNameCached(/*out*/char *buf, usize buf_len) {
308308
return name_len;
309309
}
310310

311-
uptr ReadBinaryDir(/*out*/ char *buf, uptr buf_len) {
311+
usize ReadBinaryDir(/*out*/ char *buf, usize buf_len) {
312312
ReadBinaryNameCached(buf, buf_len);
313313
const char *exec_name_pos = StripModuleName(buf);
314314
uptr name_len = exec_name_pos - buf;

compiler-rt/lib/sanitizer_common/sanitizer_libc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ extern "C" {
2929
// In normal runtime code, use the __sanitizer::internal_X() aliases instead.
3030
SANITIZER_INTERFACE_ATTRIBUTE void *__sanitizer_internal_memcpy(void *dest,
3131
const void *src,
32-
uptr n);
32+
usize n);
3333
SANITIZER_INTERFACE_ATTRIBUTE void *__sanitizer_internal_memmove(
34-
void *dest, const void *src, uptr n);
34+
void *dest, const void *src, usize n);
3535
SANITIZER_INTERFACE_ATTRIBUTE void *__sanitizer_internal_memset(void *s, int c,
36-
uptr n);
36+
usize n);
3737
} // extern "C"
3838

3939
// String functions

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ uptr internal_mremap(void *old_address, usize old_size, usize new_size, int flag
233233
}
234234
#endif
235235

236-
int internal_mprotect(void *addr, uptr length, int prot) {
236+
int internal_mprotect(void *addr, usize length, int prot) {
237237
return internal_syscall(SYSCALL(mprotect), (uptr)addr, length, prot);
238238
}
239239

240-
int internal_madvise(uptr addr, uptr length, int advice) {
240+
int internal_madvise(uptr addr, usize length, int advice) {
241241
return internal_syscall(SYSCALL(madvise), addr, length, advice);
242242
}
243243

@@ -480,7 +480,7 @@ usize internal_dup2(int oldfd, int newfd) {
480480
#endif
481481
}
482482

483-
usize internal_readlink(const char *path, char *buf, uptr bufsize) {
483+
usize internal_readlink(const char *path, char *buf, usize bufsize) {
484484
# if SANITIZER_LINUX
485485
return internal_syscall(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, (uptr)buf,
486486
bufsize);
@@ -1172,7 +1172,7 @@ usize GetPageSize() {
11721172
}
11731173
#endif // !SANITIZER_ANDROID
11741174

1175-
uptr ReadBinaryName(/*out*/char *buf, uptr buf_len) {
1175+
usize ReadBinaryName(/*out*/char *buf, usize buf_len) {
11761176
#if SANITIZER_SOLARIS
11771177
const char *default_module_name = getexecname();
11781178
CHECK_NE(default_module_name, NULL);

compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
namespace __sanitizer {
4141

4242
#if SANITIZER_FREEBSD
43-
void GetMemoryProfile(fill_profile_f cb, uptr *stats) {
43+
void GetMemoryProfile(fill_profile_f cb, usize *stats) {
4444
const int Mib[] = {
4545
CTL_KERN,
4646
KERN_PROC,

0 commit comments

Comments
 (0)