On Wednesday 31 July 2024 00:13:24 LIU Hao wrote: > 在 2024-07-29 02:58, Pali Rohár 写道: > > stdio/_scprintf.c:32:20: warning: ‘init_scprintf’ used but never defined > > static int __cdecl init_scprintf(const char * __restrict__ format, ...); > > `static` can be removed as it has no effect. The linkage is specified in > assembly. For GNU as, symbols are internal by default, and external if > declared in `.globl`.
After removing 'static', gcc does not show any warning anymore. I compared assembly output from gcc -S and also objdump --all -dr -s output, but I'm not sure if it is the correct change. In gcc -S output the only difference is that after removing "static" keyboard, the assembly output contains this additional line: .def _init_scprintf; .scl 2; .type 32; .endef The whole assembly file after removing "static" looks like: .text /APP .def _init_scprintf; .scl 3; .type 32; .endef _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? objdump on object files show these differences: SYMBOL TABLE: [ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 _scprintf.c File -[ 2](sec 1)(fl 0x00)(ty 20)(scl 3) (nx 1) 0x00000000 _init_scprintf +[ 2](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 1) 0x00000007 __scprintf AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0 -[ 4](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000007 __scprintf -[ 5](sec 1)(fl 0x00)(ty 20)(scl 3) (nx 0) 0x00000010 _emu_scprintf -[ 6](sec 1)(fl 0x00)(ty 20)(scl 3) (nx 0) 0x00000030 _resolve_scprintf +[ 4](sec 1)(fl 0x00)(ty 20)(scl 3) (nx 0) 0x00000010 _emu_scprintf +[ 5](sec 1)(fl 0x00)(ty 20)(scl 3) (nx 0) 0x00000030 _resolve_scprintf +[ 6](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 _init_scprintf [ 7](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text AUX scnlen 0x7e nreloc 9 nlnno 0 [ 9](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public