aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-25 16:40:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-25 16:40:38 -0400
commit1bc276775d93faf42a3bb1c684cdb838ded8be56 (patch)
tree7f822bffe2487d71057f0d9f008eef158b636c57 /scripts
parentb8dcdab36f5394a09b66516057cccf61a81a3877 (diff)
parentd503ac531a5246e4d910f971b213807fea925956 (diff)
Merge tag 'kbuild-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull more Kbuild updates from Masahiro Yamada: - add build_{menu,n,g,x}config targets for compile-testing Kconfig - fix and improve recursive dependency detection in Kconfig - fix parallel building of menuconfig/nconfig - fix syntax error in clang-version.sh - suppress distracting log from syncconfig - remove obsolete "rpm" target - remove VMLINUX_SYMBOL(_STR) macro entirely - fix microblaze build with CONFIG_DYNAMIC_FTRACE - move compiler test for dead code/data elimination to Kconfig - rename well-known LDFLAGS variable to KBUILD_LDFLAGS - misc fixes and cleanups * tag 'kbuild-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: rename LDFLAGS to KBUILD_LDFLAGS kbuild: pass LDFLAGS to recordmcount.pl kbuild: test dead code/data elimination support in Kconfig initramfs: move gen_initramfs_list.sh from scripts/ to usr/ vmlinux.lds.h: remove stale <linux/export.h> include export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR() Coccinelle: remove pci_alloc_consistent semantic to detect in zalloc-simple.cocci kbuild: make sorting initramfs contents independent of locale kbuild: remove "rpm" target, which is alias of "rpm-pkg" kbuild: Fix LOADLIBES rename in Documentation/kbuild/makefiles.txt kconfig: suppress "configuration written to .config" for syncconfig kconfig: fix "Can't open ..." in parallel build kbuild: Add a space after `!` to prevent parsing as file pattern scripts: modpost: check memory allocation results kconfig: improve the recursive dependency report kconfig: report recursive dependency involving 'imply' kconfig: error out when seeing recursive dependency kconfig: add build-only configurator targets scripts/dtc: consolidate include path options in Makefile
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include4
-rw-r--r--scripts/Makefile.build6
-rw-r--r--scripts/Makefile.lib2
-rw-r--r--scripts/Makefile.modpost2
-rwxr-xr-xscripts/clang-version.sh2
-rw-r--r--scripts/coccinelle/api/alloc/zalloc-simple.cocci41
-rw-r--r--scripts/dtc/Makefile18
-rwxr-xr-xscripts/gen_initramfs_list.sh328
-rw-r--r--scripts/kconfig/Makefile16
-rw-r--r--scripts/kconfig/conf.c5
-rw-r--r--scripts/kconfig/symbol.c58
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/Kconfig (renamed from scripts/kconfig/tests/warn_recursive_dep/Kconfig)3
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/__init__.py10
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/expected_stderr38
-rw-r--r--scripts/kconfig/tests/warn_recursive_dep/__init__.py9
-rw-r--r--scripts/kconfig/tests/warn_recursive_dep/expected_stderr30
-rwxr-xr-xscripts/link-vmlinux.sh4
-rw-r--r--scripts/mod/modpost.c8
18 files changed, 127 insertions, 457 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 7c98f60e2266..c75413d05a63 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -163,8 +163,8 @@ cc-ldoption = $(call try-run,\
163 $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) 163 $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
164 164
165# ld-option 165# ld-option
166# Usage: LDFLAGS += $(call ld-option, -X, -Y) 166# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
167ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3)) 167ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
168 168
169# ar-option 169# ar-option
170# Usage: KBUILD_ARFLAGS := $(call ar-option,D) 170# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 93b8e24b0e15..1c48572223d1 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -190,7 +190,7 @@ cmd_modversions_c = \
190 $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ 190 $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
191 > $(@D)/.tmp_$(@F:.o=.ver); \ 191 > $(@D)/.tmp_$(@F:.o=.ver); \
192 \ 192 \
193 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 193 $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
194 -T $(@D)/.tmp_$(@F:.o=.ver); \ 194 -T $(@D)/.tmp_$(@F:.o=.ver); \
195 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 195 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
196 else \ 196 else \
@@ -220,7 +220,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
220 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ 220 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
221 "$(if $(CONFIG_64BIT),64,32)" \ 221 "$(if $(CONFIG_64BIT),64,32)" \
222 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ 222 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
223 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ 223 "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
224 "$(if $(part-of-module),1,0)" "$(@)"; 224 "$(if $(part-of-module),1,0)" "$(@)";
225recordmcount_source := $(srctree)/scripts/recordmcount.pl 225recordmcount_source := $(srctree)/scripts/recordmcount.pl
226endif # BUILD_C_RECORDMCOUNT 226endif # BUILD_C_RECORDMCOUNT
@@ -394,7 +394,7 @@ cmd_modversions_S = \
394 $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ 394 $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
395 > $(@D)/.tmp_$(@F:.o=.ver); \ 395 > $(@D)/.tmp_$(@F:.o=.ver); \
396 \ 396 \
397 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 397 $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
398 -T $(@D)/.tmp_$(@F:.o=.ver); \ 398 -T $(@D)/.tmp_$(@F:.o=.ver); \
399 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 399 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
400 else \ 400 else \
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index df0fff252619..61e596650ed3 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -162,7 +162,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
162cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ 162cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
163 $(__cpp_flags) 163 $(__cpp_flags)
164 164
165ld_flags = $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) 165ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
166 166
167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes 167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
168 168
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index dd92dbbbaa68..7d4af0d0accb 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -120,7 +120,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
120# Step 6), final link of the modules with optional arch pass after final link 120# Step 6), final link of the modules with optional arch pass after final link
121quiet_cmd_ld_ko_o = LD [M] $@ 121quiet_cmd_ld_ko_o = LD [M] $@
122 cmd_ld_ko_o = \ 122 cmd_ld_ko_o = \
123 $(LD) -r $(LDFLAGS) \ 123 $(LD) -r $(KBUILD_LDFLAGS) \
124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ 124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
125 -o $@ $(filter-out FORCE,$^) ; \ 125 -o $@ $(filter-out FORCE,$^) ; \
126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh
index dbf0a31eb111..e65fbc3079d4 100755
--- a/scripts/clang-version.sh
+++ b/scripts/clang-version.sh
@@ -12,7 +12,7 @@
12 12
13compiler="$*" 13compiler="$*"
14 14
15if !( $compiler --version | grep -q clang) ; then 15if ! ( $compiler --version | grep -q clang) ; then
16 echo 0 16 echo 0
17 exit 1 17 exit 1
18fi 18fi
diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 92b20913055f..d819275b7fde 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -35,8 +35,7 @@ statement S;
35 35
36* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\| 36* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
37 kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\| 37 kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
38 devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\| 38 devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
39 kvmalloc_node(E1,...)\);
40 if ((x==NULL) || ...) S 39 if ((x==NULL) || ...) S
41* memset((T2)x,0,E1); 40* memset((T2)x,0,E1);
42 41
@@ -124,15 +123,6 @@ statement S;
124- x = (T)kvmalloc(E1,E2); 123- x = (T)kvmalloc(E1,E2);
125+ x = (T)kvzalloc(E1,E2); 124+ x = (T)kvzalloc(E1,E2);
126| 125|
127- x = pci_alloc_consistent(E2,E1,E3);
128+ x = pci_zalloc_consistent(E2,E1,E3);
129|
130- x = (T *)pci_alloc_consistent(E2,E1,E3);
131+ x = pci_zalloc_consistent(E2,E1,E3);
132|
133- x = (T)pci_alloc_consistent(E2,E1,E3);
134+ x = (T)pci_zalloc_consistent(E2,E1,E3);
135|
136- x = kvmalloc_node(E1,E2,E3); 126- x = kvmalloc_node(E1,E2,E3);
137+ x = kvzalloc_node(E1,E2,E3); 127+ x = kvzalloc_node(E1,E2,E3);
138| 128|
@@ -389,35 +379,6 @@ msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
389coccilib.report.print_report(p[0], msg) 379coccilib.report.print_report(p[0], msg)
390 380
391//----------------------------------------------------------------- 381//-----------------------------------------------------------------
392@r8 depends on org || report@
393type T, T2;
394expression x;
395expression E1,E2,E3;
396statement S;
397position p;
398@@
399
400 x = (T)pci_alloc_consistent@p(E2,E1,E3);
401 if ((x==NULL) || ...) S
402 memset((T2)x,0,E1);
403
404@script:python depends on org@
405p << r8.p;
406x << r8.x;
407@@
408
409msg="%s" % (x)
410msg_safe=msg.replace("[","@(").replace("]",")")
411coccilib.org.print_todo(p[0], msg_safe)
412
413@script:python depends on report@
414p << r8.p;
415x << r8.x;
416@@
417
418msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
419coccilib.report.print_report(p[0], msg)
420//-----------------------------------------------------------------
421@r9 depends on org || report@ 382@r9 depends on org || report@
422type T, T2; 383type T, T2;
423expression x; 384expression x;
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 9cac65b7419c..1c943e03eaf2 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -9,21 +9,11 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
9dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o 9dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
10 10
11# Source files need to get at the userspace version of libfdt_env.h to compile 11# Source files need to get at the userspace version of libfdt_env.h to compile
12HOST_EXTRACFLAGS := -I$(src)/libfdt
12 13
13HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt 14# Generated files need one more search path to include headers in source tree
14 15HOSTCFLAGS_dtc-lexer.lex.o := -I$(src)
15HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC) 16HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
16HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
17HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
18HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
19HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
20HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
21HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
22HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
23HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
24
25HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
26HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
27 17
28# dependencies on generated files need to be listed explicitly 18# dependencies on generated files need to be listed explicitly
29$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h 19$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
deleted file mode 100755
index 10e528b3a08f..000000000000
--- a/scripts/gen_initramfs_list.sh
+++ /dev/null
@@ -1,328 +0,0 @@
1#!/bin/sh
2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
4#
5# Released under the terms of the GNU GPL
6#
7# Generate a cpio packed initramfs. It uses gen_init_cpio to generate
8# the cpio archive, and then compresses it.
9# The script may also be used to generate the inputfile used for gen_init_cpio
10# This script assumes that gen_init_cpio is located in usr/ directory
11
12# error out on errors
13set -e
14
15usage() {
16cat << EOF
17Usage:
18$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
19 -o <file> Create compressed initramfs file named <file> using
20 gen_init_cpio and compressor depending on the extension
21 -u <uid> User ID to map to user ID 0 (root).
22 <uid> is only meaningful if <cpio_source> is a
23 directory. "squash" forces all files to uid 0.
24 -g <gid> Group ID to map to group ID 0 (root).
25 <gid> is only meaningful if <cpio_source> is a
26 directory. "squash" forces all files to gid 0.
27 <cpio_source> File list or directory for cpio archive.
28 If <cpio_source> is a .cpio file it will be used
29 as direct input to initramfs.
30 -d Output the default cpio list.
31
32All options except -o and -l may be repeated and are interpreted
33sequentially and immediately. -u and -g states are preserved across
34<cpio_source> options so an explicit "-u 0 -g 0" is required
35to reset the root/group mapping.
36EOF
37}
38
39# awk style field access
40# $1 - field number; rest is argument string
41field() {
42 shift $1 ; echo $1
43}
44
45list_default_initramfs() {
46 # echo usr/kinit/kinit
47 :
48}
49
50default_initramfs() {
51 cat <<-EOF >> ${output}
52 # This is a very simple, default initramfs
53
54 dir /dev 0755 0 0
55 nod /dev/console 0600 0 0 c 5 1
56 dir /root 0700 0 0
57 # file /kinit usr/kinit/kinit 0755 0 0
58 # slink /init kinit 0755 0 0
59 EOF
60}
61
62filetype() {
63 local argv1="$1"
64
65 # symlink test must come before file test
66 if [ -L "${argv1}" ]; then
67 echo "slink"
68 elif [ -f "${argv1}" ]; then
69 echo "file"
70 elif [ -d "${argv1}" ]; then
71 echo "dir"
72 elif [ -b "${argv1}" -o -c "${argv1}" ]; then
73 echo "nod"
74 elif [ -p "${argv1}" ]; then
75 echo "pipe"
76 elif [ -S "${argv1}" ]; then
77 echo "sock"
78 else
79 echo "invalid"
80 fi
81 return 0
82}
83
84list_print_mtime() {
85 :
86}
87
88print_mtime() {
89 local my_mtime="0"
90
91 if [ -e "$1" ]; then
92 my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1)
93 fi
94
95 echo "# Last modified: ${my_mtime}" >> ${output}
96 echo "" >> ${output}
97}
98
99list_parse() {
100 if [ -L "$1" ]; then
101 return
102 fi
103 echo "$1" | sed 's/:/\\:/g; s/$/ \\/'
104}
105
106# for each file print a line in following format
107# <filetype> <name> <path to file> <octal mode> <uid> <gid>
108# for links, devices etc the format differs. See gen_init_cpio for details
109parse() {
110 local location="$1"
111 local name="/${location#${srcdir}}"
112 # change '//' into '/'
113 name=$(echo "$name" | sed -e 's://*:/:g')
114 local mode="$2"
115 local uid="$3"
116 local gid="$4"
117 local ftype=$(filetype "${location}")
118 # remap uid/gid to 0 if necessary
119 [ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0
120 [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
121 local str="${mode} ${uid} ${gid}"
122
123 [ "${ftype}" = "invalid" ] && return 0
124 [ "${location}" = "${srcdir}" ] && return 0
125
126 case "${ftype}" in
127 "file")
128 str="${ftype} ${name} ${location} ${str}"
129 ;;
130 "nod")
131 local dev=`LC_ALL=C ls -l "${location}"`
132 local maj=`field 5 ${dev}`
133 local min=`field 6 ${dev}`
134 maj=${maj%,}
135
136 [ -b "${location}" ] && dev="b" || dev="c"
137
138 str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
139 ;;
140 "slink")
141 local target=`readlink "${location}"`
142 str="${ftype} ${name} ${target} ${str}"
143 ;;
144 *)
145 str="${ftype} ${name} ${str}"
146 ;;
147 esac
148
149 echo "${str}" >> ${output}
150
151 return 0
152}
153
154unknown_option() {
155 printf "ERROR: unknown option \"$arg\"\n" >&2
156 printf "If the filename validly begins with '-', " >&2
157 printf "then it must be prefixed\n" >&2
158 printf "by './' so that it won't be interpreted as an option." >&2
159 printf "\n" >&2
160 usage >&2
161 exit 1
162}
163
164list_header() {
165 :
166}
167
168header() {
169 printf "\n#####################\n# $1\n" >> ${output}
170}
171
172# process one directory (incl sub-directories)
173dir_filelist() {
174 ${dep_list}header "$1"
175
176 srcdir=$(echo "$1" | sed -e 's://*:/:g')
177 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | sort)
178
179 # If $dirlist is only one line, then the directory is empty
180 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
181 ${dep_list}print_mtime "$1"
182
183 echo "${dirlist}" | \
184 while read x; do
185 ${dep_list}parse ${x}
186 done
187 fi
188}
189
190# if only one file is specified and it is .cpio file then use it direct as fs
191# if a directory is specified then add all files in given direcotry to fs
192# if a regular file is specified assume it is in gen_initramfs format
193input_file() {
194 source="$1"
195 if [ -f "$1" ]; then
196 ${dep_list}header "$1"
197 is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\{0,1\}/cpio/')"
198 if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then
199 cpio_file=$1
200 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
201 [ ! -z ${dep_list} ] && echo "$1"
202 return 0
203 fi
204 if [ -z ${dep_list} ]; then
205 print_mtime "$1" >> ${output}
206 cat "$1" >> ${output}
207 else
208 echo "$1 \\"
209 cat "$1" | while read type dir file perm ; do
210 if [ "$type" = "file" ]; then
211 echo "$file \\";
212 fi
213 done
214 fi
215 elif [ -d "$1" ]; then
216 dir_filelist "$1"
217 else
218 echo " ${prog}: Cannot open '$1'" >&2
219 exit 1
220 fi
221}
222
223prog=$0
224root_uid=0
225root_gid=0
226dep_list=
227cpio_file=
228cpio_list=
229output="/dev/stdout"
230output_file=""
231is_cpio_compressed=
232compr="gzip -n -9 -f"
233
234arg="$1"
235case "$arg" in
236 "-l") # files included in initramfs - used by kbuild
237 dep_list="list_"
238 echo "deps_initramfs := $0 \\"
239 shift
240 ;;
241 "-o") # generate compressed cpio image named $1
242 shift
243 output_file="$1"
244 cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
245 output=${cpio_list}
246 echo "$output_file" | grep -q "\.gz$" \
247 && [ -x "`which gzip 2> /dev/null`" ] \
248 && compr="gzip -n -9 -f"
249 echo "$output_file" | grep -q "\.bz2$" \
250 && [ -x "`which bzip2 2> /dev/null`" ] \
251 && compr="bzip2 -9 -f"
252 echo "$output_file" | grep -q "\.lzma$" \
253 && [ -x "`which lzma 2> /dev/null`" ] \
254 && compr="lzma -9 -f"
255 echo "$output_file" | grep -q "\.xz$" \
256 && [ -x "`which xz 2> /dev/null`" ] \
257 && compr="xz --check=crc32 --lzma2=dict=1MiB"
258 echo "$output_file" | grep -q "\.lzo$" \
259 && [ -x "`which lzop 2> /dev/null`" ] \
260 && compr="lzop -9 -f"
261 echo "$output_file" | grep -q "\.lz4$" \
262 && [ -x "`which lz4 2> /dev/null`" ] \
263 && compr="lz4 -l -9 -f"
264 echo "$output_file" | grep -q "\.cpio$" && compr="cat"
265 shift
266 ;;
267esac
268while [ $# -gt 0 ]; do
269 arg="$1"
270 shift
271 case "$arg" in
272 "-u") # map $1 to uid=0 (root)
273 root_uid="$1"
274 [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
275 shift
276 ;;
277 "-g") # map $1 to gid=0 (root)
278 root_gid="$1"
279 [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
280 shift
281 ;;
282 "-d") # display default initramfs list
283 default_list="$arg"
284 ${dep_list}default_initramfs
285 ;;
286 "-h")
287 usage
288 exit 0
289 ;;
290 *)
291 case "$arg" in
292 "-"*)
293 unknown_option
294 ;;
295 *) # input file/dir - process it
296 input_file "$arg" "$#"
297 ;;
298 esac
299 ;;
300 esac
301done
302
303# If output_file is set we will generate cpio archive and compress it
304# we are careful to delete tmp files
305if [ ! -z ${output_file} ]; then
306 if [ -z ${cpio_file} ]; then
307 timestamp=
308 if test -n "$KBUILD_BUILD_TIMESTAMP"; then
309 timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)"
310 if test -n "$timestamp"; then
311 timestamp="-t $timestamp"
312 fi
313 fi
314 cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)"
315 usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile}
316 else
317 cpio_tfile=${cpio_file}
318 fi
319 rm ${cpio_list}
320 if [ "${is_cpio_compressed}" = "compressed" ]; then
321 cat ${cpio_tfile} > ${output_file}
322 else
323 (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
324 || (rm -f ${output_file} ; false)
325 fi
326 [ -z ${cpio_file} ] && rm ${cpio_tfile}
327fi
328exit 0
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 8d8791069abf..4a7bd2192073 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -3,7 +3,8 @@
3# Kernel configuration targets 3# Kernel configuration targets
4# These targets are used from top-level makefile 4# These targets are used from top-level makefile
5 5
6PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig 6PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \
7 build_menuconfig build_nconfig build_gconfig build_xconfig
7 8
8ifdef KBUILD_KCONFIG 9ifdef KBUILD_KCONFIG
9Kconfig := $(KBUILD_KCONFIG) 10Kconfig := $(KBUILD_KCONFIG)
@@ -33,6 +34,14 @@ config: $(obj)/conf
33nconfig: $(obj)/nconf 34nconfig: $(obj)/nconf
34 $< $(silent) $(Kconfig) 35 $< $(silent) $(Kconfig)
35 36
37build_menuconfig: $(obj)/mconf
38
39build_nconfig: $(obj)/nconf
40
41build_gconfig: $(obj)/gconf
42
43build_xconfig: $(obj)/qconf
44
36localyesconfig localmodconfig: $(obj)/conf 45localyesconfig localmodconfig: $(obj)/conf
37 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config 46 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
38 $(Q)if [ -f .config ]; then \ 47 $(Q)if [ -f .config ]; then \
@@ -169,7 +178,7 @@ HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
169HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 178HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
170HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 179HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
171 180
172$(obj)/nconf.o: $(obj)/.nconf-cfg 181$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg
173 182
174# mconf: Used for the menuconfig target based on lxdialog 183# mconf: Used for the menuconfig target based on lxdialog
175hostprogs-y += mconf 184hostprogs-y += mconf
@@ -180,7 +189,8 @@ HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
180$(foreach f, mconf.o $(lxdialog), \ 189$(foreach f, mconf.o $(lxdialog), \
181 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) 190 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))
182 191
183$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg 192$(obj)/mconf.o: $(obj)/.mconf-cfg
193$(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg
184 194
185# qconf: Used for the xconfig target based on Qt 195# qconf: Used for the xconfig target based on Qt
186hostprogs-y += qconf 196hostprogs-y += qconf
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index b35cc9303979..7b2b37260669 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -508,6 +508,11 @@ int main(int ac, char **av)
508 input_mode = (enum input_mode)opt; 508 input_mode = (enum input_mode)opt;
509 switch (opt) { 509 switch (opt) {
510 case syncconfig: 510 case syncconfig:
511 /*
512 * syncconfig is invoked during the build stage.
513 * Suppress distracting "configuration written to ..."
514 */
515 conf_set_message_callback(NULL);
511 sync_kconfig = 1; 516 sync_kconfig = 1;
512 break; 517 break;
513 case defconfig: 518 case defconfig:
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 4ec8b1f0d42c..703b9b899ee9 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1011,7 +1011,7 @@ static struct dep_stack {
1011 struct dep_stack *prev, *next; 1011 struct dep_stack *prev, *next;
1012 struct symbol *sym; 1012 struct symbol *sym;
1013 struct property *prop; 1013 struct property *prop;
1014 struct expr *expr; 1014 struct expr **expr;
1015} *check_top; 1015} *check_top;
1016 1016
1017static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) 1017static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
@@ -1076,31 +1076,42 @@ static void sym_check_print_recursive(struct symbol *last_sym)
1076 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", 1076 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
1077 prop->file->name, prop->lineno); 1077 prop->file->name, prop->lineno);
1078 1078
1079 if (stack->expr) { 1079 if (sym_is_choice(sym)) {
1080 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", 1080 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
1081 prop->file->name, prop->lineno, 1081 menu->file->name, menu->lineno,
1082 sym->name ? sym->name : "<choice>", 1082 sym->name ? sym->name : "<choice>",
1083 prop_get_type_name(prop->type),
1084 next_sym->name ? next_sym->name : "<choice>"); 1083 next_sym->name ? next_sym->name : "<choice>");
1085 } else if (stack->prop) { 1084 } else if (sym_is_choice_value(sym)) {
1085 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
1086 menu->file->name, menu->lineno,
1087 sym->name ? sym->name : "<choice>",
1088 next_sym->name ? next_sym->name : "<choice>");
1089 } else if (stack->expr == &sym->dir_dep.expr) {
1086 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n", 1090 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
1087 prop->file->name, prop->lineno, 1091 prop->file->name, prop->lineno,
1088 sym->name ? sym->name : "<choice>", 1092 sym->name ? sym->name : "<choice>",
1089 next_sym->name ? next_sym->name : "<choice>"); 1093 next_sym->name ? next_sym->name : "<choice>");
1090 } else if (sym_is_choice(sym)) { 1094 } else if (stack->expr == &sym->rev_dep.expr) {
1091 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", 1095 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
1092 menu->file->name, menu->lineno, 1096 prop->file->name, prop->lineno,
1093 sym->name ? sym->name : "<choice>", 1097 sym->name ? sym->name : "<choice>",
1094 next_sym->name ? next_sym->name : "<choice>"); 1098 next_sym->name ? next_sym->name : "<choice>");
1095 } else if (sym_is_choice_value(sym)) { 1099 } else if (stack->expr == &sym->implied.expr) {
1096 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", 1100 fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n",
1097 menu->file->name, menu->lineno, 1101 prop->file->name, prop->lineno,
1102 sym->name ? sym->name : "<choice>",
1103 next_sym->name ? next_sym->name : "<choice>");
1104 } else if (stack->expr) {
1105 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
1106 prop->file->name, prop->lineno,
1098 sym->name ? sym->name : "<choice>", 1107 sym->name ? sym->name : "<choice>",
1108 prop_get_type_name(prop->type),
1099 next_sym->name ? next_sym->name : "<choice>"); 1109 next_sym->name ? next_sym->name : "<choice>");
1100 } else { 1110 } else {
1101 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", 1111 fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n",
1102 prop->file->name, prop->lineno, 1112 prop->file->name, prop->lineno,
1103 sym->name ? sym->name : "<choice>", 1113 sym->name ? sym->name : "<choice>",
1114 prop_get_type_name(prop->type),
1104 next_sym->name ? next_sym->name : "<choice>"); 1115 next_sym->name ? next_sym->name : "<choice>");
1105 } 1116 }
1106 } 1117 }
@@ -1157,12 +1168,26 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
1157 1168
1158 dep_stack_insert(&stack, sym); 1169 dep_stack_insert(&stack, sym);
1159 1170
1171 stack.expr = &sym->dir_dep.expr;
1172 sym2 = sym_check_expr_deps(sym->dir_dep.expr);
1173 if (sym2)
1174 goto out;
1175
1176 stack.expr = &sym->rev_dep.expr;
1160 sym2 = sym_check_expr_deps(sym->rev_dep.expr); 1177 sym2 = sym_check_expr_deps(sym->rev_dep.expr);
1161 if (sym2) 1178 if (sym2)
1162 goto out; 1179 goto out;
1163 1180
1181 stack.expr = &sym->implied.expr;
1182 sym2 = sym_check_expr_deps(sym->implied.expr);
1183 if (sym2)
1184 goto out;
1185
1186 stack.expr = NULL;
1187
1164 for (prop = sym->prop; prop; prop = prop->next) { 1188 for (prop = sym->prop; prop; prop = prop->next) {
1165 if (prop->type == P_CHOICE || prop->type == P_SELECT) 1189 if (prop->type == P_CHOICE || prop->type == P_SELECT ||
1190 prop->type == P_IMPLY)
1166 continue; 1191 continue;
1167 stack.prop = prop; 1192 stack.prop = prop;
1168 sym2 = sym_check_expr_deps(prop->visible.expr); 1193 sym2 = sym_check_expr_deps(prop->visible.expr);
@@ -1170,7 +1195,7 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
1170 break; 1195 break;
1171 if (prop->type != P_DEFAULT || sym_is_choice(sym)) 1196 if (prop->type != P_DEFAULT || sym_is_choice(sym))
1172 continue; 1197 continue;
1173 stack.expr = prop->expr; 1198 stack.expr = &prop->expr;
1174 sym2 = sym_check_expr_deps(prop->expr); 1199 sym2 = sym_check_expr_deps(prop->expr);
1175 if (sym2) 1200 if (sym2)
1176 break; 1201 break;
@@ -1248,9 +1273,6 @@ struct symbol *sym_check_deps(struct symbol *sym)
1248 sym->flags &= ~SYMBOL_CHECK; 1273 sym->flags &= ~SYMBOL_CHECK;
1249 } 1274 }
1250 1275
1251 if (sym2 && sym2 == sym)
1252 sym2 = NULL;
1253
1254 return sym2; 1276 return sym2;
1255} 1277}
1256 1278
diff --git a/scripts/kconfig/tests/warn_recursive_dep/Kconfig b/scripts/kconfig/tests/err_recursive_dep/Kconfig
index a65bfcb7137e..ebdb3ffd8717 100644
--- a/scripts/kconfig/tests/warn_recursive_dep/Kconfig
+++ b/scripts/kconfig/tests/err_recursive_dep/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1# depends on itself 3# depends on itself
2 4
3config A 5config A
@@ -31,7 +33,6 @@ config D2
31 bool 33 bool
32 34
33# depends on and imply 35# depends on and imply
34# This is not recursive dependency
35 36
36config E1 37config E1
37 bool "E1" 38 bool "E1"
diff --git a/scripts/kconfig/tests/err_recursive_dep/__init__.py b/scripts/kconfig/tests/err_recursive_dep/__init__.py
new file mode 100644
index 000000000000..5f3821b43ce6
--- /dev/null
+++ b/scripts/kconfig/tests/err_recursive_dep/__init__.py
@@ -0,0 +1,10 @@
1# SPDX-License-Identifier: GPL-2.0
2"""
3Detect recursive dependency error.
4
5Recursive dependency should be treated as an error.
6"""
7
8def test(conf):
9 assert conf.oldaskconfig() == 1
10 assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/err_recursive_dep/expected_stderr b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
new file mode 100644
index 000000000000..84679b104655
--- /dev/null
+++ b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
@@ -0,0 +1,38 @@
1Kconfig:11:error: recursive dependency detected!
2Kconfig:11: symbol B is selected by B
3For a resolution refer to Documentation/kbuild/kconfig-language.txt
4subsection "Kconfig recursive dependency limitations"
5
6Kconfig:5:error: recursive dependency detected!
7Kconfig:5: symbol A depends on A
8For a resolution refer to Documentation/kbuild/kconfig-language.txt
9subsection "Kconfig recursive dependency limitations"
10
11Kconfig:17:error: recursive dependency detected!
12Kconfig:17: symbol C1 depends on C2
13Kconfig:21: symbol C2 depends on C1
14For a resolution refer to Documentation/kbuild/kconfig-language.txt
15subsection "Kconfig recursive dependency limitations"
16
17Kconfig:32:error: recursive dependency detected!
18Kconfig:32: symbol D2 is selected by D1
19Kconfig:27: symbol D1 depends on D2
20For a resolution refer to Documentation/kbuild/kconfig-language.txt
21subsection "Kconfig recursive dependency limitations"
22
23Kconfig:37:error: recursive dependency detected!
24Kconfig:37: symbol E1 depends on E2
25Kconfig:42: symbol E2 is implied by E1
26For a resolution refer to Documentation/kbuild/kconfig-language.txt
27subsection "Kconfig recursive dependency limitations"
28
29Kconfig:60:error: recursive dependency detected!
30Kconfig:60: symbol G depends on G
31For a resolution refer to Documentation/kbuild/kconfig-language.txt
32subsection "Kconfig recursive dependency limitations"
33
34Kconfig:51:error: recursive dependency detected!
35Kconfig:51: symbol F2 depends on F1
36Kconfig:49: symbol F1 default value contains F2
37For a resolution refer to Documentation/kbuild/kconfig-language.txt
38subsection "Kconfig recursive dependency limitations"
diff --git a/scripts/kconfig/tests/warn_recursive_dep/__init__.py b/scripts/kconfig/tests/warn_recursive_dep/__init__.py
deleted file mode 100644
index adb21951ba41..000000000000
--- a/scripts/kconfig/tests/warn_recursive_dep/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
1"""
2Warn recursive inclusion.
3
4Recursive dependency should be warned.
5"""
6
7def test(conf):
8 assert conf.oldaskconfig() == 0
9 assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr
deleted file mode 100644
index 3de807dd9cb2..000000000000
--- a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr
+++ /dev/null
@@ -1,30 +0,0 @@
1Kconfig:9:error: recursive dependency detected!
2Kconfig:9: symbol B is selected by B
3For a resolution refer to Documentation/kbuild/kconfig-language.txt
4subsection "Kconfig recursive dependency limitations"
5
6Kconfig:3:error: recursive dependency detected!
7Kconfig:3: symbol A depends on A
8For a resolution refer to Documentation/kbuild/kconfig-language.txt
9subsection "Kconfig recursive dependency limitations"
10
11Kconfig:15:error: recursive dependency detected!
12Kconfig:15: symbol C1 depends on C2
13Kconfig:19: symbol C2 depends on C1
14For a resolution refer to Documentation/kbuild/kconfig-language.txt
15subsection "Kconfig recursive dependency limitations"
16
17Kconfig:30:error: recursive dependency detected!
18Kconfig:30: symbol D2 is selected by D1
19Kconfig:25: symbol D1 depends on D2
20For a resolution refer to Documentation/kbuild/kconfig-language.txt
21subsection "Kconfig recursive dependency limitations"
22
23Kconfig:59:error: recursive dependency detected!
24Kconfig:59: symbol G depends on G
25For a resolution refer to Documentation/kbuild/kconfig-language.txt
26subsection "Kconfig recursive dependency limitations"
27
28Kconfig:50:error: recursive dependency detected!
29Kconfig:50: symbol F2 depends on F1
30Kconfig:48: symbol F1 default value contains F2
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 4bf811c09f59..c8cf45362bd6 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -75,7 +75,7 @@ modpost_link()
75 ${KBUILD_VMLINUX_LIBS} \ 75 ${KBUILD_VMLINUX_LIBS} \
76 --end-group" 76 --end-group"
77 77
78 ${LD} ${LDFLAGS} -r -o ${1} ${objects} 78 ${LD} ${KBUILD_LDFLAGS} -r -o ${1} ${objects}
79} 79}
80 80
81# Link of vmlinux 81# Link of vmlinux
@@ -95,7 +95,7 @@ vmlinux_link()
95 --end-group \ 95 --end-group \
96 ${1}" 96 ${1}"
97 97
98 ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ 98 ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
99 -T ${lds} ${objects} 99 -T ${lds} ${objects}
100 else 100 else
101 objects="-Wl,--whole-archive \ 101 objects="-Wl,--whole-archive \
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index dc6d714e4dcb..0d998c54564d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -672,7 +672,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
672 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) 672 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER)
673 break; 673 break;
674 if (symname[0] == '.') { 674 if (symname[0] == '.') {
675 char *munged = strdup(symname); 675 char *munged = NOFAIL(strdup(symname));
676 munged[0] = '_'; 676 munged[0] = '_';
677 munged[1] = toupper(munged[1]); 677 munged[1] = toupper(munged[1]);
678 symname = munged; 678 symname = munged;
@@ -1318,7 +1318,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
1318static char *sec2annotation(const char *s) 1318static char *sec2annotation(const char *s)
1319{ 1319{
1320 if (match(s, init_exit_sections)) { 1320 if (match(s, init_exit_sections)) {
1321 char *p = malloc(20); 1321 char *p = NOFAIL(malloc(20));
1322 char *r = p; 1322 char *r = p;
1323 1323
1324 *p++ = '_'; 1324 *p++ = '_';
@@ -1338,7 +1338,7 @@ static char *sec2annotation(const char *s)
1338 strcat(p, " "); 1338 strcat(p, " ");
1339 return r; 1339 return r;
1340 } else { 1340 } else {
1341 return strdup(""); 1341 return NOFAIL(strdup(""));
1342 } 1342 }
1343} 1343}
1344 1344
@@ -2036,7 +2036,7 @@ void buf_write(struct buffer *buf, const char *s, int len)
2036{ 2036{
2037 if (buf->size - buf->pos < len) { 2037 if (buf->size - buf->pos < len) {
2038 buf->size += len + SZ; 2038 buf->size += len + SZ;
2039 buf->p = realloc(buf->p, buf->size); 2039 buf->p = NOFAIL(realloc(buf->p, buf->size));
2040 } 2040 }
2041 strncpy(buf->p + buf->pos, s, len); 2041 strncpy(buf->p + buf->pos, s, len);
2042 buf->pos += len; 2042 buf->pos += len;