patches/glibc/2.9/390-2.3.3_pre20040117-pt_pax.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 1201 c9967a6e3b25
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 Original patch from: gentoo/src/patchsets/glibc/2.9/3010_all_2.3.3_pre20040117-pt_pax.patch
     2 
     3 -= BEGIN original header =-
     4 -= END original header =-
     5 
     6 diff -durN glibc-2_9.orig/elf/elf.h glibc-2_9/elf/elf.h
     7 --- glibc-2_9.orig/elf/elf.h	2008-10-01 21:41:34.000000000 +0200
     8 +++ glibc-2_9/elf/elf.h	2009-02-02 22:01:21.000000000 +0100
     9 @@ -571,6 +571,7 @@
    10  #define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */
    11  #define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
    12  #define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
    13 +#define PT_PAX_FLAGS	0x65041580	/* Indicates PaX flag markings */
    14  #define PT_LOSUNW	0x6ffffffa
    15  #define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
    16  #define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */
    17 @@ -584,6 +585,18 @@
    18  #define PF_X		(1 << 0)	/* Segment is executable */
    19  #define PF_W		(1 << 1)	/* Segment is writable */
    20  #define PF_R		(1 << 2)	/* Segment is readable */
    21 +#define PF_PAGEEXEC	(1 << 4)	/* Enable  PAGEEXEC */
    22 +#define PF_NOPAGEEXEC	(1 << 5)	/* Disable PAGEEXEC */
    23 +#define PF_SEGMEXEC	(1 << 6)	/* Enable  SEGMEXEC */
    24 +#define PF_NOSEGMEXEC	(1 << 7)	/* Disable SEGMEXEC */
    25 +#define PF_MPROTECT	(1 << 8)	/* Enable  MPROTECT */
    26 +#define PF_NOMPROTECT	(1 << 9)	/* Disable MPROTECT */
    27 +#define PF_RANDEXEC	(1 << 10)	/* Enable  RANDEXEC */
    28 +#define PF_NORANDEXEC	(1 << 11)	/* Disable RANDEXEC */
    29 +#define PF_EMUTRAMP	(1 << 12)	/* Enable  EMUTRAMP */
    30 +#define PF_NOEMUTRAMP	(1 << 13)	/* Disable EMUTRAMP */
    31 +#define PF_RANDMMAP	(1 << 14)	/* Enable  RANDMMAP */
    32 +#define PF_NORANDMMAP	(1 << 15)	/* Disable RANDMMAP */
    33  #define PF_MASKOS	0x0ff00000	/* OS-specific */
    34  #define PF_MASKPROC	0xf0000000	/* Processor-specific */
    35