1 //===-- AVRTargetStreamer.cpp - AVR Target Streamer Methods ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file provides AVR specific target streamer methods.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "AVRTargetStreamer.h"
14 
15 #include "llvm/MC/MCContext.h"
16 
17 namespace llvm {
18 
19 AVRTargetStreamer::AVRTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
20 
21 AVRTargetAsmStreamer::AVRTargetAsmStreamer(MCStreamer &S)
22     : AVRTargetStreamer(S) {}
23 
24 void AVRTargetStreamer::finish() {
25   MCStreamer &OS = getStreamer();
26   MCContext &Context = OS.getContext();
27 
28   MCSymbol *DoCopyData = Context.getOrCreateSymbol("__do_copy_data");
29   MCSymbol *DoClearBss = Context.getOrCreateSymbol("__do_clear_bss");
30 
31   // FIXME: We can disable __do_copy_data if there are no static RAM variables.
32 
33   OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
34   OS.emitRawComment("copy all variables from program memory to RAM on startup");
35   OS.EmitSymbolAttribute(DoCopyData, MCSA_Global);
36 
37   OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
38   OS.emitRawComment("clear the zeroed data section on startup");
39   OS.EmitSymbolAttribute(DoClearBss, MCSA_Global);
40 }
41 
42 } // end namespace llvm
43 
44