avr-gcc-list
[Top][All Lists]
Advanced

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

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


From: Dylan McKay
Subject: [avr-gcc-list] When does __do_copy_data get inserted
Date: Fri, 25 Aug 2017 02:24:03 +1200

Hello all,

I maintain the AVR LLVM backend, for which downstream users typically use avr-gcc to link, so they get the CRT, startup routines, and libgcc.

I've noticed that AVR-GCC does not insert the __do_copy_data function for LLVM generated executables, but it does for GCC generated ones.

In case reads have not heard of this function, it is one of a few small routines which copies all variables from the .data, .rodata, and .bss in program memory into RAM during startup.

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?

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'.


Attachment: blink.gcc.o.objdump
Description: Binary data

Attachment: blink.llvm.o.objdump
Description: Binary data


reply via email to

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