patches/uClibc/0.9.30.2/230-getdents-Fix-mips64-build.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
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>
     1 From 13545bce877b33e30155fc412ad44cc118d83f77 Mon Sep 17 00:00:00 2001
     2 From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
     3 Date: Sat, 30 Jan 2010 00:24:37 +0900
     4 Subject: [PATCH 15/15] getdents: Fix mips64 build
     5 
     6 On Wed, 27 Jan 2010 07:14:08 +0100, Carmelo AMOROSO <carmelo.amoroso@st.com> wrote:
     7 > I would re-write your patch in a simpler way.
     8 >
     9 > We already have the following
    10 >
    11 > 136 #if defined __UCLIBC_HAS_LFS__ && ! defined __NR_getdents64
    12 > 137 attribute_hidden strong_alias(__getdents,__getdents64)
    13 > 138 #endif
    14 >
    15 > I think that it's simpler to move in the proper place this statement.
    16 
    17 Thanks, indeed.  If we came into "#elif WORDSIZE == 32" block, above
    18 condition never be true.  So we can just move this statement out of
    19 "#if...#elif...#elif...#endif" block.  Here is a revised patch.
    20 
    21 ------------------------------------------------------
    22 From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
    23 Subject: [PATCH] getdents: Fix mips64 build
    24 
    25 Some archs (such as mips64) do not have getdents64 syscall but have
    26 getdents syscall.  Define alias for it.
    27 
    28 This fixes regression from 0.9.30.1.
    29 
    30 Backgrounds:
    31 This is once done by commit e8b1c674.  But after the commit 33bcf733
    32 ("Use getdents syscall if kernel provide supports for this instead of
    33 relying upon getdents64."), if __ASSUME_GETDENTS32_D_TYPE was defined
    34 the alias for getdents64 is not defined.  The macro
    35 __ASSUME_GETDENTS32_D_TYPE had been effectively ignored until 0.9.30.1
    36 but the commit 0f0f20ab ("Move kernel-features.h header from the
    37 linuxthread directory to a common one...") really enables it.
    38 
    39 Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
    40 Signed-off-by: Khem Raj <raj.khem@gmail.com>
    41 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    42 ---
    43  libc/sysdeps/linux/common/getdents.c |    8 ++++----
    44  1 files changed, 4 insertions(+), 4 deletions(-)
    45 
    46 diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
    47 index b518cc0..66a03b3 100644
    48 --- a/libc/sysdeps/linux/common/getdents.c
    49 +++ b/libc/sysdeps/linux/common/getdents.c
    50 @@ -136,10 +136,6 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
    51      return (char *) dp - buf;
    52  }
    53  
    54 -#if defined __UCLIBC_HAS_LFS__ && ! defined __NR_getdents64
    55 -attribute_hidden strong_alias(__getdents,__getdents64)
    56 -#endif
    57 -
    58  #elif __WORDSIZE == 32
    59  
    60  /* Experimentally off - libc_hidden_proto(memmove) */
    61 @@ -171,4 +167,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
    62  }
    63  #endif
    64  
    65 +#if defined __UCLIBC_HAS_LFS__ && ! defined __NR_getdents64
    66 +attribute_hidden strong_alias(__getdents,__getdents64)
    67 +#endif
    68 +
    69  #endif
    70 -- 
    71 1.6.6.1
    72