patches/linux/3.0.9/100-headers_install-fix-__packed-in-exported-kernel-head.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
parent 2735 f09ed6dd71a3
permissions -rw-r--r--
complibs/cloog: fix linking with libm

In Ubuntu 11.04 and 11.10, the default options for ld have changed.
--no-copy-dt-needed-entries and --as-needed are now enabled by default, which
causes errors like:

[EXTRA] Checking CLooG/ppl
[DEBUG] ==> Executing: 'make' '-j3' '-s' 'check'
[ALL ] Making check in .
[ALL ] config.status: creating include/cloog/cloog-config.h
[ALL ] config.status: include/cloog/cloog-config.h is unchanged
[ALL ] libtool: link: i686-build_pc-linux-gnu-gcc -Wall -fomit-frame-pointer
-pipe -o cloog cloog.o -L/<snip>/build/static/lib ./.libs/libcloog.a -lm
/<snip>/build/static/lib/libppl_c.a /<snip>/build/static/lib/libpwl.a
/<snip>/build/static/lib/libppl.a /<snip>/build/static/lib/libgmpxx.a
/<snip>/build/static/lib/libgmp.a -lstdc++
[ALL ] /usr/bin/ld: /<snip>/build/static/lib/libppl.a(MIP_Problem.o):
undefined reference to symbol 'sqrt@@GLIBC_2.0'
[ALL ] /usr/bin/ld: note: 'sqrt@@GLIBC_2.0' is defined in DSO
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so so try adding
it to the linker command line
[ALL ] /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so:
could not read symbols: Invalid operation
[ALL ] collect2: ld returned 1 exit status
[ERROR] make[2]: *** [cloog] Error 1
[ERROR] make[1]: *** [check-recursive] Error 1

See:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

This patch fixes these errors by placing '-lm' at the right place on the command
line as libppl requires libm when linking cloog.

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
yann@2735
     1
commit f210735fe2f17a6225432ee3d1239bcf23a8659c
yann@2735
     2
Author: Markus Trippelsdorf <markus@trippelsdorf.de>
yann@2735
     3
Date:   Fri Jun 24 15:51:00 2011 +0200
yann@2735
     4
yann@2735
     5
    headers_install: fix __packed in exported kernel headers
yann@2735
     6
    
yann@2735
     7
    checkpatch.pl warns about using __attribute__((packed)) in kernel
yann@2735
     8
    headers: "__packed is preferred over __attribute__((packed))". If one
yann@2735
     9
    follows that advice it could cause problems in the exported header
yann@2735
    10
    files, because the outside world doesn't know about this shortcut.
yann@2735
    11
    
yann@2735
    12
    For example busybox will fail to compile:
yann@2735
    13
     CC      miscutils/ubi_attach_detach.o
yann@2735
    14
     In file included from miscutils/ubi_attach_detach.c:27:0:
yann@2735
    15
     /usr/include/mtd/ubi-user.h:330:3: error: conflicting types for ‘__packed’
yann@2735
    16
     /usr/include/mtd/ubi-user.h:314:3: note: previous declaration of ‘__packed’ was here
yann@2735
    17
    ...
yann@2735
    18
    
yann@2735
    19
    Fix the problem by substituting __packed with __attribute__((packed)) in
yann@2735
    20
    the header_install.pl script.
yann@2735
    21
    
yann@2735
    22
    Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
yann@2735
    23
    CC: Joe Perches <joe@perches.com>
yann@2735
    24
    Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
yann@2735
    25
    Signed-off-by: Michal Marek <mmarek@suse.cz>
yann@2735
    26
yann@2735
    27
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
yann@2735
    28
index efb3be1..48462be 100644
yann@2735
    29
--- a/scripts/headers_install.pl
yann@2735
    30
+++ b/scripts/headers_install.pl
yann@2735
    31
@@ -35,6 +35,7 @@ foreach my $file (@files) {
yann@2735
    32
 		$line =~ s/([\s(])__iomem\s/$1/g;
yann@2735
    33
 		$line =~ s/\s__attribute_const__\s/ /g;
yann@2735
    34
 		$line =~ s/\s__attribute_const__$//g;
yann@2735
    35
+		$line =~ s/\b__packed\b/__attribute__((packed))/g;
yann@2735
    36
 		$line =~ s/^#include <linux\/compiler.h>//;
yann@2735
    37
 		$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
yann@2735
    38
 		$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;