diff options
| author | Willy Tarreau <w@1wt.eu> | 2018-09-09 07:33:02 -0400 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.ibm.com> | 2018-11-09 00:52:55 -0500 |
| commit | b94ec36896dafc0a12106b1536fe87f99e9a0c5d (patch) | |
| tree | 0e82bbcda7fd468e819c3b4c0cce649b5a660dd8 /tools | |
| parent | 66b6f755ad45d354c5b74abd258f67aa8b40b3c7 (diff) | |
rcutorture: Make use of nolibc when available
This reduces the size of the init executable from ~800 kB to ~800 bytes
on x86_64. This is only implemented for x86_64, i386, arm and arm64.
Others not tested.
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/testing/selftests/rcutorture/bin/mkinitrd.sh | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh index 56a56ea06983..da298394daa2 100755 --- a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh +++ b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh | |||
| @@ -82,8 +82,10 @@ cd $D | |||
| 82 | mkdir -p initrd | 82 | mkdir -p initrd |
| 83 | cd initrd | 83 | cd initrd |
| 84 | cat > init.c << '___EOF___' | 84 | cat > init.c << '___EOF___' |
| 85 | #ifndef NOLIBC | ||
| 85 | #include <unistd.h> | 86 | #include <unistd.h> |
| 86 | #include <sys/time.h> | 87 | #include <sys/time.h> |
| 88 | #endif | ||
| 87 | 89 | ||
| 88 | volatile unsigned long delaycount; | 90 | volatile unsigned long delaycount; |
| 89 | 91 | ||
| @@ -113,7 +115,21 @@ int main(int argc, int argv[]) | |||
| 113 | return 0; | 115 | return 0; |
| 114 | } | 116 | } |
| 115 | ___EOF___ | 117 | ___EOF___ |
| 116 | ${CROSS_COMPILE}gcc -s -static -Os -o init init.c | 118 | |
| 119 | # build using nolibc on supported archs (smaller executable) and fall | ||
| 120 | # back to regular glibc on other ones. | ||
| 121 | if echo -e "#if __x86_64__||__i386__||__i486__||__i586__||__i686__" \ | ||
| 122 | "||__ARM_EABI__||__aarch64__\nyes\n#endif" \ | ||
| 123 | | ${CROSS_COMPILE}gcc -E -nostdlib -xc - \ | ||
| 124 | | grep -q '^yes'; then | ||
| 125 | # architecture supported by nolibc | ||
| 126 | ${CROSS_COMPILE}gcc -fno-asynchronous-unwind-tables -fno-ident \ | ||
| 127 | -nostdlib -include ../bin/nolibc.h -lgcc -s -static -Os \ | ||
| 128 | -o init init.c | ||
| 129 | else | ||
| 130 | ${CROSS_COMPILE}gcc -s -static -Os -o init init.c | ||
| 131 | fi | ||
| 132 | |||
| 117 | rm init.c | 133 | rm init.c |
| 118 | echo "Done creating a statically linked C-language initrd" | 134 | echo "Done creating a statically linked C-language initrd" |
| 119 | 135 | ||
