[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 13 09:17:12 PDT 2025
zmodem wrote:
> It turns out another issue (https://crbug.com/402425841) also bisected to this PR. That one is a run-time problem, so it may be trickier to figure out, but I will look into it next.
The bugs seem related by both involving the ICU library, and if squinting a bit it seems they might both involve UnicodeString:
It's not really clear *which* relocations against *which* .text section the linker is complaining about, but `.SCOVP$M` has a relocation against `??_EUnicodeString at icu_74@@UEAAPEAXI at Z` (`public: virtual void * __ptr64 __cdecl icu_74::UnicodeString::vector deleting destructor'(unsigned int) __ptr64`) as well as five against some .text section here:
```
$ build/bin/llvm-objdump -r repro.bad/C/src/chromium/src/out/Release/obj/third_party/icu/icuuc_private/filteredbrk.obj
[...]
RELOCATION RECORDS FOR [.SCOVP$M]:
OFFSET TYPE VALUE
0000000000000000 IMAGE_REL_AMD64_ADDR64 ??_EUnicodeString at icu_74@@UEAAPEAXI at Z
0000000000000010 IMAGE_REL_AMD64_ADDR64 .text
0000000000000020 IMAGE_REL_AMD64_ADDR64 .text
0000000000000030 IMAGE_REL_AMD64_ADDR64 .text
0000000000000040 IMAGE_REL_AMD64_ADDR64 .text
0000000000000050 IMAGE_REL_AMD64_ADDR64 .text
```
and that's the only vector deleting destructor I find referenced from `.SCOVP$M`.
In the crash from https://crbug.com/402425841 the code seems to segfault while doing something with `UnicodeString`'s vftable:
```
(12f60.1df84): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify checksum for gen-regexp-special-case.exe.exe
gen_regexp_special_case_exe!icu_74::UnicodeString::~UnicodeString+0x6:
0076c216 c70154a37f00 mov dword ptr [ecx],offset gen_regexp_special_case_exe!icu_74::UnicodeString::`vftable' (007fa354) ds:002b:00000001=????????
(12f60.1df84): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify checksum for gen-regexp-special-case.exe.exe
gen_regexp_special_case_exe!icu_74::UnicodeString::~UnicodeString+0x6:
0076c216 c70154a37f00 mov dword ptr [ecx],offset gen_regexp_special_case_exe!icu_74::UnicodeString::`vftable' (007fa354) ds:002b:00000001=????????
0:000:x86> k
# ChildEBP RetAddr
00 04cff514 007c0478 gen_regexp_special_case_exe!icu_74::UnicodeString::~UnicodeString+0x6 [o:\third_party\icu\source\common\unistr.cpp @ 423]
01 04cff528 0076988e gen_regexp_special_case_exe!icu_74::UnicodeString::~UnicodeString+0x18 [o:\third_party\icu\source\common\unicode\unistr.h @ 3346]
02 04cff53c 00774f0b gen_regexp_special_case_exe!uprv_deleteUObject_74+0x1e [o:\third_party\icu\source\common\uobject.cpp @ 105]
03 (Inline) -------- gen_regexp_special_case_exe!icu_74::UVector::removeAllElements+0x2d [o:\third_party\icu\source\common\uvector.cpp @ 255]
04 (Inline) -------- gen_regexp_special_case_exe!icu_74::UVector::~UVector+0x33 [o:\third_party\icu\source\common\uvector.cpp @ 64]
05 04cff554 00777f24 gen_regexp_special_case_exe!icu_74::UVector::~UVector+0x3b [o:\third_party\icu\source\common\uvector.cpp @ 63]
06 04cff570 0077da1b gen_regexp_special_case_exe!icu_74::UnicodeSet::~UnicodeSet+0x64 [o:\third_party\icu\source\common\uniset.cpp @ 199]
07 04cff728 0077d504 gen_regexp_special_case_exe!icu_74::UnicodeSet::closeOverCaseInsensitive+0x4fb [o:\third_party\icu\source\common\uniset_closure.cpp @ 295]
08 04cff738 0074137d gen_regexp_special_case_exe!icu_74::UnicodeSet::closeOver+0x34 [o:\third_party\icu\source\common\uniset_closure.cpp @ 228]
09 04cffa08 00741ad9 gen_regexp_special_case_exe!v8::internal::PrintSpecial+0xbd [o:\v8\src\regexp\gen-regexp-special-case.cc @ 70]
0a 04cffae4 00741bc5 gen_regexp_special_case_exe!v8::internal::WriteHeader+0x229 [o:\v8\src\regexp\gen-regexp-special-case.cc @ 148]
0b 04cffaf4 007ccb5c gen_regexp_special_case_exe!main+0x15 [o:\v8\src\regexp\gen-regexp-special-case.cc @ 164]
0c (Inline) -------- gen_regexp_special_case_exe!invoke_main+0x1c [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 78]
0d 04cffb3c 76b77ba9 gen_regexp_special_case_exe!__scrt_common_main_seh+0xfa [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
0e 04cffb4c 77acc28b KERNEL32!BaseThreadInitThunk+0x19
0f 04cffba4 77acc20f ntdll32!__RtlUserThreadStart+0x2b
10 04cffbb4 00000000 ntdll32!_RtlUserThreadStart+0x1b
```
So maybe there is something wrong with the vector deleting destructor for ICU's UnicodeString or how it's being used.
https://github.com/llvm/llvm-project/pull/126240
More information about the cfe-commits
mailing list