Skip to content

Commit dab3c3c

Browse files
committed
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull core kbuild updates from Michal Marek: - modpost portability fix - linker script fix - genksyms segfault fix - fixdep cleanup - fix for clang detection * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kbuild: Fix clang detection kbuild: fixdep: drop meaningless hash table initialization kbuild: fixdep: optimize code slightly genksyms: Regenerate parser genksyms: Duplicate function pointer type definitions segfault kbuild: Fix .text.unlikely placement Avoid conflict with host definitions when cross-compiling
2 parents 59a47ff + 5631d9c commit dab3c3c

10 files changed

Lines changed: 384 additions & 381 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -666,14 +666,7 @@ endif
666666
endif
667667
KBUILD_CFLAGS += $(stackp-flag)
668668

669-
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
670-
COMPILER := clang
671-
else
672-
COMPILER := gcc
673-
endif
674-
export COMPILER
675-
676-
ifeq ($(COMPILER),clang)
669+
ifeq ($(cc-name),clang)
677670
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
678671
KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
679672
KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)

‎arch/powerpc/Makefile‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ UTS_MACHINE := $(OLDARCH)
6767

6868
ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
6969
override CC += -mlittle-endian
70-
ifneq ($(COMPILER),clang)
70+
ifneq ($(cc-name),clang)
7171
override CC += -mno-strict-align
7272
endif
7373
override AS += -mlittle-endian
@@ -353,7 +353,7 @@ TOUT := .tmp_gas_check
353353
# - Require gcc 4.0 or above on 64-bit
354354
# - gcc-4.2.0 has issues compiling modules on 64-bit
355355
checkbin:
356-
@if test "${COMPILER}" != "clang" \
356+
@if test "$(cc-name)" != "clang" \
357357
&& test "$(cc-version)" = "0304" ; then \
358358
if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
359359
echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
@@ -362,14 +362,14 @@ checkbin:
362362
false; \
363363
fi ; \
364364
fi
365-
@if test "${COMPILER}" != "clang" \
365+
@if test "$(cc-name)" != "clang" \
366366
&& test "$(cc-version)" -lt "0400" \
367367
&& test "x${CONFIG_PPC64}" = "xy" ; then \
368368
echo -n "Sorry, GCC v4.0 or above is required to build " ; \
369369
echo "the 64-bit powerpc kernel." ; \
370370
false ; \
371371
fi
372-
@if test "${COMPILER}" != "clang" \
372+
@if test "$(cc-name)" != "clang" \
373373
&& test "$(cc-fullversion)" = "040200" \
374374
&& test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
375375
echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \

‎include/asm-generic/vmlinux.lds.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,10 @@
412412
* during second ld run in second ld pass when generating System.map */
413413
#define TEXT_TEXT \
414414
ALIGN_FUNCTION(); \
415-
*(.text.hot) \
416-
*(.text .text.fixup) \
415+
*(.text.hot .text .text.fixup .text.unlikely) \
417416
*(.ref.text) \
418417
MEM_KEEP(init.text) \
419418
MEM_KEEP(exit.text) \
420-
*(.text.unlikely)
421419

422420

423421
/* sched.text is aling to function alignment to secure we have same

‎scripts/Kbuild.include‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ cc-option-align = $(subst -functions=0,,\
128128
cc-disable-warning = $(call try-run,\
129129
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
130130

131+
# cc-name
132+
# Expands to either gcc or clang
133+
cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
134+
131135
# cc-version
132136
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
133137

‎scripts/Makefile.extrawarn‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ endif
5656
KBUILD_CFLAGS += $(warning)
5757
else
5858

59-
ifeq ($(COMPILER),clang)
59+
ifeq ($(cc-name),clang)
6060
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
6161
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
6262
KBUILD_CFLAGS += $(call cc-disable-warning, format)

‎scripts/basic/fixdep.c‎

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,6 @@ static void define_config(const char *name, int len, unsigned int hash)
191191
hashtab[hash % HASHSZ] = aux;
192192
}
193193

194-
/*
195-
* Clear the set of configuration strings.
196-
*/
197-
static void clear_config(void)
198-
{
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-
}
209-
}
210-
211194
/*
212195
* Record the use of a CONFIG_* word.
213196
*/
@@ -251,7 +234,8 @@ static void parse_config_file(const char *map, size_t len)
251234
continue;
252235
if (memcmp(p, "CONFIG_", 7))
253236
continue;
254-
for (q = p + 7; q < map + len; q++) {
237+
p += 7;
238+
for (q = p; q < map + len; q++) {
255239
if (!(isalnum(*q) || *q == '_'))
256240
goto found;
257241
}
@@ -260,9 +244,9 @@ static void parse_config_file(const char *map, size_t len)
260244
found:
261245
if (!memcmp(q - 7, "_MODULE", 7))
262246
q -= 7;
263-
if( (q-p-7) < 0 )
247+
if (q - p < 0)
264248
continue;
265-
use_config(p+7, q-p-7);
249+
use_config(p, q - p);
266250
}
267251
}
268252

@@ -324,8 +308,6 @@ static void parse_dep_file(void *map, size_t len)
324308
int saw_any_target = 0;
325309
int is_first_dep = 0;
326310

327-
clear_config();
328-
329311
while (m < end) {
330312
/* Skip any "white space" */
331313
while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))

0 commit comments

Comments
 (0)