x64asm/instruction/section.rs
1// This file is part of "x64asm"
2// Under the MIT License
3// Copyright (c) 2023 Antonin Hérault
4
5use crate::convert::{ ToAssembly, Separator };
6
7/// Creates a `Mnemonic::Section`.
8#[macro_export]
9macro_rules! section {
10 ($section:expr) => {
11 instruction::Mnemonic::Section($section)
12 }
13}
14
15#[derive(Debug, Clone, PartialEq, Eq)]
16pub enum Section {
17 Text,
18 Bss,
19 Data,
20 Rodata,
21}
22
23impl ToAssembly for Section {
24 fn to_assembly(&self, separator: Separator) -> String {
25 match self {
26 _ => format!("section .{:?}", self).to_lowercase()
27 }
28 }
29}