From e3311cebdb29a3267843cf656a32f01c5062897e Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 25 Oct 2020 09:49:29 +0100 Subject: [PATCH] Fix GCC 10+ build GCC 10 changed the default option from `-fcommon` to `-fno-common`. A quick and dirty fix could be to just set `-fcommon` in CMakeLists.txt, but the proper fix is to move the variables to a single compilation unit and simply reference them in the other CU, instead of each CU having its own copy. Signed-off-by: Eric Engestrom --- process.c | 3 +++ process.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/process.c b/process.c index 59bdf10..8ccbf34 100644 --- a/process.c +++ b/process.c @@ -127,6 +127,9 @@ static int pid_to_cmd(pid_t pid, char *cmd, size_t cmd_size) #error "Please provide a pid_to_cmd for your platform" #endif +int ARGC; +char **ARGV; + void process_set_name(const char *name) { size_t argslen = 0; diff --git a/process.h b/process.h index 58c2480..4cc2cf4 100644 --- a/process.h +++ b/process.h @@ -4,8 +4,8 @@ #include #include -int ARGC; -char **ARGV; +extern int ARGC; +extern char **ARGV; void process_set_name(const char *name); void process_disable_ptrace(void);