Commit 0c05384a5a1af2352b8c244cf32f480ba6cbf024
Exists in
master
and in
39 other branches
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: mkuboot.sh: Fail if mkimage is missing gen_init_cpio: checkpatch fixes gen_init_cpio: Avoid race between call to stat() and call to open() modpost: Fix address calculation in reloc_location() Make fixdep error handling more explicit checksyscalls: Fix stand-alone usage modpost: Put .zdebug* section on white list kbuild: fix interaction of CONFIG_IKCONFIG and KCONFIG_CONFIG kbuild: export linux/{a.out,kvm,kvm_para}.h on headers_install_all kbuild: introduce HDR_ARCH_LIST for headers_install_all headers_install: check exit status of unifdef gen_init_cpio: remove leading `/' from file names scripts/genksyms: fix header usage fixdep: use hash table instead of a single array
Showing 13 changed files Side-by-side Diff
Documentation/make/headers_install.txt
... | ... | @@ -39,8 +39,9 @@ |
39 | 39 | The command "make headers_install_all" exports headers for all architectures |
40 | 40 | simultaneously. (This is mostly of interest to distribution maintainers, |
41 | 41 | who create an architecture-independent tarball from the resulting include |
42 | -directory.) Remember to provide the appropriate linux/asm directory via "mv" | |
43 | -or "ln -s" before building a C library with headers exported this way. | |
42 | +directory.) You also can use HDR_ARCH_LIST to specify list of architectures. | |
43 | +Remember to provide the appropriate linux/asm directory via "mv" or "ln -s" | |
44 | +before building a C library with headers exported this way. | |
44 | 45 | |
45 | 46 | The kernel header export infrastructure is maintained by David Woodhouse |
46 | 47 | <dwmw2@infradead.org>. |
Makefile
include/linux/Kbuild
... | ... | @@ -20,15 +20,18 @@ |
20 | 20 | objhdr-y += version.h |
21 | 21 | |
22 | 22 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ |
23 | - $(srctree)/include/asm-$(SRCARCH)/a.out.h),) | |
23 | + $(srctree)/include/asm-$(SRCARCH)/a.out.h \ | |
24 | + $(INSTALL_HDR_PATH)/include/asm-*/a.out.h),) | |
24 | 25 | header-y += a.out.h |
25 | 26 | endif |
26 | 27 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ |
27 | - $(srctree)/include/asm-$(SRCARCH)/kvm.h),) | |
28 | + $(srctree)/include/asm-$(SRCARCH)/kvm.h \ | |
29 | + $(INSTALL_HDR_PATH)/include/asm-*/kvm.h),) | |
28 | 30 | header-y += kvm.h |
29 | 31 | endif |
30 | 32 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \ |
31 | - $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),) | |
33 | + $(srctree)/include/asm-$(SRCARCH)/kvm_para.h \ | |
34 | + $(INSTALL_HDR_PATH)/include/asm-*/kvm_para.h),) | |
32 | 35 | header-y += kvm_para.h |
33 | 36 | endif |
34 | 37 |
kernel/Makefile
... | ... | @@ -121,7 +121,7 @@ |
121 | 121 | # config_data.h contains the same information as ikconfig.h but gzipped. |
122 | 122 | # Info from config_data can be extracted from /proc/config* |
123 | 123 | targets += config_data.gz |
124 | -$(obj)/config_data.gz: .config FORCE | |
124 | +$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE | |
125 | 125 | $(call if_changed,gzip) |
126 | 126 | |
127 | 127 | quiet_cmd_ikconfiggz = IKCFG $@ |
scripts/basic/fixdep.c
... | ... | @@ -138,38 +138,36 @@ |
138 | 138 | printf("cmd_%s := %s\n\n", target, cmdline); |
139 | 139 | } |
140 | 140 | |
141 | -char * str_config = NULL; | |
142 | -int size_config = 0; | |
143 | -int len_config = 0; | |
141 | +struct item { | |
142 | + struct item *next; | |
143 | + unsigned int len; | |
144 | + unsigned int hash; | |
145 | + char name[0]; | |
146 | +}; | |
144 | 147 | |
145 | -/* | |
146 | - * Grow the configuration string to a desired length. | |
147 | - * Usually the first growth is plenty. | |
148 | - */ | |
149 | -static void grow_config(int len) | |
148 | +#define HASHSZ 256 | |
149 | +static struct item *hashtab[HASHSZ]; | |
150 | + | |
151 | +static unsigned int strhash(const char *str, unsigned int sz) | |
150 | 152 | { |
151 | - while (len_config + len > size_config) { | |
152 | - if (size_config == 0) | |
153 | - size_config = 2048; | |
154 | - str_config = realloc(str_config, size_config *= 2); | |
155 | - if (str_config == NULL) | |
156 | - { perror("fixdep:malloc"); exit(1); } | |
157 | - } | |
153 | + /* fnv32 hash */ | |
154 | + unsigned int i, hash = 2166136261U; | |
155 | + | |
156 | + for (i = 0; i < sz; i++) | |
157 | + hash = (hash ^ str[i]) * 0x01000193; | |
158 | + return hash; | |
158 | 159 | } |
159 | 160 | |
160 | - | |
161 | - | |
162 | 161 | /* |
163 | 162 | * Lookup a value in the configuration string. |
164 | 163 | */ |
165 | -static int is_defined_config(const char * name, int len) | |
164 | +static int is_defined_config(const char *name, int len, unsigned int hash) | |
166 | 165 | { |
167 | - const char * pconfig; | |
168 | - const char * plast = str_config + len_config - len; | |
169 | - for ( pconfig = str_config + 1; pconfig < plast; pconfig++ ) { | |
170 | - if (pconfig[ -1] == '\n' | |
171 | - && pconfig[len] == '\n' | |
172 | - && !memcmp(pconfig, name, len)) | |
166 | + struct item *aux; | |
167 | + | |
168 | + for (aux = hashtab[hash % HASHSZ]; aux; aux = aux->next) { | |
169 | + if (aux->hash == hash && aux->len == len && | |
170 | + memcmp(aux->name, name, len) == 0) | |
173 | 171 | return 1; |
174 | 172 | } |
175 | 173 | return 0; |
176 | 174 | |
177 | 175 | |
... | ... | @@ -178,13 +176,19 @@ |
178 | 176 | /* |
179 | 177 | * Add a new value to the configuration string. |
180 | 178 | */ |
181 | -static void define_config(const char * name, int len) | |
179 | +static void define_config(const char *name, int len, unsigned int hash) | |
182 | 180 | { |
183 | - grow_config(len + 1); | |
181 | + struct item *aux = malloc(sizeof(*aux) + len); | |
184 | 182 | |
185 | - memcpy(str_config+len_config, name, len); | |
186 | - len_config += len; | |
187 | - str_config[len_config++] = '\n'; | |
183 | + if (!aux) { | |
184 | + perror("fixdep:malloc"); | |
185 | + exit(1); | |
186 | + } | |
187 | + memcpy(aux->name, name, len); | |
188 | + aux->len = len; | |
189 | + aux->hash = hash; | |
190 | + aux->next = hashtab[hash % HASHSZ]; | |
191 | + hashtab[hash % HASHSZ] = aux; | |
188 | 192 | } |
189 | 193 | |
190 | 194 | /* |
191 | 195 | |
192 | 196 | |
193 | 197 | |
194 | 198 | |
195 | 199 | |
196 | 200 | |
197 | 201 | |
198 | 202 | |
199 | 203 | |
200 | 204 | |
... | ... | @@ -192,40 +196,49 @@ |
192 | 196 | */ |
193 | 197 | static void clear_config(void) |
194 | 198 | { |
195 | - len_config = 0; | |
196 | - define_config("", 0); | |
199 | + struct item *aux, *next; | |
200 | + unsigned int i; | |
201 | + | |
202 | + for (i = 0; i < HASHSZ; i++) { | |
203 | + for (aux = hashtab[i]; aux; aux = next) { | |
204 | + next = aux->next; | |
205 | + free(aux); | |
206 | + } | |
207 | + hashtab[i] = NULL; | |
208 | + } | |
197 | 209 | } |
198 | 210 | |
199 | 211 | /* |
200 | 212 | * Record the use of a CONFIG_* word. |
201 | 213 | */ |
202 | -static void use_config(char *m, int slen) | |
214 | +static void use_config(const char *m, int slen) | |
203 | 215 | { |
204 | - char s[PATH_MAX]; | |
205 | - char *p; | |
216 | + unsigned int hash = strhash(m, slen); | |
217 | + int c, i; | |
206 | 218 | |
207 | - if (is_defined_config(m, slen)) | |
219 | + if (is_defined_config(m, slen, hash)) | |
208 | 220 | return; |
209 | 221 | |
210 | - define_config(m, slen); | |
222 | + define_config(m, slen, hash); | |
211 | 223 | |
212 | - memcpy(s, m, slen); s[slen] = 0; | |
213 | - | |
214 | - for (p = s; p < s + slen; p++) { | |
215 | - if (*p == '_') | |
216 | - *p = '/'; | |
224 | + printf(" $(wildcard include/config/"); | |
225 | + for (i = 0; i < slen; i++) { | |
226 | + c = m[i]; | |
227 | + if (c == '_') | |
228 | + c = '/'; | |
217 | 229 | else |
218 | - *p = tolower((int)*p); | |
230 | + c = tolower(c); | |
231 | + putchar(c); | |
219 | 232 | } |
220 | - printf(" $(wildcard include/config/%s.h) \\\n", s); | |
233 | + printf(".h) \\\n"); | |
221 | 234 | } |
222 | 235 | |
223 | -static void parse_config_file(char *map, size_t len) | |
236 | +static void parse_config_file(const char *map, size_t len) | |
224 | 237 | { |
225 | - int *end = (int *) (map + len); | |
238 | + const int *end = (const int *) (map + len); | |
226 | 239 | /* start at +1, so that p can never be < map */ |
227 | - int *m = (int *) map + 1; | |
228 | - char *p, *q; | |
240 | + const int *m = (const int *) map + 1; | |
241 | + const char *p, *q; | |
229 | 242 | |
230 | 243 | for (; m < end; m++) { |
231 | 244 | if (*m == INT_CONF) { p = (char *) m ; goto conf; } |
... | ... | @@ -265,7 +278,7 @@ |
265 | 278 | return memcmp(s + slen - sublen, sub, sublen); |
266 | 279 | } |
267 | 280 | |
268 | -static void do_config_file(char *filename) | |
281 | +static void do_config_file(const char *filename) | |
269 | 282 | { |
270 | 283 | struct stat st; |
271 | 284 | int fd; |
... | ... | @@ -273,7 +286,7 @@ |
273 | 286 | |
274 | 287 | fd = open(filename, O_RDONLY); |
275 | 288 | if (fd < 0) { |
276 | - fprintf(stderr, "fixdep: "); | |
289 | + fprintf(stderr, "fixdep: error opening config file: "); | |
277 | 290 | perror(filename); |
278 | 291 | exit(2); |
279 | 292 | } |
280 | 293 | |
... | ... | @@ -344,11 +357,15 @@ |
344 | 357 | |
345 | 358 | fd = open(depfile, O_RDONLY); |
346 | 359 | if (fd < 0) { |
347 | - fprintf(stderr, "fixdep: "); | |
360 | + fprintf(stderr, "fixdep: error opening depfile: "); | |
348 | 361 | perror(depfile); |
349 | 362 | exit(2); |
350 | 363 | } |
351 | - fstat(fd, &st); | |
364 | + if (fstat(fd, &st) < 0) { | |
365 | + fprintf(stderr, "fixdep: error fstat'ing depfile: "); | |
366 | + perror(depfile); | |
367 | + exit(2); | |
368 | + } | |
352 | 369 | if (st.st_size == 0) { |
353 | 370 | fprintf(stderr,"fixdep: %s is empty\n",depfile); |
354 | 371 | close(fd); |
scripts/checksyscalls.sh
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | # and listed below so they are ignored. |
7 | 7 | # |
8 | 8 | # Usage: |
9 | -# syscallchk gcc gcc-options | |
9 | +# checksyscalls.sh gcc gcc-options | |
10 | 10 | # |
11 | 11 | |
12 | 12 | ignore_list() { |
... | ... | @@ -204,6 +204,6 @@ |
204 | 204 | \#endif/p' $1 |
205 | 205 | } |
206 | 206 | |
207 | -(ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \ | |
207 | +(ignore_list && syscall_list $(dirname $0)/../arch/x86/include/asm/unistd_32.h) | \ | |
208 | 208 | $* -E -x c - > /dev/null |
scripts/genksyms/parse.c_shipped
scripts/genksyms/parse.y
scripts/headers.sh
scripts/headers_install.pl
... | ... | @@ -45,6 +45,13 @@ |
45 | 45 | close $in; |
46 | 46 | |
47 | 47 | system $unifdef . " $tmpfile > $installdir/$file"; |
48 | + # unifdef will exit 0 on success, and will exit 1 when the | |
49 | + # file was processed successfully but no changes were made, | |
50 | + # so abort only when it's higher than that. | |
51 | + my $e = $? >> 8; | |
52 | + if ($e > 1) { | |
53 | + die "$tmpfile: $!\n"; | |
54 | + } | |
48 | 55 | unlink $tmpfile; |
49 | 56 | } |
50 | 57 | exit 0; |
scripts/mkuboot.sh
scripts/mod/modpost.c
... | ... | @@ -790,6 +790,7 @@ |
790 | 790 | { |
791 | 791 | ".comment*", |
792 | 792 | ".debug*", |
793 | + ".zdebug*", /* Compressed debug sections. */ | |
793 | 794 | ".GCC-command-line", /* mn10300 */ |
794 | 795 | ".mdebug*", /* alpha, score, mips etc. */ |
795 | 796 | ".pdr", /* alpha, score, mips etc. */ |
... | ... | @@ -1441,7 +1442,7 @@ |
1441 | 1442 | int section = shndx2secindex(sechdr->sh_info); |
1442 | 1443 | |
1443 | 1444 | return (void *)elf->hdr + sechdrs[section].sh_offset + |
1444 | - r->r_offset - sechdrs[section].sh_addr; | |
1445 | + r->r_offset; | |
1445 | 1446 | } |
1446 | 1447 | |
1447 | 1448 | static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) |
usr/gen_init_cpio.c
... | ... | @@ -104,6 +104,8 @@ |
104 | 104 | char s[256]; |
105 | 105 | time_t mtime = time(NULL); |
106 | 106 | |
107 | + if (name[0] == '/') | |
108 | + name++; | |
107 | 109 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
108 | 110 | "%08X%08X%08X%08X%08X%08X%08X", |
109 | 111 | "070701", /* magic */ |
... | ... | @@ -152,6 +154,8 @@ |
152 | 154 | char s[256]; |
153 | 155 | time_t mtime = time(NULL); |
154 | 156 | |
157 | + if (name[0] == '/') | |
158 | + name++; | |
155 | 159 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
156 | 160 | "%08X%08X%08X%08X%08X%08X%08X", |
157 | 161 | "070701", /* magic */ |
... | ... | @@ -245,6 +249,8 @@ |
245 | 249 | else |
246 | 250 | mode |= S_IFCHR; |
247 | 251 | |
252 | + if (name[0] == '/') | |
253 | + name++; | |
248 | 254 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
249 | 255 | "%08X%08X%08X%08X%08X%08X%08X", |
250 | 256 | "070701", /* magic */ |
251 | 257 | |
... | ... | @@ -303,18 +309,18 @@ |
303 | 309 | |
304 | 310 | mode |= S_IFREG; |
305 | 311 | |
306 | - retval = stat (location, &buf); | |
307 | - if (retval) { | |
308 | - fprintf (stderr, "File %s could not be located\n", location); | |
309 | - goto error; | |
310 | - } | |
311 | - | |
312 | 312 | file = open (location, O_RDONLY); |
313 | 313 | if (file < 0) { |
314 | 314 | fprintf (stderr, "File %s could not be opened for reading\n", location); |
315 | 315 | goto error; |
316 | 316 | } |
317 | 317 | |
318 | + retval = fstat(file, &buf); | |
319 | + if (retval) { | |
320 | + fprintf(stderr, "File %s could not be stat()'ed\n", location); | |
321 | + goto error; | |
322 | + } | |
323 | + | |
318 | 324 | filebuf = malloc(buf.st_size); |
319 | 325 | if (!filebuf) { |
320 | 326 | fprintf (stderr, "out of memory\n"); |
... | ... | @@ -332,6 +338,8 @@ |
332 | 338 | /* data goes on last link */ |
333 | 339 | if (i == nlinks) size = buf.st_size; |
334 | 340 | |
341 | + if (name[0] == '/') | |
342 | + name++; | |
335 | 343 | namesize = strlen(name) + 1; |
336 | 344 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
337 | 345 | "%08lX%08X%08X%08X%08X%08X%08X", |