Cross-build support for mksigname and mksiglist

We must build these with the host C compiler but use the target
preprocessor to generate the output.
This commit is contained in:
Todd C. Miller
2021-08-19 09:50:05 -06:00
parent bf7d20b482
commit b40f74cb24
12 changed files with 1391 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: ISC
*
* Copyright (c) 2010-2012, 2015 Todd C. Miller <Todd.Miller@sudo.ws>
* Copyright (c) 2010-2012, 2015, 2021 Todd C. Miller <Todd.Miller@sudo.ws>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -34,21 +34,16 @@ sudo_dso_public int main(int argc, char *argv[]);
int
main(int argc, char *argv[])
{
static char *sudo_sys_siglist[NSIG];
int i;
unsigned int i;
#include "mksiglist.h"
printf("#include <config.h>\n");
printf("#include <sys/types.h>\n");
printf("#include <signal.h>\n");
printf("#include \"sudo_compat.h\"\n\n");
printf("const char *const sudo_sys_siglist[NSIG] = {\n");
for (i = 0; i < NSIG; i++) {
printf("const char *const sudo_sys_siglist[] = {\n");
for (i = 0; i < nitems(sudo_sys_siglist); i++) {
if (sudo_sys_siglist[i] != NULL) {
printf(" \"%s\",\n", sudo_sys_siglist[i]);
} else {
printf(" \"Signal %d\",\n", i);
printf(" \"Signal %u\",\n", i);
}
}
printf("};\n");