From a33e986417e09a7456c55be63283e6721100864f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Sat, 28 Mar 2020 04:02:00 +0000 Subject: [PATCH] config(8): fixes for -fno-common Move this handful of definitions into main.c, properly declare these as extern in config.h. This fixes the config(8) build with -fno-common. Unexplained in my previous commit to gas, -fno-common will become the default in GCC10 and LLVM11, so it's worth addressing these in advance. MFC after: 3 days --- usr.sbin/config/config.h | 18 +++++++++--------- usr.sbin/config/main.c | 11 +++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index facef5f33102..66da254b6d70 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -45,7 +45,7 @@ struct cfgfile { STAILQ_ENTRY(cfgfile) cfg_next; char *cfg_path; }; -STAILQ_HEAD(, cfgfile) cfgfiles; +extern STAILQ_HEAD(cfgfile_head, cfgfile) cfgfiles; struct file_list { STAILQ_ENTRY(file_list) f_next; @@ -103,8 +103,8 @@ struct config { * in the makerules, etc. machinearch is the global notion of the * MACHINE_ARCH for this MACHINE. */ -char *machinename; -char *machinearch; +extern char *machinename; +extern char *machinearch; /* * For each machine, a set of CPU's may be specified as supported. @@ -115,7 +115,7 @@ struct cputype { SLIST_ENTRY(cputype) cpu_next; }; -SLIST_HEAD(, cputype) cputype; +extern SLIST_HEAD(cputype_head, cputype) cputype; /* * A set of options may also be specified which are like CPU types, @@ -131,7 +131,7 @@ struct opt { SLIST_ENTRY(opt) op_append; }; -SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; +extern SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; struct opt_list { char *o_name; @@ -141,7 +141,7 @@ struct opt_list { SLIST_ENTRY(opt_list) o_next; }; -SLIST_HEAD(, opt_list) otab; +extern SLIST_HEAD(opt_list_head, opt_list) otab; struct envvar { char *env_str; @@ -149,21 +149,21 @@ struct envvar { STAILQ_ENTRY(envvar) envvar_next; }; -STAILQ_HEAD(envvar_head, envvar) envvars; +extern STAILQ_HEAD(envvar_head, envvar) envvars; struct hint { char *hint_name; STAILQ_ENTRY(hint) hint_next; }; -STAILQ_HEAD(hint_head, hint) hints; +extern STAILQ_HEAD(hint_head, hint) hints; struct includepath { char *path; SLIST_ENTRY(includepath) path_next; }; -SLIST_HEAD(, includepath) includepath; +extern SLIST_HEAD(includepath_head, includepath) includepath; /* * Tag present in the kernconf.tmpl template file. It's mandatory for those diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index a4f75021a034..ba5c54bce3a9 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -72,6 +72,17 @@ static const char rcsid[] = #define CDIR "../compile/" +char *machinename; +char *machinearch; + +struct cfgfile_head cfgfiles; +struct cputype_head cputype; +struct opt_head opt, mkopt, rmopts; +struct opt_list_head otab; +struct envvar_head envvars; +struct hint_head hints; +struct includepath_head includepath; + char * PREFIX; char destdir[MAXPATHLEN]; char srcdir[MAXPATHLEN];