Skip to content

Fix interp: unknown type kind in markExternalValue when compiling libsecp256k1 wrappers #5292

@hectorchu

Description

@hectorchu

Hi,

The error is caused by markExternal not handling VectorTypes and MetadataTypes. Please add cases for them so that libsecp256k1 can compile successfully.

I suggest this diff, it seems to work:

diff --git a/interp/memory.go b/interp/memory.go
index 2812cd01..e5e6a801 100644
--- a/interp/memory.go
+++ b/interp/memory.go
@@ -223,6 +223,8 @@ func (mv *memoryView) markExternal(llvmValue llvm.Value, mark uint8) error {
                                }
                        }
                case llvm.ArrayTypeKind:
+                       fallthrough
+               case llvm.VectorTypeKind:
                        numElements := llvmType.ArrayLength()
                        for i := 0; i < numElements; i++ {
                                element := mv.r.builder.CreateExtractValue(llvmValue, i, "")
@@ -231,6 +233,7 @@ func (mv *memoryView) markExternal(llvmValue llvm.Value, mark uint8) error {
                                        return err
                                }
                        }
+               case llvm.MetadataTypeKind:
                default:
                        return errors.New("interp: unknown type kind in markExternalValue")
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions