Fix debug information relocation (when imports present) (#1997)
This commit is contained in:
@@ -448,7 +448,9 @@ impl<'a> ObjectBuilder<'a> {
|
|||||||
let section_id = *dwarf_sections_ids.get(name).unwrap();
|
let section_id = *dwarf_sections_ids.get(name).unwrap();
|
||||||
for reloc in relocs {
|
for reloc in relocs {
|
||||||
let target_symbol = match reloc.target {
|
let target_symbol = match reloc.target {
|
||||||
DwarfSectionRelocTarget::Func(index) => func_symbols[FuncIndex::new(index)],
|
DwarfSectionRelocTarget::Func(index) => {
|
||||||
|
func_symbols[module.local.func_index(DefinedFuncIndex::new(index))]
|
||||||
|
}
|
||||||
DwarfSectionRelocTarget::Section(name) => {
|
DwarfSectionRelocTarget::Section(name) => {
|
||||||
obj.section_symbol(*dwarf_sections_ids.get(name).unwrap())
|
obj.section_symbol(*dwarf_sections_ids.get(name).unwrap())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Compile with:
|
// Compile with:
|
||||||
// clang++ --target=wasm32 fraction-norm.cc -o fraction-norm.wasm -g \
|
// clang++ --target=wasm32-wasi fraction-norm.cc -o fraction-norm.wasm -g \
|
||||||
// -O0 -nostdlib -fdebug-prefix-map=$PWD=.
|
// -O0 -fdebug-prefix-map=$PWD=.
|
||||||
|
|
||||||
struct Fraction {
|
struct Fraction {
|
||||||
long numerator;
|
long numerator;
|
||||||
@@ -32,9 +32,9 @@ void norm(Fraction &n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
int main()
|
||||||
void _start()
|
|
||||||
{
|
{
|
||||||
Fraction c = {6, 27};
|
Fraction c = {6, 27};
|
||||||
norm(c);
|
norm(c);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user