From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Willy Tarreau <w@1wt.eu>,
"Paul E . McKenney" <paulmck@kernel.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 6.1 29/53] tools/nolibc: fix missing includes causing build issues at -O0
Date: Mon, 16 Jan 2023 09:01:29 -0500 [thread overview]
Message-ID: <20230116140154.114951-29-sashal@kernel.org> (raw)
In-Reply-To: <20230116140154.114951-1-sashal@kernel.org>
From: Willy Tarreau <w@1wt.eu>
[ Upstream commit 55abdd1f5e1e07418bf4a46c233a92f83cb5ae97 ]
After the nolibc includes were split to facilitate portability from
standard libcs, programs that include only what they need may miss
some symbols which are needed by libgcc. This is the case for raise()
which is needed by the divide by zero code in some architectures for
example.
Regardless, being able to include only the apparently needed files is
convenient.
Instead of trying to move all exported definitions to a single file,
since this can change over time, this patch takes another approach
consisting in including the nolibc header at the end of all standard
include files. This way their types and functions are already known
at the moment of inclusion, and including any single one of them is
sufficient to bring all the required ones.
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/include/nolibc/ctype.h | 3 +++
tools/include/nolibc/errno.h | 3 +++
tools/include/nolibc/signal.h | 3 +++
tools/include/nolibc/stdio.h | 3 +++
tools/include/nolibc/stdlib.h | 3 +++
tools/include/nolibc/string.h | 3 +++
tools/include/nolibc/sys.h | 2 ++
tools/include/nolibc/time.h | 3 +++
tools/include/nolibc/types.h | 3 +++
tools/include/nolibc/unistd.h | 3 +++
10 files changed, 29 insertions(+)
diff --git a/tools/include/nolibc/ctype.h b/tools/include/nolibc/ctype.h
index e3000b2992d7..6f90706d0644 100644
--- a/tools/include/nolibc/ctype.h
+++ b/tools/include/nolibc/ctype.h
@@ -96,4 +96,7 @@ int ispunct(int c)
return isgraph(c) && !isalnum(c);
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_CTYPE_H */
diff --git a/tools/include/nolibc/errno.h b/tools/include/nolibc/errno.h
index 06893d6dfb7a..9dc4919c769b 100644
--- a/tools/include/nolibc/errno.h
+++ b/tools/include/nolibc/errno.h
@@ -24,4 +24,7 @@ static int errno;
*/
#define MAX_ERRNO 4095
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_ERRNO_H */
diff --git a/tools/include/nolibc/signal.h b/tools/include/nolibc/signal.h
index ef47e71e2be3..137552216e46 100644
--- a/tools/include/nolibc/signal.h
+++ b/tools/include/nolibc/signal.h
@@ -19,4 +19,7 @@ int raise(int signal)
return sys_kill(sys_getpid(), signal);
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_SIGNAL_H */
diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h
index a3cebc4bc3ac..96ac8afc5aee 100644
--- a/tools/include/nolibc/stdio.h
+++ b/tools/include/nolibc/stdio.h
@@ -303,4 +303,7 @@ void perror(const char *msg)
fprintf(stderr, "%s%serrno=%d\n", (msg && *msg) ? msg : "", (msg && *msg) ? ": " : "", errno);
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_STDIO_H */
diff --git a/tools/include/nolibc/stdlib.h b/tools/include/nolibc/stdlib.h
index 92378c4b9660..a24000d1e822 100644
--- a/tools/include/nolibc/stdlib.h
+++ b/tools/include/nolibc/stdlib.h
@@ -419,4 +419,7 @@ char *u64toa(uint64_t in)
return itoa_buffer;
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_STDLIB_H */
diff --git a/tools/include/nolibc/string.h b/tools/include/nolibc/string.h
index ad97c0d522b8..0932db3817d2 100644
--- a/tools/include/nolibc/string.h
+++ b/tools/include/nolibc/string.h
@@ -285,4 +285,7 @@ char *strrchr(const char *s, int c)
return (char *)ret;
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_STRING_H */
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
index ce3ee03aa679..78473d34e27c 100644
--- a/tools/include/nolibc/sys.h
+++ b/tools/include/nolibc/sys.h
@@ -1243,5 +1243,7 @@ ssize_t write(int fd, const void *buf, size_t count)
return ret;
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
#endif /* _NOLIBC_SYS_H */
diff --git a/tools/include/nolibc/time.h b/tools/include/nolibc/time.h
index d18b7661fdd7..84655361b9ad 100644
--- a/tools/include/nolibc/time.h
+++ b/tools/include/nolibc/time.h
@@ -25,4 +25,7 @@ time_t time(time_t *tptr)
return tv.tv_sec;
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_TIME_H */
diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index f1d64fca7cf0..fbbc0e68c001 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -209,4 +209,7 @@ struct stat {
})
#endif
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_TYPES_H */
diff --git a/tools/include/nolibc/unistd.h b/tools/include/nolibc/unistd.h
index 1c25e20ee360..1cfcd52106a4 100644
--- a/tools/include/nolibc/unistd.h
+++ b/tools/include/nolibc/unistd.h
@@ -51,4 +51,7 @@ int tcsetpgrp(int fd, pid_t pid)
return ioctl(fd, TIOCSPGRP, &pid);
}
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
#endif /* _NOLIBC_UNISTD_H */
--
2.35.1
next prev parent reply other threads:[~2023-01-16 14:06 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 14:01 [PATCH AUTOSEL 6.1 01/53] scsi: iscsi: Fix multiple iSCSI session unbind events sent to userspace Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 02/53] ASoC: SOF: pm: Set target state earlier Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 03/53] ASoC: SOF: pm: Always tear down pipelines before DSP suspend Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 04/53] ASoC: SOF: Add FW state to debugfs Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 05/53] ASoC: amd: yc: Add Razer Blade 14 2022 into DMI table Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 06/53] spi: cadence: Fix busy cycles calculation Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 07/53] cpufreq: CPPC: Add u64 casts to avoid overflowing Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 08/53] cpufreq: Add Tegra234 to cpufreq-dt-platdev blocklist Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 09/53] ASoC: mediatek: mt8186: support rt5682s_max98360 Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 10/53] ASoC: mediatek: mt8186: Add machine support for max98357a Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 11/53] ASoC: amd: yc: Add ASUS M5402RA into DMI table Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 12/53] ASoC: support machine driver with max98360 Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 13/53] kcsan: test: don't put the expect array on the stack Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 14/53] cpufreq: Add SM6375 to cpufreq-dt-platdev blocklist Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 15/53] ASoC: fsl_micfil: Correct the number of steps on SX controls Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 16/53] drm/msm/a6xx: Avoid gx gbit halt during rpm suspend Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 17/53] net: usb: cdc_ether: add support for Thales Cinterion PLS62-W modem Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 18/53] drm: Add orientation quirk for Lenovo ideapad D330-10IGL Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 19/53] s390/debug: add _ASM_S390_ prefix to header guard Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 20/53] s390: expicitly align _edata and _end symbols on page boundary Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 21/53] xen/pvcalls: free active map buffer on pvcalls_front_free_map Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 22/53] perf/x86/cstate: Add Meteor Lake support Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 23/53] perf/x86/msr: " Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 24/53] perf/x86/msr: Add Emerald Rapids Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 25/53] perf/x86/intel/uncore: " Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 26/53] arm64/mm: Define dummy pud_user_exec() when using 2-level page-table Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 27/53] nolibc: fix fd_set type Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 28/53] tools/nolibc: Fix S_ISxxx macros Sasha Levin
2023-01-16 14:01 ` Sasha Levin [this message]
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 30/53] tools/nolibc: prevent gcc from making memset() loop over itself Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 31/53] cpufreq: armada-37xx: stop using 0 as NULL pointer Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 32/53] ASoC: fsl_ssi: Rename AC'97 streams to avoid collisions with AC'97 CODEC Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 33/53] ASoC: fsl-asoc-card: Fix naming of AC'97 CODEC widgets Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 34/53] ACPI: resource: Skip IRQ override on Asus Expertbook B2402CBA Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 35/53] drm/amdkfd: Add sync after creating vram bo Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 36/53] drm/amdkfd: Fix NULL pointer error for GC 11.0.1 on mGPU Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 37/53] cifs: fix potential memory leaks in session setup Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 38/53] spi: spidev: fix a race condition when accessing spidev->spi Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 39/53] spi: spidev: remove debug messages that access spidev->spi without locking Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 40/53] KVM: s390: interrupt: use READ_ONCE() before cmpxchg() Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 41/53] scsi: hisi_sas: Use abort task set to reset SAS disks when discovered Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 42/53] scsi: hisi_sas: Set a port invalid only if there are no devices attached when refreshing port id Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 43/53] r8152: add vendor/device ID pair for Microsoft Devkit Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 44/53] platform/x86: touchscreen_dmi: Add info for the CSL Panther Tab HD Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 45/53] platform/x86: asus-nb-wmi: Add alternate mapping for KEY_CAMERA Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 46/53] platform/x86: asus-nb-wmi: Add alternate mapping for KEY_SCREENLOCK Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 47/53] platform/x86: asus-wmi: Add quirk wmi_ignore_fan Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 48/53] platform/x86: asus-wmi: Ignore fan on E410MA Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 49/53] platform/x86: simatic-ipc: correct name of a model Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 50/53] platform/x86: simatic-ipc: add another model Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 51/53] lockref: stop doing cpu_relax in the cmpxchg loop Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 52/53] ata: pata_cs5535: Don't build on UML Sasha Levin
2023-01-16 14:01 ` [PATCH AUTOSEL 6.1 53/53] firmware: coreboot: Check size of table entry and use flex-array Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230116140154.114951-29-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=stable@vger.kernel.org \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®