Página 1 de 1

GCC - Comandos ejecutados

Publicado: Sab May 22, 2021 1:21 pm
por Baxajaun
Buenos días !!!

Teniendo el siguiente programa C, hello.c

Código: Seleccionar todo

#include <stdio.h>

int main()
{
    printf("Hola mundo!\n");
    return 0;
}
Y el siguiente fichero do.bat para la construcción del ejecutable hello.exe

Código: Seleccionar todo

@set PATH=F:\Develop\CCompilers\WinLibs\V11\32bits\mingw32\bin;F:\Develop\CCompilers\WinLibs\V11\32bits\mingw32\include;F:\Develop\CCompilers\WinLibs\V11\32bits\mingw32\i686-w64-mingw32\include;F:\Develop\CCompilers\WinLibs\V11\32bits\mingw32\lib;F:\Develop\CCompilers\WinLibs\V11\32bits\mingw32\i686-w64-mingw32\lib

gcc -o %1 %1.c -### 
Al poner al final de la línea -### nos mostrará las opciones y los programas que ejecutará para obtener el ejecutable

Código: Seleccionar todo

F:\Develop\Curso_de_C_Manu_Exposito>gcc -o hello hello.c -###
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libe
xec/gcc/i686-w64-mingw32/11.1.0/lto-wrapper.exe
OFFLOAD_TARGET_NAMES=nvptx-none
Target: i686-w64-mingw32
Configured with: ../configure --prefix=/R/winlibs32_stage/inst_gcc-11.1.0/share/
gcc --build=i686-w64-mingw32 --host=i686-w64-mingw32 --enable-offload-targets=nv
ptx-none --with-pkgversion='MinGW-W64 i686-posix-dwarf, built by Brecht Sanders'
 --with-tune=generic --enable-checking=release --enable-threads=posix --with-dwa
rf2 --disable-sjlj-exceptions --disable-libunwind-exceptions --disable-serial-co
nfigure --disable-bootstrap --enable-host-shared --enable-plugin --disable-defau
lt-ssp --disable-rpath --enable-libstdcxx-pch --enable-libstdcxx-time=yes --disa
ble-libstdcxx-debug --disable-version-specific-runtime-libs --with-stabs --disab
le-symvers --enable-languages=c,c++,fortran,lto,objc,obj-c++,d,jit --disable-gol
d --disable-nls --disable-stage1-checking --disable-win32-registry --disable-mul
tilib --enable-ld --enable-libquadmath --enable-libada --enable-libssp --enable-
libstdcxx --enable-lto --enable-fully-dynamic-string --enable-libgomp --enable-g
raphite --enable-mingw-wildcard --with-mpc=/d/Prog/winlibs32_stage/custombuilt -
-with-mpfr=/d/Prog/winlibs32_stage/custombuilt --with-gmp=/d/Prog/winlibs32_stag
e/custombuilt --with-isl=/d/Prog/winlibs32_stage/custombuilt --enable-install-li
biberty --enable-__cxa_atexit --without-included-gettext --with-diagnostics-colo
r=auto --enable-clocale=generic --with-libiconv --with-system-zlib --with-build-
sysroot=/R/winlibs32_stage/gcc-11.1.0/build_mingw/mingw-w64 --enable-large-addre
ss-aware CFLAGS=-I/d/Prog/winlibs32_stage/custombuilt/include/libdl-win32
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (MinGW-W64 i686-posix-dwarf, built by Brecht Sanders)
COLLECT_GCC_OPTIONS='-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro'
 "f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gcc/i686-w64-m
ingw32/11.1.0/cc1.exe" -quiet -iprefix "f:\\develop\\ccompilers\\winlibs\\v11\\3
2bits\\mingw32\\bin\\../lib/gcc/i686-w64-mingw32/11.1.0/" -D_REENTRANT hello.c -
quiet -dumpbase hello.c -dumpbase-ext .c "-mtune=generic" "-march=pentiumpro" -o
 "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\ccoZ3Jye.s"
COLLECT_GCC_OPTIONS='-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro'
 "f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw
32/11.1.0/../../../../i686-w64-mingw32/bin/as.exe" -o "C:\\Users\\ADMINI~1\\AppD
ata\\Local\\Temp\\ccqOW3Dk.o" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\ccoZ3J
ye.s"
COMPILER_PATH=f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gc
c/i686-w64-mingw32/11.1.0/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/
../libexec/gcc/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/
i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/bin/
LIBRARY_PATH=f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i68
6-w64-mingw32/11.1.0/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../li
b/gcc/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-
mingw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib/;f:/develop/ccompilers/wi
nlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../lib/
;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw3
2/11.1.0/../../../../i686-w64-mingw32/lib/;f:/develop/ccompilers/winlibs/v11/32b
its/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../
COLLECT_GCC_OPTIONS='-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro' '-dump
dir' 'hello.'
 "f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gcc/i686-w64-m
ingw32/11.1.0/collect2.exe" -plugin "f:/develop/ccompilers/winlibs/v11/32bits/mi
ngw32/bin/../libexec/gcc/i686-w64-mingw32/11.1.0/liblto_plugin.dll" "-plugin-opt
=f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gcc/i686-w64-mi
ngw32/11.1.0/lto-wrapper.exe" "-plugin-opt=-fresolution=C:\\Users\\ADMINI~1\\App
Data\\Local\\Temp\\ccNrGe4t.res" "-plugin-opt=-pass-through=-lmingw32" "-plugin-
opt=-pass-through=-lgcc" "-plugin-opt=-pass-through=-lgcc_eh" "-plugin-opt=-pass
-through=-lmoldname" "-plugin-opt=-pass-through=-lmingwex" "-plugin-opt=-pass-th
rough=-lmsvcrt" "-plugin-opt=-pass-through=-lkernel32" "-plugin-opt=-pass-throug
h=-lpthread" "-plugin-opt=-pass-through=-ladvapi32" "-plugin-opt=-pass-through=-
lshell32" "-plugin-opt=-pass-through=-luser32" "-plugin-opt=-pass-through=-lkern
el32" "-plugin-opt=-pass-through=-lmingw32" "-plugin-opt=-pass-through=-lgcc" "-
plugin-opt=-pass-through=-lgcc_eh" "-plugin-opt=-pass-through=-lmoldname" "-plug
in-opt=-pass-through=-lmingwex" "-plugin-opt=-pass-through=-lmsvcrt" "-plugin-op
t=-pass-through=-lkernel32" -m i386pe -Bdynamic --large-address-aware -o hello.e
xe "f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-min
gw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib/crt2.o" "f:/develop/ccompile
rs/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/crtbegin.o"
 "-Lf:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-min
gw32/11.1.0" "-Lf:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc"
 "-Lf:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-min
gw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib" "-Lf:/develop/ccompilers/wi
nlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../lib"
 "-Lf:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-min
gw32/11.1.0/../../../../i686-w64-mingw32/lib" "-Lf:/develop/ccompilers/winlibs/v
11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../.." "C:\\Users\\A
DMINI~1\\AppData\\Local\\Temp\\ccqOW3Dk.o" -lmingw32 -lgcc -lgcc_eh -lmoldname -
lmingwex -lmsvcrt -lkernel32 -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32
-lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lkernel32 "f:/develop/cc
ompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/crten
d.o"
COLLECT_GCC_OPTIONS='-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro' '-dump
dir' 'hello.'
En el bloque anterior se pueden apreciar los ejecutables que lanza el comando gcc -o hello hello.c.

Estos son: cc1.exe, as.exe, collect2.exe y lto-wrapper.exe.

Saludos,

Re: GCC - Comandos ejecutados

Publicado: Sab May 22, 2021 1:44 pm
por Baxajaun
Con la opción -v ( gcc -v -o %1 %1.c ) conseguimos algo parecido, nos muestra el paso a paso:

Código: Seleccionar todo

F:\Develop\Curso_de_C_Manu_Exposito>gcc -v -o hello hello.c
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libe
xec/gcc/i686-w64-mingw32/11.1.0/lto-wrapper.exe
OFFLOAD_TARGET_NAMES=nvptx-none
Target: i686-w64-mingw32
Configured with: ../configure --prefix=/R/winlibs32_stage/inst_gcc-11.1.0/share/
gcc --build=i686-w64-mingw32 --host=i686-w64-mingw32 --enable-offload-targets=nv
ptx-none --with-pkgversion='MinGW-W64 i686-posix-dwarf, built by Brecht Sanders'
 --with-tune=generic --enable-checking=release --enable-threads=posix --with-dwa
rf2 --disable-sjlj-exceptions --disable-libunwind-exceptions --disable-serial-co
nfigure --disable-bootstrap --enable-host-shared --enable-plugin --disable-defau
lt-ssp --disable-rpath --enable-libstdcxx-pch --enable-libstdcxx-time=yes --disa
ble-libstdcxx-debug --disable-version-specific-runtime-libs --with-stabs --disab
le-symvers --enable-languages=c,c++,fortran,lto,objc,obj-c++,d,jit --disable-gol
d --disable-nls --disable-stage1-checking --disable-win32-registry --disable-mul
tilib --enable-ld --enable-libquadmath --enable-libada --enable-libssp --enable-
libstdcxx --enable-lto --enable-fully-dynamic-string --enable-libgomp --enable-g
raphite --enable-mingw-wildcard --with-mpc=/d/Prog/winlibs32_stage/custombuilt -
-with-mpfr=/d/Prog/winlibs32_stage/custombuilt --with-gmp=/d/Prog/winlibs32_stag
e/custombuilt --with-isl=/d/Prog/winlibs32_stage/custombuilt --enable-install-li
biberty --enable-__cxa_atexit --without-included-gettext --with-diagnostics-colo
r=auto --enable-clocale=generic --with-libiconv --with-system-zlib --with-build-
sysroot=/R/winlibs32_stage/gcc-11.1.0/build_mingw/mingw-w64 --enable-large-addre
ss-aware CFLAGS=-I/d/Prog/winlibs32_stage/custombuilt/include/libdl-win32
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (MinGW-W64 i686-posix-dwarf, built by Brecht Sanders)
COLLECT_GCC_OPTIONS='-v' '-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro'
 f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gcc/i686-w64-mi
ngw32/11.1.0/cc1.exe -quiet -v -iprefix f:\develop\ccompilers\winlibs\v11\32bits
\mingw32\bin\../lib/gcc/i686-w64-mingw32/11.1.0/ -D_REENTRANT hello.c -quiet -du
mpbase hello.c -dumpbase-ext .c -mtune=generic -march=pentiumpro -version -o C:\
Users\ADMINI~1\AppData\Local\Temp\ccSu0sqZ.s
GNU C17 (MinGW-W64 i686-posix-dwarf, built by Brecht Sanders) version 11.1.0 (i6
86-w64-mingw32)
        compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version 4.1.0,
 MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "f:/develop/ccompilers/winlibs/v11/32bits/mingw32/l
ib/gcc/../../lib/gcc/i686-w64-mingw32/11.1.0/include"
ignoring nonexistent directory "R:/winlibs32_stage/inst_gcc-11.1.0/share/gcc/inc
lude"
ignoring nonexistent directory "/R/winlibs32_stage/inst_gcc-11.1.0/share/gcc/inc
lude"
ignoring duplicate directory "f:/develop/ccompilers/winlibs/v11/32bits/mingw32/l
ib/gcc/../../lib/gcc/i686-w64-mingw32/11.1.0/include-fixed"
ignoring duplicate directory "f:/develop/ccompilers/winlibs/v11/32bits/mingw32/l
ib/gcc/../../lib/gcc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/includ
e"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 f:\develop\ccompilers\winlibs\v11\32bits\mingw32\bin\../lib/gcc/i686-w64-mingw3
2/11.1.0/include
 f:\develop\ccompilers\winlibs\v11\32bits\mingw32\bin\../lib/gcc/i686-w64-mingw3
2/11.1.0/../../../../include
 f:\develop\ccompilers\winlibs\v11\32bits\mingw32\bin\../lib/gcc/i686-w64-mingw3
2/11.1.0/include-fixed
 f:\develop\ccompilers\winlibs\v11\32bits\mingw32\bin\../lib/gcc/i686-w64-mingw3
2/11.1.0/../../../../i686-w64-mingw32/include
End of search list.
GNU C17 (MinGW-W64 i686-posix-dwarf, built by Brecht Sanders) version 11.1.0 (i6
86-w64-mingw32)
        compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version 4.1.0,
 MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 07fa033dd204e54c9ac995d21ee111ae
COLLECT_GCC_OPTIONS='-v' '-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro'
 f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw3
2/11.1.0/../../../../i686-w64-mingw32/bin/as.exe -v -o C:\Users\ADMINI~1\AppData
\Local\Temp\ccXsduRb.o C:\Users\ADMINI~1\AppData\Local\Temp\ccSu0sqZ.s
GNU assembler version 2.36.1 (i686-w64-mingw32) using BFD version (Binutils for
MinGW-W64 i686, built by Brecht Sanders) 2.36.1
COMPILER_PATH=f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gc
c/i686-w64-mingw32/11.1.0/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/
../libexec/gcc/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/
i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/bin/
LIBRARY_PATH=f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i68
6-w64-mingw32/11.1.0/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../li
b/gcc/;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-
mingw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib/;f:/develop/ccompilers/wi
nlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../lib/
;f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw3
2/11.1.0/../../../../i686-w64-mingw32/lib/;f:/develop/ccompilers/winlibs/v11/32b
its/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../
COLLECT_GCC_OPTIONS='-v' '-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro' '
-dumpdir' 'hello.'
 f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gcc/i686-w64-mi
ngw32/11.1.0/collect2.exe -plugin f:/develop/ccompilers/winlibs/v11/32bits/mingw
32/bin/../libexec/gcc/i686-w64-mingw32/11.1.0/liblto_plugin.dll -plugin-opt=f:/d
evelop/ccompilers/winlibs/v11/32bits/mingw32/bin/../libexec/gcc/i686-w64-mingw32
/11.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\ADMINI~1\AppData\Local
\Temp\ccEELJLE.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through
=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -
plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-op
t=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass
-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-throug
h=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lming
w32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-o
pt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pas
s-through=-lmsvcrt -plugin-opt=-pass-through=-lkernel32 -m i386pe -Bdynamic --la
rge-address-aware -o hello.exe f:/develop/ccompilers/winlibs/v11/32bits/mingw32/
bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib/c
rt2.o f:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-m
ingw32/11.1.0/crtbegin.o -Lf:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/
../lib/gcc/i686-w64-mingw32/11.1.0 -Lf:/develop/ccompilers/winlibs/v11/32bits/mi
ngw32/bin/../lib/gcc -Lf:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../l
ib/gcc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/lib/../lib -Lf:/deve
lop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0
/../../../../lib -Lf:/develop/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/g
cc/i686-w64-mingw32/11.1.0/../../../../i686-w64-mingw32/lib -Lf:/develop/ccompil
ers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/../../.. C
:\Users\ADMINI~1\AppData\Local\Temp\ccXsduRb.o -lmingw32 -lgcc -lgcc_eh -lmoldna
me -lmingwex -lmsvcrt -lkernel32 -lpthread -ladvapi32 -lshell32 -luser32 -lkerne
l32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lkernel32 f:/develop
/ccompilers/winlibs/v11/32bits/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.1.0/cr
tend.o
COLLECT_GCC_OPTIONS='-v' '-o' 'hello.exe' '-mtune=generic' '-march=pentiumpro' '
-dumpdir' 'hello.'
Saludos,

Re: GCC - Comandos ejecutados

Publicado: Sab May 22, 2021 2:14 pm
por Cristobal
Félix, gracias, da gusto poder contar con personas como tú
Un abrazo