Shiva Chen | 056d835 | 2018-01-26 07:53:07 +0000 | [diff] [blame] | 1 | //===-- RISCVELFStreamer.cpp - RISCV ELF Target Streamer Methods ----------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame^] | 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 |
Shiva Chen | 056d835 | 2018-01-26 07:53:07 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file provides RISCV specific target streamer methods. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "RISCVELFStreamer.h" |
| 14 | #include "RISCVMCTargetDesc.h" |
| 15 | #include "llvm/BinaryFormat/ELF.h" |
| 16 | #include "llvm/MC/MCSubtargetInfo.h" |
| 17 | |
| 18 | using namespace llvm; |
| 19 | |
| 20 | // This part is for ELF object output. |
| 21 | RISCVTargetELFStreamer::RISCVTargetELFStreamer(MCStreamer &S, |
| 22 | const MCSubtargetInfo &STI) |
| 23 | : RISCVTargetStreamer(S) { |
| 24 | MCAssembler &MCA = getStreamer().getAssembler(); |
| 25 | |
| 26 | const FeatureBitset &Features = STI.getFeatureBits(); |
| 27 | |
| 28 | unsigned EFlags = MCA.getELFHeaderEFlags(); |
| 29 | |
| 30 | if (Features[RISCV::FeatureStdExtC]) |
| 31 | EFlags |= ELF::EF_RISCV_RVC; |
| 32 | |
| 33 | MCA.setELFHeaderEFlags(EFlags); |
| 34 | } |
| 35 | |
| 36 | MCELFStreamer &RISCVTargetELFStreamer::getStreamer() { |
| 37 | return static_cast<MCELFStreamer &>(Streamer); |
| 38 | } |
Alex Bradbury | bca0c3c | 2018-05-11 17:30:28 +0000 | [diff] [blame] | 39 | |
Alex Bradbury | 893e5bc | 2018-11-28 16:39:14 +0000 | [diff] [blame] | 40 | void RISCVTargetELFStreamer::emitDirectiveOptionPush() {} |
| 41 | void RISCVTargetELFStreamer::emitDirectiveOptionPop() {} |
Alex Bradbury | bca0c3c | 2018-05-11 17:30:28 +0000 | [diff] [blame] | 42 | void RISCVTargetELFStreamer::emitDirectiveOptionRVC() {} |
| 43 | void RISCVTargetELFStreamer::emitDirectiveOptionNoRVC() {} |
Alex Bradbury | 9c03e4c | 2018-11-12 14:25:07 +0000 | [diff] [blame] | 44 | void RISCVTargetELFStreamer::emitDirectiveOptionRelax() {} |
| 45 | void RISCVTargetELFStreamer::emitDirectiveOptionNoRelax() {} |