On Monday 05 August 2024 17:00:20 LIU Hao wrote: > 在 2024-08-05 00:44, Pali Rohár 写道: > > _init_scprintf: > > ... > > .def __vscprintf; .scl 2; .type 32; .endef > > .def _init_scprintf; .scl 2; .type 32; .endef > > > > It is correct that _init_scprintf has two ".def" lines? > > Probably not... If it is declared elsewhere, we might want to remove the > `.def` directive from assembly. > > And whatever scl (storage class) it appears in the symbol table probably > does not matter. The symbol shall not escape that .o file, and that's all. > > > -- > Best regards, > LIU Hao
I run 'nm' on the original version and new version (without static). The original version is: 00000000 b .bss 00000000 d .data 00000010 t _emu_scprintf U __imp__GetModuleHandleW@4 U __imp__GetProcAddress@8 00000000 D __imp___scprintf 00000000 t _init_scprintf 00000000 r .rdata 00000000 r .rdata$zzz 00000030 t _resolve_scprintf 00000007 T __scprintf 00000000 t .text U __vscprintf And the difference between original a new is: @@ -4,7 +4,7 @@ U __imp__GetModuleHandleW@4 U __imp__GetProcAddress@8 00000000 D __imp___scprintf -00000000 t _init_scprintf +00000000 T _init_scprintf 00000000 r .rdata 00000000 r .rdata$zzz 00000030 t _resolve_scprintf When static is removed then init_scprintf is marked with uppercase T, same as _scprintf. So it looks like that for GNU binutils, the init_scprintf is global / exported when static keyword is not present. So it looks like that the symbol can escape from the .o file and can be referenced by other files. For me this does not look safe. _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public