From 8a2699acd0c8b157e46cbdbb6e48a4f0442df9d8 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 3 Apr 2017 21:54:25 +0100 Subject: [PATCH] Fix test cases/common/135 on Cygwin I don't really know how to explain this briefly... If you don't decorate this with dllimport, then a Cygwin runtime relocation is used (a so called 'pseudo-reloc'). As the relocation offset is only 32 bits, this can fail on x86_64 if the DLL happens to be loaded more than 2GB away from the reference. If you decorate with dllimport, then access is indirected via a pointer, imp_square_unsigned, which is fixed up by the loader. --- test cases/common/135 generated assembly/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test cases/common/135 generated assembly/main.c b/test cases/common/135 generated assembly/main.c index 97fe723e3..b669cba27 100644 --- a/test cases/common/135 generated assembly/main.c +++ b/test cases/common/135 generated assembly/main.c @@ -1,5 +1,8 @@ #include +#if defined(_WIN32) || defined(__CYGWIN__) + __declspec(dllimport) +#endif unsigned square_unsigned (unsigned a); int