Windows-on-ARM-Experiments / gcc-woarm64

Fork of gcc containing fixes for Windows on ARM64.
GNU General Public License v2.0
8 stars 1 forks source link

Fix undefined reference to mingw #10

Closed eukarpov closed 9 months ago

eukarpov commented 9 months ago
/home/user/cross/bin/aarch64-w64-mingw32-gcc -O2 -DMS_ABI -DMAX_STACK_ALLOC=2048 -Wall -DF_INTERFACE_GFORT -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=20 -DMAX_PARALLEL_NUMBER=1 -DBUILD_SINGLE=1 -DBUILD_DOUBLE=1 -DBUILD_COMPLEX=1 -DBUILD_COMPLEX16=1 -DVERSION=\"0.3.25.dev\" -march=armv8-a -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME=\"_\" -DCHAR_CNAME=\"\" -DNO_AFFINITY -I..  libopenblas.def dllinit.obj \
-shared -o ../libopenblas.dll -Wl,--out-implib,../libopenblas.dll.a \
-Wl,--whole-archive ../libopenblas_armv8p-r0.3.25.dev.a -Wl,--no-whole-archive  -defaultlib:advapi32 -lgfortran -defaultlib:advapi32 -lgfortran
/home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/../../../../aarch64-w64-mingw32/bin/ld: /home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/libgfortran.a(error.o):(.rdata$.refptr.__gthr_win32_self[.refptr.__gthr_win32_self]+0x0): undefined reference to `__gthr_win32_self'
/home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/../../../../aarch64-w64-mingw32/bin/ld: /home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/libgfortran.a(async.o):(.rdata$.refptr.__gthr_win32_join[.refptr.__gthr_win32_join]+0x0): undefined reference to `__gthr_win32_join'
/home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/../../../../aarch64-w64-mingw32/bin/ld: /home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/libgfortran.a(async.o):(.rdata$.refptr.__gthr_win32_create[.refptr.__gthr_win32_create]+0x0): undefined reference to `__gthr_win32_create'
/home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/../../../../aarch64-w64-mingw32/bin/ld: /home/user/cross/lib/gcc/aarch64-w64-mingw32/14.0.0/libgfortran.a(read.o):(.rdata$.refptr.__strtold[.refptr.__strtold]+0x0): undefined reference to `__strtold'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:124: ../libopenblas.dll] Error 1
make[1]: Leaving directory '/home/user/workspace/OpenBLAS/exports'
make: *** [Makefile:150: shared] Error 2
eukarpov commented 9 months ago

Since this comment clearly says that the __strtold / __strtod / __strtof implementations are relavant to 10 byte long doubles and since aarch64-w64-mingw32 is using 16byte long doubles (at least for now), I am willing to accept any change that efectively sets:

#define gfc_strtof strtof
#define gfc_strtod strtod
#define gfc_strtold strtold

and that hides / do not use __strtold / __strtod / __strtof.

Is the current state of the PR final in that sense?

strtof and strtod should not be impacted as they use float and double what I understood that the nature of change has been related to long double

extern float __strtof (const char *, char **);
#define gfc_strtof __strtof
extern double __strtod (const char *, char **);
#define gfc_strtod __strtod

I would prefer to keep changes under mingw condition as they are related to it. wdyt?

Blackhex commented 9 months ago

strtof and strtod should not be impacted as they use float and double what I understood that the nature of change has been related to long double

That's true, sorry for the confusion.

I am fine with any change that hides (stops using) __strtold for aarch64-w64-mingw32.

eukarpov commented 9 months ago

CI checks https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build-2/actions/runs/7021756729 https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build-2/actions/runs/7021758188