This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

-liberty configure patch


Hi,

This patch makes the tests for certain variables safer.  When trying
to detect the presence of some variable, the configure tries to link a
program like:

   int *p; extern int some_var; p = &some_var;

If the plarform has a notion of "small data" section the compiler can
generate "small data" relocations (like R_MIPS_GPREL16 or
R_PPC_SDAREL16) and subsequently the link editor can fail with
relocation overflow if the variable in question is not in the small
data section for variety of reasons, for example:

 /* too big */
   int some_var [10000000];

 /* put in .rodata */
   const int some_var;

 /* explicit section */
   int some_var __attribute__((section (".my_fancy_section")));

Regards,
-velco

2001-03-14  Momchil Velikov  <velco@fadata.bg>

	* configure.in: When checking for certain variables, make sure the
	compiler does not generate any forms of "small data" relocations
	against them.


Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/configure.in,v
retrieving revision 1.32
diff -u -d -r1.32 configure.in
--- configure.in	2001/03/06 09:52:35	1.32
+++ configure.in	2001/03/14 20:06:31
@@ -283,7 +283,7 @@
   for v in $vars; do
     AC_MSG_CHECKING([for $v])
     AC_CACHE_VAL(libiberty_cv_var_$v,
-      [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
+      [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;],
 		   [eval "libiberty_cv_var_$v=yes"],
 		   [eval "libiberty_cv_var_$v=no"])])
     if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]