On Thu, Mar 31, 2011 at 01:35:17PM -0500, Peter Bergner wrote: > Alan, > > Mainline seems to be broken on bootstrap when GCC is configured with > LD=/path/to/ld/that/supports/Large-TOC. I'm attaching a preprocessed > source file from the build and it compiles fine with -mcmodel=small, > but ICE's when using -mcmodel={medium,large}. Can you please have > a look? Thanks.
So, dwarf2out.c:gen_subprogram_die calls mem_loc_descriptor with the lo_sum in the following (gdb) p debug_rtx(call_arg_locations->call_arg_loc_note) (note 38 22 37 (expr_list:REG_DEP_TRUE (concat:DI (reg:DI 3 3) (lo_sum:DI (plus:DI (reg:DI 2 2) (high:DI (unspec:DI [ (const_int 0 [0]) ] UNSPEC_TLSLD))) (unspec:DI [ (const_int 0 [0]) ] UNSPEC_TLSLD))) (nil)) NOTE_INSN_CALL_ARG_LOCATION) which is no doubt from the rs6000 tls_ld patterns. mem_loc_descriptor ignores the first arg of the lo_sum (fair enough), and passes the second arg, the unspec, to const_ok_for_output. const_ok_for_output says it is ok, because rs6000 does not wrap the unspec in a const.. It seems to me that mem_loc_descriptor is making unwarranted assumptions about the contents of a lo_sum. Easily fixed. OK to apply mainline, assuming my bootstrap and regression test passes? * dwarf2out.c (mem_loc_descriptor): Recurse on LO_SUM. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 171817) +++ gcc/dwarf2out.c (working copy) @@ -13698,9 +13698,7 @@ mem_loc_descriptor (rtx rtl, enum machin break; case LO_SUM: - rtl = XEXP (rtl, 1); - - /* ... fall through ... */ + return mem_loc_descriptor (XEXP (rtl, 1), mode, initialized); case LABEL_REF: /* Some ports can transform a symbol ref into a label ref, because -- Alan Modra Australia Development Lab, IBM