Merge pull request #35444 from RandomShaper/fix_link_bsd

Fix error with linkers other than GNU ld
This commit is contained in:
Rémi Verschelde 2020-01-23 07:57:02 +01:00 committed by GitHub
commit 05fc26de1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -333,11 +333,15 @@ def configure(env):
if not env['tools']:
import subprocess
import re
binutils_version = re.search('\s(\d+\.\d+)', str(subprocess.check_output(['ld', '-v']))).group(1)
if float(binutils_version) >= 2.30:
env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.ld'])
linker_version_str = subprocess.check_output([env.subst(env["LINK"]), '-Wl,--version']).decode("utf-8")
gnu_ld_version = re.search('^GNU ld [^$]*(\d+\.\d+)$', linker_version_str, re.MULTILINE)
if not gnu_ld_version:
print("Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld")
else:
env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.legacy.ld'])
if float(gnu_ld_version.group(1)) >= 2.30:
env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.ld'])
else:
env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.legacy.ld'])
## Cross-compilation