From 98f21e694a6b0964d6d08196cb6bfbc1c2ae2ff4 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 5 Jul 2024 00:02:53 +0300 Subject: fix some small build issues + Compiling for size emits memcpy() calls after they've already been removed by LTO, so add __used attribute to counteract this. Newer versions of GCC seem to prefer `-flto=auto` to just `-flto`, so use that. printf format %d -> %ld --- src/string.c | 3 ++- src/uapi/ipc.c | 3 ++- src/uapi/proc.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/string.c b/src/string.c index 8c88e65..4eaaf68 100644 --- a/src/string.c +++ b/src/string.c @@ -287,7 +287,8 @@ __weak void *memchr(const void *ptr, int val, size_t num) } #undef memcpy -__weak void *memcpy(void * restrict dst, const void * restrict src, size_t num) +__weak __used void *memcpy(void * restrict dst, const void * restrict src, + size_t num) { const char *m1 = (const char *)src; char *m2 = (char *)dst; diff --git a/src/uapi/ipc.c b/src/uapi/ipc.c index ddc7242..3c24f1c 100644 --- a/src/uapi/ipc.c +++ b/src/uapi/ipc.c @@ -153,7 +153,8 @@ static __noreturn void __run_notify(struct tcb *t, struct tcb *r) /* if we're in the root process, we can safely handle signals and * becoming orphaned */ if (!is_rpc(t)) - set_bits(flags, t->notify_flags & (NOTIFY_SIGNAL | NOTIFY_ORPHANED)); + set_bits(flags, + t->notify_flags & (NOTIFY_SIGNAL | NOTIFY_ORPHANED)); /* handle critical notifications with special care */ if (is_set(t->notify_flags, NOTIFY_IRQ | NOTIFY_TIMER)) { diff --git a/src/uapi/proc.c b/src/uapi/proc.c index 5b64dce..85acb29 100644 --- a/src/uapi/proc.c +++ b/src/uapi/proc.c @@ -97,7 +97,7 @@ SYSCALL_DEFINE2(exec)(struct tcb *t, sys_arg_t bin, sys_arg_t interp) /* exec is only allowed if we own all our own resources */ if (t->refcount) - return_args1(t, ERR_INVAL) + return_args1(t, ERR_INVAL); /* mark binary to be kept */ struct mem_region *b = find_used_region(&t->sp_r, bin); @@ -267,7 +267,8 @@ SYSCALL_DEFINE1(detach)(struct tcb *t, sys_arg_t tid) orphanize(o); /* generally the thread shouldn't do anything with this information, but - * it fits really nicely into the notification framework so just do it */ + * it fits really nicely into the notification framework so just do it + */ notify(o, NOTIFY_ORPHANED); return_args1(t, OK); -- cgit v1.3