[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] When does __do_copy_data get inserted

From: Erik Christiansen
Subject: Re: [avr-gcc-list] When does __do_copy_data get inserted
Date: Sat, 2 Sep 2017 11:29:51 +1000
User-agent: Mutt/1.8.0 (2017-02-23)

Reply-To: address@hidden

On 25.08.17 02:24, Dylan McKay wrote:
> When does AVR-GCC insert __do_copy_data? How do I need to tune the output
> of LLVM in order to trigger GCC's insertion of this function?

In the absence of a reply from a maintainer, I'll at least give you the
courtesy of a reply, FWIW. I'm not familiar with gcc internals, but have
in the past run:

$ avr-gcc -dumpspecs | grep 'crt[0-9]'

to elicit e.g. %{mmcu=atmega16:crtm16.o%s} , when chasing which crt was
going to be used. Unfortunately, even a grep for just "crt" finds
nothing in avr-gcc (GCC) 4.7.2, which is still the latest I have here.

So the old logic is probably not there any more, but the object file
does reveal that the code was linked in, and avr-gcc was only inserting
a function call.

> I've looked at the GCC source and as far as I can tell, the logic is based
> in 'avr_asm_named_section' in 'gcc/config/avr/avr.c'. The code I can see
> just looks at the section names, sees if it can find sections prefixed with
> '.rodata', '.data', or '.bss'.
> The LLVM backend is correctly placing my global variable into a section
> prefixed with '.data', but linking with avr-gcc still does not include
> __do_copy_data.
> I have attached the output of 'objdump -t' for my reference LLVM and GCC
> program. They are not identical, but they both read from a global variable
> named 'FOO'.

ISTM that the first problem is that avr-gcc has inserted the necessary
__do_copy_data call, but LLVM has not. At link time (whether avr-ld is
invoked directly or through avr-gcc), the correct crtxx.o will need to
be supplied on the avr-ld command line, for the undefined __do_copy_data
to be satisfied correctly. Well, that's my user-grade supposition, anyway. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]