forked from qt-creator/qt-creator
WebAssembly: Fix Qt 5.15 for WebAssemby ABI detection
The Qt 5.15 for WebAssembly binaries published via the Qt SDK installer have a different binary format. Like in previous versions, the static libraries are in the "ar" format. However, the packaged .obj files, from Qt 5.15 on, have the '∖0asm' magic number. Fixes: QTCREATORBUG-24891 Change-Id: Idc6004dfc0949280a1d5f257c462d094fa51f5a6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -413,9 +413,13 @@ static Abis abiOf(const QByteArray &data)
|
||||
result.append(macAbiForCpu(type));
|
||||
pos += 20;
|
||||
}
|
||||
} else if (getUint8(data, 0) == 'B' && getUint8(data, 1) == 'C'
|
||||
&& getUint8(data, 2) == 0xc0 && getUint8(data, 3) == 0xde) {
|
||||
// https://llvm.org/docs/BitCodeFormat.html#llvm-ir-magic-number
|
||||
} else if (// Qt 5.15+ https://webassembly.github.io/spec/core/binary/modules.html#binary-module
|
||||
(getUint8(data, 0) == 0 && getUint8(data, 1) == 'a'
|
||||
&& getUint8(data, 2) == 's' && getUint8(data, 3) == 'm')
|
||||
|
||||
// Qt < 5.15 https://llvm.org/docs/BitCodeFormat.html#llvm-ir-magic-number
|
||||
|| (getUint8(data, 0) == 'B' && getUint8(data, 1) == 'C'
|
||||
&& getUint8(data, 2) == 0xc0 && getUint8(data, 3) == 0xde)) {
|
||||
result.append(Abi(Abi::AsmJsArchitecture, Abi::UnknownOS, Abi::UnknownFlavor,
|
||||
Abi::EmscriptenFormat, 32));
|
||||
} else if (data.size() >= 64){
|
||||
@@ -1319,9 +1323,12 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary_data()
|
||||
QTest::newRow("static QtCore: linux 64bit")
|
||||
<< QString::fromLatin1("%1/static/linux-64bit-release.a").arg(prefix)
|
||||
<< (QStringList() << QString::fromLatin1("x86-linux-generic-elf-64bit"));
|
||||
QTest::newRow("static QtCore: asmjs emscripten 32bit")
|
||||
QTest::newRow("static QtCore: asmjs emscripten 32bit (Qt < 5.15)")
|
||||
<< QString::fromLatin1("%1/static/asmjs-emscripten.a").arg(prefix)
|
||||
<< (QStringList() << QString::fromLatin1("asmjs-unknown-unknown-emscripten-32bit"));
|
||||
QTest::newRow("static QtCore: asmjs emscripten 32bit (Qt >= 5.15)")
|
||||
<< QString::fromLatin1("%1/static/asmjs-emscripten-5.15.a").arg(prefix)
|
||||
<< (QStringList() << QString::fromLatin1("asmjs-unknown-unknown-emscripten-32bit"));
|
||||
|
||||
QTest::newRow("static stdc++: mac fat")
|
||||
<< QString::fromLatin1("%1/static/mac-fat.a").arg(prefix)
|
||||
|
Reference in New Issue
Block a user