patches/glibc/2.7/240-sh-lowlevellock-asm.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 --- glibc-2.7/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S.orig	2007-08-03 16:44:15.000000000 +0100
     2 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S	2008-08-19 21:08:19.000000000 +0100
     3 @@ -76,7 +76,7 @@
     4  	add	tmp2, tmp 	; \
     5  	mov.l	@tmp, tmp2	; \
     6  	bra	98f		; \
     7 -	 mov	#FUTEX_PRIVATE_FLAG, tmp
     8 +	 mov	#FUTEX_PRIVATE_FLAG, tmp ; \
     9  99:	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
    10  98:	extu.b	tmp, tmp	; \
    11  	xor	tmp, reg	; \
    12 @@ -88,7 +88,7 @@
    13  	add	tmp2, tmp 	; \
    14  	mov.l	@tmp, tmp2	; \
    15  	bra	98f		; \
    16 -	 mov	#FUTEX_PRIVATE_FLAG, tmp
    17 +	 mov	#FUTEX_PRIVATE_FLAG, tmp ; \
    18  99:	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
    19  98:	extu.b	tmp, tmp	; \
    20  	xor	tmp, reg	; \
    21 @@ -96,13 +96,13 @@
    22  	mov	#FUTEX_WAIT, tmp ; \
    23  	or	tmp, reg
    24  # endif
    25 -# define LOAD_FUTEX_WAKE(reg,tmp) \
    26 +# define LOAD_FUTEX_WAKE(reg,tmp,tmp2) \
    27  	stc	gbr, tmp	; \
    28  	mov.w	99f, tmp2	; \
    29  	add	tmp2, tmp 	; \
    30  	mov.l	@tmp, tmp2	; \
    31  	bra	98f		; \
    32 -	 mov	#FUTEX_PRIVATE_FLAG, tmp
    33 +	 mov	#FUTEX_PRIVATE_FLAG, tmp ; \
    34  99:	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
    35  98:	extu.b	tmp, tmp	; \
    36  	xor	tmp, reg	; \
    37 --- glibc-2.7/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S.orig	2007-08-03 16:44:57.000000000 +0100
    38 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S	2008-08-19 21:08:22.000000000 +0100
    39 @@ -42,7 +42,7 @@
    40  	add	tmp2, tmp 	; \
    41  	mov.l	@tmp, tmp2	; \
    42  	bra	98f		; \
    43 -	 mov	#FUTEX_PRIVATE_FLAG, tmp
    44 +	 mov	#FUTEX_PRIVATE_FLAG, tmp ; \
    45  99:	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
    46  98:	extu.b	tmp, tmp	; \
    47  	xor	tmp, reg	; \
    48 @@ -54,7 +54,7 @@
    49  	add	tmp2, tmp 	; \
    50  	mov.l	@tmp, tmp2	; \
    51  	bra	98f		; \
    52 -	 mov	#FUTEX_PRIVATE_FLAG, tmp
    53 +	 mov	#FUTEX_PRIVATE_FLAG, tmp ; \
    54  99:	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
    55  98:	extu.b	tmp, tmp	; \
    56  	xor	tmp, reg	; \