Message ID | 87vbt7bl9e.fsf@talisman.default |
---|---|
State | New |
Headers | show |
On Thu, May 15, 2014 at 2:37 AM, Richard Sandiford <rdsandiford@googlemail.com> wrote: > get_pool_constant can return general constants, not just SYMBOL_REFs, > so the code does look wrong. In the particular case of CONST flagged up > in the message, SYMBOL_REF_TLS_MODEL would read beyond the end of the rtx. > I think you would have seen the same failure before the patch with > --enable-checking=yes,rtl. > > The reason my patch broke the bootstrap is that SYMBOL_REF_FLAGS now > checks based on ENABLE_RTL_FLAG_CHECKING rather than ENABLE_RTL_CHECKING. > I'd done that because u2 is part of the header and so checking it felt > more like checking a flag than the format. Perhaps that was a bad > idea though, since it will slow down --enable-checking=yes (but not > --enable-checking=release) compilers. OTOH it will catch things like > this. I can switch it back if that seems better. > > Does the patch below fix things? > > Thanks, > Richard > > > gcc/ > * config/rs6000/rs600.c (rs6000_real_tls_symbol_ref_p): New function. > (rs6000_delegitimize_address): Use it. The patch allows me to get past the failure. I wasn't certain if the check was too strict or not. I'm bootstrapping and running the testsuite now. Thanks, David
Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c 2014-05-15 07:29:15.103636841 +0100 +++ gcc/config/rs6000/rs6000.c 2014-05-15 07:30:54.504504200 +0100 @@ -6803,6 +6803,16 @@ rs6000_output_dwarf_dtprel (FILE *file, fputs ("@dtprel+0x8000", file); } +/* Return true if X is a symbol that refers to real (rather than emulated) + TLS. */ + +static bool +rs6000_real_tls_symbol_ref_p (rtx x) +{ + return (GET_CODE (x) == SYMBOL_REF + && SYMBOL_REF_TLS_MODEL (x) >= TLS_MODEL_REAL); +} + /* In the name of slightly smaller debug output, and to cater to general assembler lossage, recognize various UNSPEC sequences and turn them back into a direct symbol reference. */ @@ -6860,7 +6870,7 @@ rs6000_delegitimize_address (rtx orig_x) if (TARGET_XCOFF && GET_CODE (y) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (y) - && SYMBOL_REF_TLS_MODEL (get_pool_constant (y)) >= TLS_MODEL_REAL) + && rs6000_real_tls_symbol_ref_p (get_pool_constant (y))) return orig_x; #endif