This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: toplev.c: Question on __gnu_lto markers in .comm
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 22 Feb 2012 12:26:14 +0100
- Subject: Re: toplev.c: Question on __gnu_lto markers in .comm
- Authentication-results: mr.google.com; spf=pass (google.com: domain of richard.guenther@gmail.com designates 10.42.19.5 as permitted sender) smtp.mail=richard.guenther@gmail.com; dkim=pass header.i=richard.guenther@gmail.com
- References: <4F44CF3B.8010208@gjlay.de>
On Wed, Feb 22, 2012 at 12:19 PM, Georg-Johann Lay <avr@gjlay.de> wrote:
> toplev.c emits __gnu_lto markers to assembler:
>
> ?/* Emit LTO marker if LTO info has been previously emitted. ?This is
> ? ? used by collect2 to determine whether an object file contains IL.
> ? ? We used to emit an undefined reference here, but this produces
> ? ? link errors if an object file with IL is stored into a shared
> ? ? library without invoking lto1. ?*/
> ?if (flag_generate_lto)
> ? ?{
> #if defined ASM_OUTPUT_ALIGNED_DECL_COMMON
> ? ? ?ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, NULL_TREE,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"__gnu_lto_v1",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(unsigned HOST_WIDE_INT) 1, 8);
> #elif defined ASM_OUTPUT_ALIGNED_COMMON
> ? ? ?ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, "__gnu_lto_v1",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (unsigned HOST_WIDE_INT) 1, 8);
> #else
> ? ? ?ASM_OUTPUT_COMMON (asm_out_file, "__gnu_lto_v1",
> ? ? ? ? ? ? ? ? ? ? ? ? (unsigned HOST_WIDE_INT) 1,
> ? ? ? ? ? ? ? ? ? ? ? ? (unsigned HOST_WIDE_INT) 1);
> #endif
>
> ...
>
> Am I right that this is just used as marker for linker/lto1 to detect presence
> and style of IL representation?
>
> Background is as follows:
>
> A trivial program, compiled for avr and without LTO, at the and of assembler
> output there is
>
> ? ? ? ?.ident ?"GCC: (GNU) 4.7.0 20120220 (experimental)"
>
> whereas with the LTO there is:
>
> ? ? ? ?.comm ? __gnu_lto_v1,1,1
> ? ? ? ?.ident ?"GCC: (GNU) 4.7.0 20120220 (experimental)"
> .global __do_clear_bss
>
> avr only supports static linking.
>
> The avr backend thinks that the symbol occupies space on the silicon and needs
> to be allocated and initialized so that a part of the startup code is dragged
> in which is not needed.
>
> Is it always save to ignore __gnu_lto_* symbols when deciding which parts of
> startup code are needed?
Yes.
We should transition away from emitting __gnu_lto_v1 (which is only used
if you do not use a linker plugin btw) for example by making collect2 use
simple-object from libiberty instead of invoking nm and friends.
Richard.
> Thanks,
>
> Johann