Swift 4.1 s390x build issue - .bootstrap/bin/swift-build stage crashes (return code 4)

Folks,

I am trying to (debug) build Swift 4.1 compiler on s390x (zLinux) platform but package manager build stage crashes.

I think I have narrowed it down to CFBasicHash.c code and core dump points to CFBasicHash.c:1122. Seems like CFBasicHashAllocateMemory returns null. Not sure why that would happen as I have ample resources on my system. Wonder if I need to specify something else on my build script. Here is how it is currently being invoked:

/home/swift/swift4.1/swift4.1/swift# ./utils/build-script -j 1 -d --lldb --foundation --xctest --llbuild --swiftpm --libdispatch -- --verbose-build=1 --install-swift --install-foundation --install-xctest --install-llbuild --install-swiftpm --install-libdispatch --install-lldb --swift-install-components='autolink-driver;compiler;clang-builtin-headers;stdlib;sdk-overlay;license' --build-swift-static-stdlib=1 --install-prefix=/usr --install-destdir=/opt/swift4.1/

Here is the stack trace.

Stack Trace:
/==================================/
Program received signal SIGTRAP, Trace/breakpoint trap.
0x000003fffcb4e336 in __CFBasicHashRehash (ht=0x2aa004e74b0, newItemCount=40)
at CoreFoundation/Collections.subproj/CFBasicHash.c:1122
1122 if (!new_values) HALT;
(gdb) bt
#0 0x000003fffcb4e336 in __CFBasicHashRehash (ht=0x2aa004e74b0, newItemCount=40)
at CoreFoundation/Collections.subproj/CFBasicHash.c:1122
#1 0x000003fffcb4e0ac in CFBasicHashSetCapacity (ht=0x2aa004e74b0, capacity=40)
at CoreFoundation/Collections.subproj/CFBasicHash.c:1221
#2 0x000003fffcb38e92 in __CFInitialize () at CoreFoundation/Base.subproj/CFRuntime.c:1139
#3 0x000003fffdf90cb2 in ?? () from /lib/ld64.so.1
#4 0x000003fffdf90dc0 in ?? () from /lib/ld64.so.1
#5 0x000003fffdf80f0c in ?? () from /lib/ld64.so.1

/==================================/

Any pointers greatly appreciated.

Thanks.

@millenomi, @Philippe_Hausler, any ideas?

(@rishi, for future reference a better category would be Development > Core Libraries or Development > Package Manager next time, since that's where the failure is happening.)

This feels like a CFRuntime base misstep in the #ifdefs or perhaps the retain count changes. My guess is that this is the first CF object allocation

@Philippe_Hausler - Thanks - yes, this is the first CF object allocation. Seems like __CFBasicHashAllocateMemory is not happening. I'll compare the code with 4.0 where this did not happen. Any ideas where to look for retain count changes?