> If the attribute to force it into .data isn't wanted the alternative > gets messy as config has a bunch of bogus types and casts and treats the > int values as longs.
Well, I believe that messiness is a result of trying to avoid the consequences of the ABI. I feel the ABI shouldn't be exposed here and changing the compilers is wrong... The -1 handling could be pushed to the very top. At the very first moment anything in ukc runs, set it to 0. No conditional logic later on. > Index: mkioconf.c > =================================================================== > RCS file: /cvs/src/usr.sbin/config/mkioconf.c,v > retrieving revision 1.36 > diff -u -p -r1.36 mkioconf.c > --- mkioconf.c 27 Oct 2016 14:33:30 -0000 1.36 > +++ mkioconf.c 14 Sep 2017 02:11:17 -0000 > @@ -183,7 +183,7 @@ static long loc[%d] = {", locators.used) > #endif\n\ > long extraloc[MAXEXTRALOC] = { -1 };\n\ > int nextraloc = MAXEXTRALOC;\n\ > -int uextraloc = 0;\n") < 0); > +int uextraloc = -1;\n") < 0); > } > > static int nlocnames, maxlocnames = 8; > Index: ukcutil.c > =================================================================== > RCS file: /cvs/src/usr.sbin/config/ukcutil.c,v > retrieving revision 1.22 > diff -u -p -r1.22 ukcutil.c > --- ukcutil.c 27 Oct 2016 14:32:10 -0000 1.22 > +++ ukcutil.c 14 Sep 2017 02:22:33 -0000 > @@ -419,6 +419,14 @@ change(int devno) > > j = (long *)adjust((caddr_t)nl[I_NEXTRALOC].n_value); > k = (long *)adjust((caddr_t)nl[I_UEXTRALOC].n_value); > + > + /* > + * uextraloc is initialised to -1 not 0 so it will be > + * put in .data instead of .bss so config can modify it > + */ > + if (*(int *)k == -1) > + *k = 0; > + > if ((i + *k) > *j) { > printf("Not enough space to change device.\n"); > return; > @@ -521,6 +529,14 @@ change_history(int devno, char *str) > > j = (long *)adjust((caddr_t)nl[I_NEXTRALOC].n_value); > k = (long *)adjust((caddr_t)nl[I_UEXTRALOC].n_value); > + > + /* > + * uextraloc is initialised to -1 not 0 so it will be > + * put in .data instead of .bss so config can modify it > + */ > + if (*(int *)k == -1) > + *k = 0; > + > if ((i + *k) > *j) { > printf("Not enough space to change device.\n"); > return;