Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (33 commits)
  xtensa: use DATA_DATA in xtensa
  powerpc: add missing DATA_DATA to powerpc
  cris: use DATA_DATA in cris
  kallsyms: remove usage of memmem and _GNU_SOURCE from scripts/kallsyms.c
  kbuild: use -fno-optimize-sibling-calls unconditionally
  kconfig: reset generated values only if Kconfig and .config agree.
  kbuild: fix the warning when running make tags
  kconfig: strip 'CONFIG_' automatically in kernel configuration search
  kbuild: use POSIX BRE in headers install target
  Whitelist references from __dbe_table to .init
  modpost white list pattern adjustment
  kbuild: do section mismatch check on full vmlinux
  kbuild: whitelist references from variables named _timer to .init.text
  kbuild: remove hardcoded _logo names from modpost
  kbuild: remove hardcoded apic_es7000 from modpost
  kbuild: warn about references from .init.text to .exit.text
  kbuild: consolidate section checks
  kbuild: refactor code in modpost to improve maintainability
  kbuild: ignore section mismatch warnings originating from .note section
  kbuild: .paravirtprobe section is obsolete, so modpost doesn't need to handle it
  ...
  • Loading branch information
Linus Torvalds committed Jul 19, 2007
2 parents 40b42f1 + b824325 commit efffbee
Show file tree
Hide file tree
Showing 27 changed files with 474 additions and 200 deletions.
14 changes: 14 additions & 0 deletions Documentation/kbuild/makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,20 @@ more details, with real examples.
The third parameter may be a text as in this example, but it may also
be an expanded variable or a macro.

cc-fullversion
cc-fullversion is useful when the exact version of gcc is needed.
One typical use-case is when a specific GCC version is broken.
cc-fullversion points out a more specific version than cc-version does.

Example:
#arch/powerpc/Makefile
$(Q)if test "$(call cc-fullversion)" = "040200" ; then \
echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
false ; \
fi

In this example for a specific GCC version the build will error out explaining
to the user why it stops.

=== 4 Host Program support

Expand Down
1 change: 1 addition & 0 deletions Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ offsets-file := include/asm-$(ARCH)/asm-offsets.h
always := $(offsets-file)
targets := $(offsets-file)
targets += arch/$(ARCH)/kernel/asm-offsets.s
clean-files := $(addprefix $(objtree)/,$(targets))

# Default sed regexp - multiline due to syntax constraints
define sed-y
Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ endif
include $(srctree)/arch/$(ARCH)/Makefile

ifdef CONFIG_FRAME_POINTER
CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
CFLAGS += -fomit-frame-pointer
endif
Expand Down Expand Up @@ -618,7 +618,7 @@ quiet_cmd_vmlinux__ ?= LD $@
cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
-T $(vmlinux-lds) $(vmlinux-init) \
--start-group $(vmlinux-main) --end-group \
$(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
$(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^)

# Generate new vmlinux version
quiet_cmd_vmlinux_version = GEN .version
Expand Down Expand Up @@ -742,15 +742,31 @@ debug_kallsyms: .tmp_map$(last_kallsyms)

endif # ifdef CONFIG_KALLSYMS

# Do modpost on a prelinked vmlinux. The finally linked vmlinux has
# relevant sections renamed as per the linker script.
quiet_cmd_vmlinux-modpost = LD $@
cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \
$(vmlinux-init) --start-group $(vmlinux-main) --end-group \
$(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^)
define rule_vmlinux-modpost
:
+$(call cmd,vmlinux-modpost)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
$(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
endef

# vmlinux image - including updated kernel symbols
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
$(call vmlinux-modpost)
$(call if_changed_rule,vmlinux__)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
$(Q)rm -f .old_version

vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
$(call if_changed_rule,vmlinux-modpost)

# The actual objects are generated when descending,
# make sure no implicit rule kicks in
$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
Expand Down Expand Up @@ -1323,7 +1339,7 @@ define xtags
-I __initdata,__exitdata,__acquires,__releases \
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
--extra=+f --c-kinds=+px \
--regex-asm='/ENTRY\(([^)]*)\).*/\1/'; \
--regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
$(all-kconfigs) | xargs $1 -a \
--langdef=kconfig \
--language-force=kconfig \
Expand Down
2 changes: 1 addition & 1 deletion arch/cris/arch-v10/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SECTIONS
___data_start = . ;
__Sdata = . ;
.data : { /* Data */
*(.data)
DATA_DATA
}
__edata = . ; /* End of data section */
_edata = . ;
Expand Down
2 changes: 1 addition & 1 deletion arch/cris/arch-v32/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SECTIONS
___data_start = . ;
__Sdata = . ;
.data : { /* Data */
*(.data)
DATA_DATA
}
__edata = . ; /* End of data section. */
_edata = . ;
Expand Down
2 changes: 1 addition & 1 deletion arch/i386/mach-generic/es7000.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
}
#endif

struct genapic apic_es7000 = APIC_INIT("es7000", probe_es7000);
struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000);
8 changes: 8 additions & 0 deletions arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ checkbin:
false; \
fi ; \
fi
@if test "$(call cc-fullversion)" = "040200" \
&& test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
echo 'kernel with modules enabled.' ; \
echo -n '*** Please use a different GCC version or ' ; \
echo 'disable kernel modules' ; \
false ; \
fi
@if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
echo 'correctly with old versions of binutils.' ; \
Expand Down
4 changes: 3 additions & 1 deletion arch/powerpc/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ SECTIONS
}
#else
.data : {
*(.data .data.rel* .toc1)
DATA_DATA
*(.data.rel*)
*(.toc1)
*(.branch_lt)
}

Expand Down
3 changes: 2 additions & 1 deletion arch/xtensa/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ SECTIONS
_fdata = .;
.data :
{
*(.data) CONSTRUCTORS
DATA_DATA
CONSTRUCTORS
. = ALIGN(XCHAL_ICACHE_LINESIZE);
*(.data.cacheline_aligned)
}
Expand Down
7 changes: 5 additions & 2 deletions drivers/video/logo/logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ extern const struct linux_logo logo_superh_vga16;
extern const struct linux_logo logo_superh_clut224;
extern const struct linux_logo logo_m32r_clut224;


const struct linux_logo *fb_find_logo(int depth)
/* logo's are marked __initdata. Use __init_refok to tell
* modpost that it is intended that this function uses data
* marked __initdata.
*/
const struct linux_logo * __init_refok fb_find_logo(int depth)
{
const struct linux_logo *logo = NULL;

Expand Down
7 changes: 6 additions & 1 deletion scripts/Kbuild.include
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ cc-option-align = $(subst -functions=0,,\
$(call cc-option,-falign-functions=0,-malign-functions=0))

# cc-version
# Usage gcc-ver := $(call cc-version,$(CC))
# Usage gcc-ver := $(call cc-version)
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))

# cc-fullversion
# Usage gcc-ver := $(call cc-fullversion)
cc-fullversion = $(shell $(CONFIG_SHELL) \
$(srctree)/scripts/gcc-version.sh -p $(CC))

# cc-ifversion
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
Expand Down
16 changes: 16 additions & 0 deletions scripts/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ src := $(obj)
PHONY := __build
__build:

# Init all relevant variables used in kbuild files so
# 1) they have correct type
# 2) they do not inherit any value from the environment
obj-y :=
obj-m :=
lib-y :=
lib-m :=
always :=
targets :=
subdir-y :=
subdir-m :=
EXTRA_AFLAGS :=
EXTRA_CFLAGS :=
EXTRA_CPPFLAGS :=
EXTRA_LDFLAGS :=

# Read .config if it exist, otherwise ignore
-include include/config/auto.conf

Expand Down
14 changes: 7 additions & 7 deletions scripts/Makefile.headersinst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ UNIFDEF := scripts/unifdef -U__KERNEL__

# Eliminate the contents of (and inclusions of) compiler.h
HDRSED := sed -e "s/ inline / __inline__ /g" \
-e "s/[[:space:]]__user[[:space:]]\+/ /g" \
-e "s/(__user[[:space:]]\+/ (/g" \
-e "s/[[:space:]]__force[[:space:]]\+/ /g" \
-e "s/(__force[[:space:]]\+/ (/g" \
-e "s/[[:space:]]__iomem[[:space:]]\+/ /g" \
-e "s/(__iomem[[:space:]]\+/ (/g" \
-e "s/[[:space:]]__attribute_const__[[:space:]]\+/\ /g" \
-e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \
-e "s/(__user[[:space:]]\{1,\}/ (/g" \
-e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \
-e "s/(__force[[:space:]]\{1,\}/ (/g" \
-e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \
-e "s/(__iomem[[:space:]]\{1,\}/ (/g" \
-e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \
-e "s/[[:space:]]__attribute_const__$$//" \
-e "/^\#include <linux\/compiler.h>/d"

Expand Down
4 changes: 2 additions & 2 deletions scripts/Makefile.modpost
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ __modpost: $(modules:.ko=.o) FORCE
$(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^)

quiet_cmd_kernel-mod = MODPOST $@
cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS)
cmd_kernel-mod = $(cmd_modpost) $@

PHONY += vmlinux
vmlinux: FORCE
vmlinux.o: FORCE
$(call cmd,kernel-mod)

# Declare generated files as targets for modpost
Expand Down
54 changes: 52 additions & 2 deletions scripts/cleanfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
use bytes;
use File::Basename;

#
# Default options
$max_width = 79;

# Clean up space-tab sequences, either by removing spaces or
# replacing them with tabs.
sub clean_space_tabs($)
Expand Down Expand Up @@ -48,9 +50,49 @@ sub clean_space_tabs($)
return $lo;
}

# Compute the visual width of a string
sub strwidth($) {
no bytes; # Tab alignment depends on characters

my($li) = @_;
my($c, $i);
my $pos = 0;
my $mlen = 0;

for ($i = 0; $i < length($li); $i++) {
$c = substr($li,$i,1);
if ($c eq "\t") {
$pos = ($pos+8) & ~7;
} elsif ($c eq "\n") {
$mlen = $pos if ($pos > $mlen);
$pos = 0;
} else {
$pos++;
}
}

$mlen = $pos if ($pos > $mlen);
return $mlen;
}

$name = basename($0);

foreach $f ( @ARGV ) {
@files = ();

while (defined($a = shift(@ARGV))) {
if ($a =~ /^-/) {
if ($a eq '-width' || $a eq '-w') {
$max_width = shift(@ARGV)+0;
} else {
print STDERR "Usage: $name [-width #] files...\n";
exit 1;
}
} else {
push(@files, $a);
}
}

foreach $f ( @files ) {
print STDERR "$name: $f\n";

if (! -f $f) {
Expand Down Expand Up @@ -90,8 +132,10 @@ foreach $f ( @ARGV ) {

@blanks = ();
@lines = ();
$lineno = 0;

while ( defined($line = <FILE>) ) {
$lineno++;
$in_bytes += length($line);
$line =~ s/[ \t\r]*$//; # Remove trailing spaces
$line = clean_space_tabs($line);
Expand All @@ -107,6 +151,12 @@ foreach $f ( @ARGV ) {
@blanks = ();
$blank_bytes = 0;
}

$l_width = strwidth($line);
if ($max_width && $l_width > $max_width) {
print STDERR
"$f:$lineno: line exceeds $max_width characters ($l_width)\n";
}
}

# Any blanks at the end of the file are discarded
Expand Down
Loading

0 comments on commit efffbee

Please sign in to comment.