在 2026-11-13 21:16, Oleg Tolmatcev 写道:
пт, 13 нояб. 2026 г. в 12:07, LIU Hao <[email protected]>:
Here is the review from Claude Opus. I checked it and it seems correct.
---
The bug the patch describes is real, but the fix breaks the case your
original helper handled correctly: hidden symbols that have an asm
label.
...

**Case 2: asm labels (the patch breaks this).** For
`__attribute__((visibility("hidden"))) void f (void) __asm__("_f");`:
- `DECL_ASSEMBLER_NAME` is `*_f`, and the object symbol is exactly
`_f`, which ld compares as `f`.
- Old code: strip `*` → `_f`, strip prefix → `f`. Correct.
- New code: strip `*` → `_f`. The exclusion no longer matches, so `f`
gets auto-exported from the DLL again.

OK, let me rethink about this:

   void asm_prefix(void)
     __asm__("_asm_prefix");
   void asm_prefix(void) { }

   void asm_noprefix(void)
     __asm__("asm_noprefix");
   void asm_noprefix(void) { }

   __declspec(dllexport) void dllexport_asm_prefix(void)
     __asm__("_dllexport_asm_prefix");
   void dllexport_asm_prefix(void) { }

   __declspec(dllexport) void dllexport_asm_noprefix(void)
     __asm__("dllexport_asm_noprefix");
   void dllexport_asm_noprefix(void) { }


Only the first one can be exported (as `asm_prefix`); the other three all fail:

   $ gcc export.c -Wl,--export-all-symbols -shared
   C:/MSYS64/mingw32/bin/../lib/gcc/i686-w64-mingw32/17.0.0/../../../../i686-w64
   -mingw32/bin/ld.exe: cannot export _dllexport_asm_prefix: symbol not found
   C:/MSYS64/mingw32/bin/../lib/gcc/i686-w64-mingw32/17.0.0/../../../../i686-w64
   -mingw32/bin/ld.exe: cannot export asm_noprefix: symbol not found
   C:/MSYS64/mingw32/bin/../lib/gcc/i686-w64-mingw32/17.0.0/../../../../i686-w64
   -mingw32/bin/ld.exe: cannot export dllexport_asm_noprefix: symbol not found


I'll see how to handle the first one.



--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to