LLVM Fragment Type

Hi there,

I am studying LLVM and RISCV , and currently I am reading the source code.

Now I have a question on the Fragment and Fragment Type (I put a code slice below), I guess that can be related to generate assemble or elf file. But it is hard for me to map the source code to real assembler file or elf file.

could you please tell me the meaning of Fragment and Fragment type? What is the relationship between fragment and sections? How are they used to generate obj file? Thanks in advance.

Best Regards,

David.

public:
enum FragmentType : uint8_t {
FT_Align,
FT_Data,
FT_CompactEncodedInst,
FT_Fill,
FT_Relaxable,
FT_Org,
FT_Dwarf,
FT_DwarfFrame,
FT_LEB,
FT_Padding,
FT_SymbolId,
FT_CVInlineLines,
FT_CVDefRange,
FT_Dummy
};

Hi there,
I am studying LLVM and RISCV , and currently I am reading the source code.
Now I have a question on the Fragment and Fragment Type (I put a code slice below), I guess that can be related to generate assemble or elf file. But it is hard for me to map the source code to real assembler file or elf file.
could you please tell me the meaning of Fragment and Fragment type? What is the relationship between fragment and sections? How are they used to generate obj file? Thanks in advance.
Best Regards,
David.
public:
enum FragmentType : uint8_t {
FT_Align,

Represents an .align directive

FT_Data,

Represents data or non-relaxable instructions

FT_CompactEncodedInst,

Used by NaCl's aligned instruction bunble for some instructions without
fixups.

FT_Fill,

A .fill directive Fill (Using as)

FT_Relaxable,

A fragment containing a relaxable MCInst. An example is x86's JCC_1, jz
foo can be encoded in either 2 bytes or 6 bytes (or 3 bytes in 16-bit
mode), depending on the offset.

FT_Org,

.org directive Org (Using as)

FT_Dwarf,

A DWARF line table entry .loc

FT_DwarfFrame,

Related to .cfi_*

FT_LEB,

Used in some DWARF encodings for ULEB128.

FT_Padding,

Deleted by https://reviews.llvm.org/D71106
Intended as a framework to pad code with NOP instruction to
improve/stabalize performance.

FT_SymbolId,

Windows Safe SEH related stuff.

FT_CVInlineLines,
FT_CVDefRange,

CodeView .cv_* related stuff.