Shrink the 0-length CIE. The previous one came from /bin/ls on my machine, the new one is based on the CIE description in the DWARF 3 spec (the LSB description leaves out too much detail, like the size of the version field).

Formatting cleanup.
This commit is contained in:
Nick Lewycky
2020-06-18 14:40:20 -07:00
parent 21827d8f80
commit 310ac6b44c

View File

@ -5,9 +5,9 @@ use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use wasm_common::entity::{EntityRef, PrimaryMap, SecondaryMap};
use wasm_common::LocalFunctionIndex;
use wasmer_compiler::{
Compilation, CompileError, CompileModuleInfo, Compiler, FunctionBodyData,
ModuleTranslationState, RelocationTarget, SectionIndex, Target, CustomSection,
SectionBody, CustomSectionProtection, Dwarf,
Compilation, CompileError, CompileModuleInfo, Compiler, CustomSection, CustomSectionProtection,
Dwarf, FunctionBodyData, ModuleTranslationState, RelocationTarget, SectionBody, SectionIndex,
Target,
};
use wasmer_runtime::{MemoryPlan, ModuleInfo, TablePlan};
@ -129,18 +129,17 @@ impl Compiler for LLVMCompiler {
let dwarf = if !frame_section_bytes.is_empty() {
let dwarf = Some(Dwarf::new(SectionIndex::from_u32(module_custom_sections.len() as u32)));
// Terminator CIE.
frame_section_bytes.extend(vec!
[0x00, 0x00, 0x00, 0x00, // Length
0x00, 0x00, 0x00, 0x00, // CIE ID
0x10, // Version (must be 1)
0x00, // Augmentation data
0x00, 0x00,
0xa4, 0x2e, 0x00, 0x00,
0x30, 0x73, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00]);
// Terminating zero-length CIE.
frame_section_bytes.extend(vec![
0x00, 0x00, 0x00, 0x00, // Length
0x00, 0x00, 0x00, 0x00, // CIE ID
0x10, // Version (must be 1)
0x00, // Augmentation data
0x00, // Code alignment factor
0x00, // Data alignment factor
0x00, // Return address register
0x00, 0x00, 0x00, // Padding to a multiple of 4 bytes
]);
module_custom_sections.push(CustomSection {
protection: CustomSectionProtection::Read,
bytes: SectionBody::new_with_vec(frame_section_bytes),