[PATCH, alpha]: Fix PR 46533. bootstrap failure

Uros Bizjak ubizjak@gmail.com
Sat Nov 20 13:21:00 GMT 2010


Hello!

Currently, alpha bootstrap fails with:

/home/uros/gcc-build/./prev-gcc/xgcc -B/home/uros/gcc-build/./prev-gcc/
-B/usr/local/alphaev68-unknown-linux-gnu/bin/
-B/usr/local/alphaev68-unknown-linux-gnu/bin/
-B/usr/local/alphaev68-unknown-linux-gnu/lib/ -isystem
/usr/local/alphaev68-unknown-linux-gnu/include -isystem
/usr/local/alphaev68-unknown-linux-gnu/sys-include      -g -O2 -gtoggle
-DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-style-definition
-Wc++-compat -fno-common  -DHAVE_CONFIG_H  -o cc1plus \
          cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/decl.o cp/expr.o
cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o
cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o
cp/method.o cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o
cp/optimize.o cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o
cp/cxx-pretty-print.o cp/cp-gimplify.o tree-mudflap.o attribs.o incpath.o
prefix.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o
c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o
c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o
c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o
cc1plus-checksum.o main.o tree-browser.o libbackend.a ../libcpp/libcpp.a
../libdecnumber/libdecnumber.a ../libcpp/libcpp.a   ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a  -lcloog -lppl_c -lppl -lgmpxx -lmpc -lmpfr
-lgmp -rdynamic -ldl  -L../zlib -lz
libbackend.a(gimple.o): In function `gimple_types_compatible_p_1':
(.text+0xe7ac): relocation truncated to fit: BRADDR against `.text.unlikely'
libbackend.a(gimple.o): In function `gimple_types_compatible_p_1':
(.text+0xeb28): relocation truncated to fit: BRADDR against `.text.unlikely'
libbackend.a(gimple.o): In function `gimple_types_compatible_p_1':
(.text+0xeb6c): relocation truncated to fit: BRADDR against `.text.unlikely'
libbackend.a(gimple.o): In function `gimple_types_compatible_p_1':
(.text+0xeca4): relocation truncated to fit: BRADDR against `.text.unlikely'
libbackend.a(gimple.o): In function `gimple_types_compatible_p_1':
(.text+0xecf0): relocation truncated to fit: BRADDR against `.text.unlikely'
libbackend.a(gimple.o): In function `gimple_types_compatible_p_1':
(.text+0xed5c): relocation truncated to fit: BRADDR against `.text.unlikely'
libbackend.a(gimple.o): In function `gimple_types_compatible_p_1':
(.text+0xf238): relocation truncated to fit: BRADDR against `.text.unlikely'
collect2: ld returned 1 exit status

The problem is, that gcc assumes that all function, defined in the
same section can be reached by a "near" calls (direct call with 20bit
signed offset). However, various functions, otherwise in the same
section, can be emitted into hot and cold sub-sections, so direct
calls that cross sections can violate this assumption.

Attached patch removes the assumption from gcc, so "far" calls are
always emitted instead. In effect, gcc leaves the job of relaxing
calls (that obviously is not up to) to the linker. In my testing,
linker does its magic quite well and relaxes "far" calls back to
"near" call when hot and cold sections are merged.

2010-11-20  Uros Bizjak  <ubizjak@gmail.com>

	PR target/46533
	* config/alpha/predicates.md (direct_call_operand): Return false
	for !TARGET_SMALL_TEXT targets.

Patch was tested on alphaev68-pc-linux-gnu.

OK for mainline?

Uros.
-------------- next part --------------
Index: config/alpha/predicates.md
===================================================================
--- config/alpha/predicates.md	(revision 166974)
+++ config/alpha/predicates.md	(working copy)
@@ -266,8 +266,6 @@
 (define_predicate "direct_call_operand"
   (match_operand 0 "samegp_function_operand")
 {
-  tree op_decl, cfun_sec, op_sec;
-
   /* If profiling is implemented via linker tricks, we can't jump
      to the nogp alternate entry point.  Note that crtl->profile
      would not be correct, since that doesn't indicate if the target
@@ -291,21 +289,7 @@
   if (TARGET_SMALL_TEXT)
     return true;
 
-  /* Otherwise, a decl is "near" if it is defined in the same section.  */
-  if (flag_function_sections)
-    return false;
-
-  op_decl = SYMBOL_REF_DECL (op);
-  if (DECL_ONE_ONLY (current_function_decl)
-      || (op_decl && DECL_ONE_ONLY (op_decl)))
-    return false;
-
-  cfun_sec = DECL_SECTION_NAME (current_function_decl);
-  op_sec = op_decl ? DECL_SECTION_NAME (op_decl) : NULL;
-  return ((!cfun_sec && !op_sec)
-	  || (cfun_sec && op_sec
-	      && strcmp (TREE_STRING_POINTER (cfun_sec),
-		         TREE_STRING_POINTER (op_sec)) == 0));
+  return false;
 })
 
 ;; Return 1 if OP is a valid operand for the MEM of a CALL insn.


More information about the Gcc-patches mailing list