[PATCH] Introduce mangle_assembler_name hook, resolve parts of PR43157, PR46674.
Richard Guenther
richard.guenther@gmail.com
Fri Dec 10 14:39:00 GMT 2010
On Fri, Dec 10, 2010 at 2:08 PM, Dave Korn <dave.korn.cygwin@gmail.com> wrote:
>
> Hello,
>
> The attached patch adds the new target hook discussed earlier(*) during the
> tail-end of the thread(**) about enabling the lto linker plugin all the time.
> The new hook, TARGET_MANGLE_ASSEMBLER_NAME, essentially does what
> varasm.c#assemble_name() does, only in memory rather than to a file stream.
> This allows the LTO symtabs to contain the real symbol names that match
> exactly the symbols in the native object sections in fat LTO files; previously
> they contained a mixture of C-level symbols and assembler-level symbols
> (coming from anything with an explicit asm name specified), and things went
> badly wrong on USER_LABEL_PREFIX-ing systems.
>
> This hook provides us the mechanism to resolve the remaining part of PR46674
> - a follow-on patch to make use of the new hook in
> varasm.c#compute_visible_aliases() will actually resolve that bug - and it
> resolves a problem shown up by the testcase for PR43157 that doesn't compile
> correctly under LTO on U_L_P targets. It obsoletes the crude and approximate
> hack of trying to do the equivalent in the lto-plugin now that it's not needed
> any more, although I didn't remove that code straight away just in case we
> need a get-out-of-jail-free-card; I'll rip it out next stage1.
The
+ const char *skipped = name + (*name == '*');
used in two places looks too clever to me. Instead write
name + (*name == '*' ? 1 : 0);
Ok with that change.
Thanks!
Richard.
> gcc/ChangeLog:
>
> 2010-12-10 Dave Korn <...
>
> PR middle-end/46674
> PR lto/43157
> * target.def (mangle_assembler_name): New target asm_out hook.
> * targhooks.c (default_mangle_assembler_name): Add default hook
> implementation.
> * targhooks.h (default_mangle_assembler_name): Add prototype.
> * lto-symtab.c (lto_symtab_register_decl): Use new hook when
> processing DECL_ASSEMBLER_NAMEs for lto symtabs.
> (lto_symtab_get_resolution): Likewise.
> (lto_cgraph_replace_node): Likewise.
> (lto_symtab_prevailing_decl): Likewise.
> * lto-streamer-out.c (write_symbol): Likewise.
> * doc/tm.texi.in (TARGET_MANGLE_ASSEMBLER_NAME): Add @hook directive.
> * doc/tm.texi: Regenerate.
> * config/i386/cygming.h (TARGET_MANGLE_ASSEMBLER_NAME): Define to
> point at i386_pe_mangle_assembler_name.
> * config/i386/winnt.c (i386_pe_mangle_assembler_name): New function.
> * config/i386/i386-protos.h (i386_pe_mangle_assembler_name): Add
> prototype.
>
> lto-plugin/ChangeLog:
>
> 2010-12-10 Dave Korn <...
>
> PR middle-end/46674
> PR lto/43157
> * configure.ac (SYM_STYLE): Don't AC_DEFINE.
> * lto-plugin.c (sym_style): Don't use it; default to ss_none.
> * configure: Regenerate.
> * config.h.in: Likewise.
>
> gcc/testsuite/ChangeLog:
>
> 2010-12-10 Dave Korn <...
>
> PR middle-end/46674
> PR lto/43157
> * gcc.dg/pr43157.c: New file.
>
> LTO-bootstrapped and tested c,c++,objc,obj-c++,fortran on
> x86_64-unknown-linux-gnu without regressions. LTO-bootstrapped
> c,c++,objc,obj-c++,fortran,java on i686-pc-cygwin, and tested
> c,c++,objc,obj-c++ so far without regressions - java,fortran still running.
>
> OK to commit?
>
> cheers,
> DaveK
> --
> (*) - http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00036.html
> (**) - http://gcc.gnu.org/ml/gcc-patches/2010-12/threads.html#00031
>
>
More information about the Gcc-patches
mailing list