On Thu, Apr 23, 2015 at 7:24 AM, Alan Modra <amo...@gmail.com> wrote: > Revised patch, supporting linker that aligns the toc base. > > This fixes a thinko in offsettable_ok_by_alignment. It's not the > absolute placement that matters, but the toc-pointer relative offset. > So alignment of r2 also needs to be taken into account. > > Changing offsettable_ok_by_alignment has a ripple effect into the 'm' > constraint so we also need to ensure rs6000_legitimize_reload_address > does not create invalid toc-relative addresses. As found by > gcc.dg/torture/builtin-math-2.c -Os. That's the reason for the > use_toc_relative_ref change. I hope the size check along with > reg_offset_p is sufficient here. It seems so, but it's difficult to > be certain due to how hard it is to get just the right combination of > reload conditions to trigger. > > Bootstrapped and regression tested powerpc64-linux and > powerpc64le-linux, both with a new and old linker. OK for mainline? > > PR target/65810 > * config/rs6000/rs6000.c (POWERPC64_TOC_POINTER_ALIGNMENT): Define. > (offsettable_ok_by_alignment): Use minimum of decl and toc > pointer alignment. Replace dead code with assertion. > (use_toc_relative_ref): Add mode arg. Return false in -mcmodel=medium > case if size exceeds toc pointer alignment. > (rs6000_legitimize_reload_address): Update use_toc_relative_ref call. > (rs6000_emit_move): Likewise. > * configure.ac: Add linker toc pointer alignment check. > * configure: Regenerate. > * config.in: Regenerate.
Okay. Thanks, David