Commit dab3c3cc authored by Linus Torvalds's avatar Linus Torvalds

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
parents 59a47fff 5631d9c4
...@@ -666,14 +666,7 @@ endif ...@@ -666,14 +666,7 @@ endif
endif endif
KBUILD_CFLAGS += $(stackp-flag) KBUILD_CFLAGS += $(stackp-flag)
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) ifeq ($(cc-name),clang)
COMPILER := clang
else
COMPILER := gcc
endif
export COMPILER
ifeq ($(COMPILER),clang)
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,) KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
......
...@@ -67,7 +67,7 @@ UTS_MACHINE := $(OLDARCH) ...@@ -67,7 +67,7 @@ UTS_MACHINE := $(OLDARCH)
ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
override CC += -mlittle-endian override CC += -mlittle-endian
ifneq ($(COMPILER),clang) ifneq ($(cc-name),clang)
override CC += -mno-strict-align override CC += -mno-strict-align
endif endif
override AS += -mlittle-endian override AS += -mlittle-endian
...@@ -353,7 +353,7 @@ TOUT := .tmp_gas_check ...@@ -353,7 +353,7 @@ TOUT := .tmp_gas_check
# - Require gcc 4.0 or above on 64-bit # - Require gcc 4.0 or above on 64-bit
# - gcc-4.2.0 has issues compiling modules on 64-bit # - gcc-4.2.0 has issues compiling modules on 64-bit
checkbin: checkbin:
@if test "${COMPILER}" != "clang" \ @if test "$(cc-name)" != "clang" \
&& test "$(cc-version)" = "0304" ; then \ && test "$(cc-version)" = "0304" ; then \
if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
...@@ -362,14 +362,14 @@ checkbin: ...@@ -362,14 +362,14 @@ checkbin:
false; \ false; \
fi ; \ fi ; \
fi fi
@if test "${COMPILER}" != "clang" \ @if test "$(cc-name)" != "clang" \
&& test "$(cc-version)" -lt "0400" \ && test "$(cc-version)" -lt "0400" \
&& test "x${CONFIG_PPC64}" = "xy" ; then \ && test "x${CONFIG_PPC64}" = "xy" ; then \
echo -n "Sorry, GCC v4.0 or above is required to build " ; \ echo -n "Sorry, GCC v4.0 or above is required to build " ; \
echo "the 64-bit powerpc kernel." ; \ echo "the 64-bit powerpc kernel." ; \
false ; \ false ; \
fi fi
@if test "${COMPILER}" != "clang" \ @if test "$(cc-name)" != "clang" \
&& test "$(cc-fullversion)" = "040200" \ && test "$(cc-fullversion)" = "040200" \
&& test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \ && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
......
...@@ -412,12 +412,10 @@ ...@@ -412,12 +412,10 @@
* during second ld run in second ld pass when generating System.map */ * during second ld run in second ld pass when generating System.map */
#define TEXT_TEXT \ #define TEXT_TEXT \
ALIGN_FUNCTION(); \ ALIGN_FUNCTION(); \
*(.text.hot) \ *(.text.hot .text .text.fixup .text.unlikely) \
*(.text .text.fixup) \
*(.ref.text) \ *(.ref.text) \
MEM_KEEP(init.text) \ MEM_KEEP(init.text) \
MEM_KEEP(exit.text) \ MEM_KEEP(exit.text) \
*(.text.unlikely)
/* sched.text is aling to function alignment to secure we have same /* sched.text is aling to function alignment to secure we have same
......
...@@ -128,6 +128,10 @@ cc-option-align = $(subst -functions=0,,\ ...@@ -128,6 +128,10 @@ cc-option-align = $(subst -functions=0,,\
cc-disable-warning = $(call try-run,\ cc-disable-warning = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-name
# Expands to either gcc or clang
cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
# cc-version # cc-version
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
......
...@@ -56,7 +56,7 @@ endif ...@@ -56,7 +56,7 @@ endif
KBUILD_CFLAGS += $(warning) KBUILD_CFLAGS += $(warning)
else else
ifeq ($(COMPILER),clang) ifeq ($(cc-name),clang)
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
KBUILD_CFLAGS += $(call cc-disable-warning, format) KBUILD_CFLAGS += $(call cc-disable-warning, format)
......
...@@ -191,23 +191,6 @@ static void define_config(const char *name, int len, unsigned int hash) ...@@ -191,23 +191,6 @@ static void define_config(const char *name, int len, unsigned int hash)
hashtab[hash % HASHSZ] = aux; hashtab[hash % HASHSZ] = aux;
} }
/*
* Clear the set of configuration strings.
*/
static void clear_config(void)
{
struct item *aux, *next;
unsigned int i;
for (i = 0; i < HASHSZ; i++) {
for (aux = hashtab[i]; aux; aux = next) {
next = aux->next;
free(aux);
}
hashtab[i] = NULL;
}
}
/* /*
* Record the use of a CONFIG_* word. * Record the use of a CONFIG_* word.
*/ */
...@@ -251,7 +234,8 @@ static void parse_config_file(const char *map, size_t len) ...@@ -251,7 +234,8 @@ static void parse_config_file(const char *map, size_t len)
continue; continue;
if (memcmp(p, "CONFIG_", 7)) if (memcmp(p, "CONFIG_", 7))
continue; continue;
for (q = p + 7; q < map + len; q++) { p += 7;
for (q = p; q < map + len; q++) {
if (!(isalnum(*q) || *q == '_')) if (!(isalnum(*q) || *q == '_'))
goto found; goto found;
} }
...@@ -260,9 +244,9 @@ static void parse_config_file(const char *map, size_t len) ...@@ -260,9 +244,9 @@ static void parse_config_file(const char *map, size_t len)
found: found:
if (!memcmp(q - 7, "_MODULE", 7)) if (!memcmp(q - 7, "_MODULE", 7))
q -= 7; q -= 7;
if( (q-p-7) < 0 ) if (q - p < 0)
continue; continue;
use_config(p+7, q-p-7); use_config(p, q - p);
} }
} }
...@@ -324,8 +308,6 @@ static void parse_dep_file(void *map, size_t len) ...@@ -324,8 +308,6 @@ static void parse_dep_file(void *map, size_t len)
int saw_any_target = 0; int saw_any_target = 0;
int is_first_dep = 0; int is_first_dep = 0;
clear_config();
while (m < end) { while (m < end) {
/* Skip any "white space" */ /* Skip any "white space" */
while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))
......
This diff is collapsed.
/* A Bison parser, made by GNU Bison 2.5.1. */ /* A Bison parser, made by GNU Bison 2.7. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
...@@ -30,6 +30,15 @@ ...@@ -30,6 +30,15 @@
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
#ifndef YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED
# define YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
...@@ -83,7 +92,6 @@ ...@@ -83,7 +92,6 @@
#endif #endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE; typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
...@@ -93,4 +101,18 @@ typedef int YYSTYPE; ...@@ -93,4 +101,18 @@ typedef int YYSTYPE;
extern YYSTYPE yylval; extern YYSTYPE yylval;
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED */
...@@ -303,6 +303,15 @@ direct_declarator: ...@@ -303,6 +303,15 @@ direct_declarator:
$$ = $1; $$ = $1;
} }
} }
| TYPE
{ if (current_name != NULL) {
error_with_pos("unexpected second declaration name");
YYERROR;
} else {
current_name = (*$1)->string;
$$ = $1;
}
}
| direct_declarator '(' parameter_declaration_clause ')' | direct_declarator '(' parameter_declaration_clause ')'
{ $$ = $4; } { $$ = $4; }
| direct_declarator '(' error ')' | direct_declarator '(' error ')'
......
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
#include "elfconfig.h" #include "elfconfig.h"
/* On BSD-alike OSes elf.h defines these according to host's word size */
#undef ELF_ST_BIND
#undef ELF_ST_TYPE
#undef ELF_R_SYM
#undef ELF_R_TYPE
#if KERNEL_ELFCLASS == ELFCLASS32 #if KERNEL_ELFCLASS == ELFCLASS32
#define Elf_Ehdr Elf32_Ehdr #define Elf_Ehdr Elf32_Ehdr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment