On Wed, Nov 18, 2015 at 09:52:41AM +1030, Alan Modra wrote: > David noticed that gcc112 was generating gcc/auto-host.h with > #define POWERPC64_TOC_POINTER_ALIGNMENT 32768 > > This is not the correct value of either 8 or 256 depending on how old > ld is. On investigating I found the cause is Fedora 21 modifying the > toolchain to default to -z relro. ld -z relro puts the relro gap just > before .got (prior to my patches reordering sections for relro on > powerpc64). That unfortunately aligns .got, defeating the deliberate > mis-alignment of .got in the testcase. > > Fixed with the following obvious patch and committed to mainline. > > Incidentally, bootstrap fails for me on powerpc64 due to "comparison > is always true due to limited range of data type [-Wtype-limits]" > && GET_MODE_SIZE (mode) <= POWERPC64_TOC_POINTER_ALIGNMENT)); > since my POWERPC64_TOC_POINTER_ALIGNMENT is 256 and mode_size is an > unsigned char array. Grrr, so what code obfuscation do we use here to > work around this annoying warning?
For the moment, I added the following to my local build. However, I can't build libgcc on an x86 cross compiler: In file included from /home/meissner/fsf-src/ieee/libgcc/soft-fp/soft-fp.h:321:0, from addkf3.c:33: addkf3.c: In function ‘__addkf3’: /home/meissner/fsf-src/ieee/libgcc/soft-fp/op-common.h:2057:6: internal compiler error: in convert_move, at expr.c:286 (r) = __builtin_clzl (x); \ ~~~~^~~~~~~~~~~~~~~~~~~~ /home/meissner/fsf-src/ieee/libgcc/soft-fp/op-2.h:129:2: note: in expansion of macro ‘__FP_CLZ’ __FP_CLZ ((R), X##_f1); \ ^~~~~~~~ /home/meissner/fsf-src/ieee/libgcc/soft-fp/op-common.h:827:8: note: in expansion of macro ‘_FP_FRAC_CLZ_2’ _FP_FRAC_CLZ_##wc (_FP_ADD_INTERNAL_diff, R); \ ^~~~~~~~~~~~~ /home/meissner/fsf-src/ieee/libgcc/soft-fp/op-common.h:850:34: note: in expansion of macro ‘_FP_ADD_INTERNAL’ #define _FP_ADD(fs, wc, R, X, Y) _FP_ADD_INTERNAL (fs, wc, R, X, Y, '+') ^~~~~~~~~~~~~~~~ /home/meissner/fsf-src/ieee/libgcc/soft-fp/quad.h:306:29: note: in expansion of macro ‘_FP_ADD’ # define FP_ADD_Q(R, X, Y) _FP_ADD (Q, 2, R, X, Y) ^~~~~~~ addkf3.c:48:3: note: in expansion of macro ‘FP_ADD_Q’ FP_ADD_Q (R, A, B); ^~~~~~~~ 0x78432e convert_move(rtx_def*, rtx_def*, int) /home/meissner/fsf-src/ieee/gcc/expr.c:286 0x8753a6 expand_direct_optab_fn /home/meissner/fsf-src/ieee/gcc/internal-fn.c:2132 0x6686ca expand_call_stmt /home/meissner/fsf-src/ieee/gcc/cfgexpand.c:2565 0x6698e4 expand_gimple_stmt_1 /home/meissner/fsf-src/ieee/gcc/cfgexpand.c:3525 0x6698e4 expand_gimple_stmt /home/meissner/fsf-src/ieee/gcc/cfgexpand.c:3688 0x66b2fe expand_gimple_basic_block /home/meissner/fsf-src/ieee/gcc/cfgexpand.c:5694 0x66f226 execute /home/meissner/fsf-src/ieee/gcc/cfgexpand.c:6309 Please submit a full bug report, Here is the temporary patch I'm using to get past rs6000.c. But I suspect the TOC alignment should never be 256. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 230511) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -7992,14 +7992,21 @@ rs6000_cannot_force_const_mem (machine_m can be addressed relative to the toc pointer. */ static bool -use_toc_relative_ref (rtx sym, machine_mode mode) +use_toc_relative_ref (rtx sym, machine_mode mode ATTRIBUTE_UNUSED) { return ((constant_pool_expr_p (sym) && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (sym), get_pool_mode (sym))) || (TARGET_CMODEL == CMODEL_MEDIUM && SYMBOL_REF_LOCAL_P (sym) - && GET_MODE_SIZE (mode) <= POWERPC64_TOC_POINTER_ALIGNMENT)); + /* If the linker says that TOC alignment is 256 bits, this test + will always be true, since GET_MODE_SIZE returns an unsigned + char on the PowerPC. Prevent an warning/error in this + case. */ +#if POWERPC64_TOC_POINTER_ALIGNMENT < 256 + && GET_MODE_SIZE (mode) <= POWERPC64_TOC_POINTER_ALIGNMENT +#endif + )); } /* Our implementation of LEGITIMIZE_RELOAD_ADDRESS. Returns a value to -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797