Skip to content

[coreCLR] mscorrc.cpp is not sorted on windows build host #122403

@pavelsavara

Description

@pavelsavara
  • artifacts\obj\coreclr\browser.wasm.Debug\dlls\mscorrc\mscorrc.cpp is not sorted by the ID.
  • CompareNativeStringResources of src\coreclr\nativeresources\resourcestring.cpp uses bsearch
  • emscripten bsearch is actually binary search not just linear scan.

Actual: Undefined resource string ID:0x1A88
Expected: Could not load file or assembly '%1'. %2

Workaround:

void *linearsearch(const void *key, const void *base, size_t nel, size_t width, int (*cmp)(const void *, const void *))
{
    const char *p = (const char *)base;
    for (size_t i = 0; i < nel; i++)
    {
        if (cmp(key, p) == 0)
            return (void *)p;
        p += width;
    }
	return NULL;
}

and

-NativeStringResource *resourceEntry = (NativeStringResource*)bsearch(
+NativeStringResource *resourceEntry = (NativeStringResource*)linearsearch(

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions