2016-05-21 02:35:07 +02:00
|
|
|
//===-- AVRTargetStreamer.cpp - AVR Target Streamer Methods ---------------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-05-21 02:35:07 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file provides AVR specific target streamer methods.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "AVRTargetStreamer.h"
|
|
|
|
|
2017-09-11 12:32:51 +02:00
|
|
|
#include "llvm/MC/MCContext.h"
|
|
|
|
|
2016-05-21 02:35:07 +02:00
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
AVRTargetStreamer::AVRTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
|
|
|
|
|
|
|
|
AVRTargetAsmStreamer::AVRTargetAsmStreamer(MCStreamer &S)
|
|
|
|
: AVRTargetStreamer(S) {}
|
|
|
|
|
2017-09-11 12:32:51 +02:00
|
|
|
void AVRTargetStreamer::finish() {
|
|
|
|
MCStreamer &OS = getStreamer();
|
|
|
|
MCContext &Context = OS.getContext();
|
|
|
|
|
|
|
|
MCSymbol *DoCopyData = Context.getOrCreateSymbol("__do_copy_data");
|
|
|
|
MCSymbol *DoClearBss = Context.getOrCreateSymbol("__do_clear_bss");
|
|
|
|
|
|
|
|
// FIXME: We can disable __do_copy_data if there are no static RAM variables.
|
|
|
|
|
|
|
|
OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
|
|
|
|
OS.emitRawComment("copy all variables from program memory to RAM on startup");
|
2020-02-15 03:16:24 +01:00
|
|
|
OS.emitSymbolAttribute(DoCopyData, MCSA_Global);
|
2017-09-11 12:32:51 +02:00
|
|
|
|
|
|
|
OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
|
|
|
|
OS.emitRawComment("clear the zeroed data section on startup");
|
2020-02-15 03:16:24 +01:00
|
|
|
OS.emitSymbolAttribute(DoClearBss, MCSA_Global);
|
2017-09-11 12:32:51 +02:00
|
|
|
}
|
|
|
|
|
2016-05-21 02:35:07 +02:00
|
|
|
} // end namespace llvm
|
|
|
|
|