qmake ABI detection fix for NetBSD and OpenBSD

The ABI dection works on inspecting the ELF header which should contain
the values for ELFOSABI, with the macro ELFOSABI_NETBSD equals 2 and
ELFOSABI_OPENBSD equals 12. However, on these systems the ELF binaries
are built using 0 so detection will fail and default to Linux, preventing
to use the correct qmake for Desktop Qt. Therefore, on these systems default 0
to use the host OS (NetBSD or OpenBSD), otherwise Linux as before.

Change-Id: I293389980860977ba6c2ad9903edd567f0a5b9f0
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Ralf Nolden
2016-06-13 22:31:17 +02:00
parent 47b4f2c738
commit 9b4c91cacc

View File

@@ -199,12 +199,20 @@ static QList<Abi> abiOf(const QByteArray &data)
Abi::OSFlavor flavor = Abi::GenericUnixFlavor;
// http://www.sco.com/developers/gabi/latest/ch4.eheader.html#elfid
switch (osAbi) {
case 2: // NetBSD:
#if defined(Q_OS_NETBSD)
case 0: // NetBSD: ELFOSABI_NETBSD 2, however, NetBSD uses 0
os = Abi::BsdOS;
flavor = Abi::NetBsdFlavor;
break;
case 3: // Linux:
#elif defined(Q_OS_OPENBSD)
case 0: // OpenBSD: ELFOSABI_OPENBSD 12, however, OpenBSD uses 0
os = Abi::BsdOS;
flavor = Abi::OpenBsdFlavor;
break;
#else
case 0: // no extra info available: Default to Linux:
#endif
case 3: // Linux:
case 97: // ARM, also linux most of the time.
os = Abi::LinuxOS;
flavor = Abi::GenericLinuxFlavor;
@@ -217,9 +225,6 @@ static QList<Abi> abiOf(const QByteArray &data)
os = Abi::BsdOS;
flavor = Abi::FreeBsdFlavor;
break;
case 12: // OpenBSD:
os = Abi::BsdOS;
flavor = Abi::OpenBsdFlavor;
}
switch (machine) {