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 references to `__gthr_win32_*` shared libgcc is built #21

Closed Blackhex closed 1 month ago

Blackhex commented 2 months ago

This PR changes order of ${tmake_eh_file} and ${tmake_thr_file} files in thee target config as the i386/t-seh-eh overrides LIB2ADDEH variable while mingw/t-gthr-win32 ads to it. Also it adds i386/t-slibgcc-mingw which includes __gthr_win32_create/join into shared libgcc exports. This fixes:

aarch64-w64-mingw32/bin/ld: ../src/c++11/.libs/libc++11convenience.a(thread.o):(.rdata$.refptr.__gthr_win32_create[.refptr.__gthr_win32_create]+0x0): undefined reference to `__gthr_win32_create'
aarch64-w64-mingw32/bin/ld: ../src/c++11/.libs/libc++11convenience.a(thread.o):(.rdata$.refptr.__gthr_win32_join[.refptr.__gthr_win32_join]+0x0): undefined reference to `__gthr_win32_join'

when building GCC with shared libgcc enabled. 

This fix is needed both for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115083 repro case and build of MinGW toolchain MSYS2 packages.

Tested by https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/actions/runs/9645452811 and https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/9647377371

Blackhex commented 2 months ago

Discussed this with GCC developers. It a good path but not enough solution. Will add additional changes.

Blackhex commented 2 months ago

Updated and ready for review.