patches/gcc/4.2.4/300-fortran-signed-TImode.patch
author "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Thu Jul 28 22:09:31 2011 +0200 (2011-07-28)
changeset 2573 424fa2092ace
parent 687 b2b6b1d46aa1
permissions -rw-r--r--
scripts/libc: do not build add-ons by default

Currently, no --enable-add-ons option is passed to libc configure when
"$(do_libc_add_ons_list ,)" is empty, which makes configure automatically search
for present add-ons. In that case, all present add-ons are built, although
no add-on was selected by the user in the config. Moreover, this can make the
configure fail if some non-standard add-ons like eglibc-localedef are present.

This behavior also leads to an inconsistency from a user point of view between
the following cases:
- LIBC_ADDONS_LIST="", LIBC_GLIBC_USE_PORTS=n and THREADS="none" in the config,
which makes "$(do_libc_add_ons_list ,)" return "", so all present add-ons
are built.
- LIBC_ADDONS_LIST="", LIBC_GLIBC_USE_PORTS=n and THREADS!="none" in the
config, which makes "$(do_libc_add_ons_list ,)" return the add-on supporting
the chosen threading implementation, e.g. "nptl", so only this add-on is
built.

This patch disables the building of all add-ons in that case.

It is still possible to build all present add-ons by adding --enable-add-ons to
LIBC_GLIBC_EXTRA_CONFIG_ARRAY.

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
yann@687
     1
Fix building gfortran for ARM.
yann@687
     2
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01010.html
yann@687
     3
----
yann@687
     4
yann@687
     5
The patch below fixes a crash building libgfortran on arm-linux-gnueabi.
yann@687
     6
yann@687
     7
This target doesn't really have a 128-bit integer type, however it does use 
yann@687
     8
TImode to represent the return value of certain special ABI defined library 
yann@687
     9
functions. This results in type_for_size(TImode) being called.
yann@687
    10
yann@687
    11
Because TImode deosn't correspond to any gfortran integer kind 
yann@687
    12
gfc_type_for_size returns NULL and we segfault shortly after.
yann@687
    13
yann@687
    14
The patch below fixes this by making gfc_type_for_size handle TImode in the 
yann@687
    15
same way as the C frontend.
yann@687
    16
yann@687
    17
Tested on x86_64-linux and arm-linux-gnueabi.
yann@687
    18
Applied to trunk.
yann@687
    19
yann@687
    20
Paul
yann@687
    21
yann@687
    22
2007-05-15  Paul Brook  <paul@codesourcery.com>
yann@687
    23
yann@687
    24
    gcc/fortran/
yann@687
    25
    * trans-types.c (gfc_type_for_size): Handle signed TImode.
yann@687
    26
yann@687
    27
diff -durN gcc-4.2.3.old/gcc/fortran/trans-types.c gcc-4.2.3/gcc/fortran/trans-types.c
yann@687
    28
--- gcc-4.2.3.old/gcc/fortran/trans-types.c	2007-08-31 10:27:50.000000000 +0200
yann@687
    29
+++ gcc-4.2.3/gcc/fortran/trans-types.c	2008-07-17 09:54:20.000000000 +0200
yann@687
    30
@@ -1799,6 +1799,13 @@
yann@687
    31
 	  if (type && bits == TYPE_PRECISION (type))
yann@687
    32
 	    return type;
yann@687
    33
 	}
yann@687
    34
+
yann@687
    35
+	/* Handle TImode as a special case because it is used by some backends
yann@687
    36
+	   (eg. ARM) even though it is not available for normal use.  */
yann@687
    37
+#if HOST_BITS_PER_WIDE_INT >= 64
yann@687
    38
+	if (bits == TYPE_PRECISION (intTI_type_node))
yann@687
    39
+	  return intTI_type_node;
yann@687
    40
+#endif
yann@687
    41
     }
yann@687
    42
   else
yann@687
    43
     {