On Apr 20 18:49, Corinna Vinschen wrote: > On Apr 20 11:24, Bob Heckel wrote: > > I'm having trouble packaging 64-bit gc-7.2d "libgc" (upon which w3m > > depends). There are extensive 32-bit Cygwin adaptations to the upstream > > libgc code. After much trial and error it seems I lack the experience in > > Windows memory internals required to build a 64-bit port. > > > > I'll continue trying but in the interest of speed, at this point I would > > gladly turn over this 64-bit package to any volunteer. > > I skimmed through the os_dep.c file and at first glance I only see > one problem: > > # else /* CYGWIN32 */ > /* An alternate version for Cygwin (adapted from Dave Korn's */ > /* gcc version of boehm-gc). */ > GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb) > { > extern void * _tlsbase __asm__ ("%fs:4"); > sb -> mem_base = _tlsbase; > return GC_SUCCESS; > } > # endif /* CYGWIN32 */ > [...] > suggest to change the above code to this target-independent expression: > > extern void * _tlsbase = NtCurrentTeb()->Tib.StackBase; > > If you have more strange problems, feel free to explain them here.
I just found two more. include/gc.h uses __CYGWIN32__: #ifdef __CYGWIN32__ /* Similarly gnu-win32 DLLs need explicit initialization from the */ /* main program, as does AIX. */ extern int _data_start__[], _data_end__[], _bss_start__[], _bss_end__[]; # define GC_DATASTART (_data_start__ < _bss_start__ ? \ (void *)_data_start__ : (void *)_bss_start__) # define GC_DATAEND (_data_end__ > _bss_end__ ? \ (void *)_data_end__ : (void *)_bss_end__) # define GC_INIT_CONF_ROOTS GC_add_roots(GC_DATASTART, GC_DATAEND); \ GC_gcollect() /* For blacklisting. */ /* Required at least if GC is in a DLL. And doesn't hurt. */ #elif defined(_AIX) __CYGWIN32__ is extremly outdated, only kept for backward compatibility on i686, and it's not defined anymore for 64 bit. Always use __CYGWIN__ instead. However, the code in include/gc.h guarded by __CYGWIN32__ wouldn't work on 64 bit anyway. All symbols need an additional underscore when building on 64 bit Cygwin, due to the fact that under x86_64, symbols are not prepended with an underscore, as on i686. So the code should be changed to something along the lines of #ifdef __CYGWIN__ /* Similarly gnu-win32 DLLs need explicit initialization from the */ /* main program, as does AIX. */ #ifdef __x86_64__ # define GC_DATASTART (__data_start__ < __bss_start__ ? \ (void *)__data_start__ : (void *)__bss_start__) # define GC_DATAEND (__data_end__ > __bss_end__ ? \ (void *)__data_end__ : (void *)__bss_end__) #else # define GC_DATASTART (_data_start__ < _bss_start__ ? \ (void *)_data_start__ : (void *)_bss_start__) # define GC_DATAEND (_data_end__ > _bss_end__ ? \ (void *)_data_end__ : (void *)_bss_end__) #endif # define GC_INIT_CONF_ROOTS GC_add_roots(GC_DATASTART, GC_DATAEND); \ GC_gcollect() /* For blacklisting. */ /* Required at least if GC is in a DLL. And doesn't hurt. */ #elif defined(_AIX) Also, there's this block in include/private/gcconfig.h: # if defined(__CYGWIN32__) || defined(__CYGWIN__) # define I386 # define CYGWIN32 # define mach_type_known # endif This needs extending to handle the new CPU type: # if defined(__CYGWIN__) # if defined(__LP64__) # define X86_64 # else # define I386 # endif # define CYGWIN32 # define mach_type_known # endif And ask upstream if it's really necessary... # ifdef CYGWIN32 # define OS_TYPE "CYGWIN32" ... to call the OS "CYGWIN32", despite the fact that it's not called Cygwin32 but Cygwin since 1998 (15 years!). "CYGWIN" would make more sense. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat