forked from platformio/platformio-core
Use cyclic linker options just for gcc-based compilers
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
VERSION = (2, 2, 2)
|
||||
VERSION = (2, 3, "0.dev0")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -7,6 +7,8 @@ from glob import glob
|
||||
from os import remove
|
||||
from os.path import basename, join
|
||||
|
||||
from platformio.util import exec_command
|
||||
|
||||
|
||||
class InoToCPPConverter(object):
|
||||
|
||||
@ -157,6 +159,20 @@ def DumpIDEData(env):
|
||||
return data
|
||||
|
||||
|
||||
def getCompilerType(env):
|
||||
try:
|
||||
result = exec_command([env.subst("$CC"), "-v"], env=env['ENV'])
|
||||
except OSError:
|
||||
return None
|
||||
if result['returncode'] != 0:
|
||||
return None
|
||||
output = "".join([result['out'], result['err']]).lower()
|
||||
for type_ in ("clang", "gcc"):
|
||||
if type_ in output:
|
||||
return type_
|
||||
return None
|
||||
|
||||
|
||||
def exists(_):
|
||||
return True
|
||||
|
||||
@ -164,4 +180,5 @@ def exists(_):
|
||||
def generate(env):
|
||||
env.AddMethod(ConvertInoToCpp)
|
||||
env.AddMethod(DumpIDEData)
|
||||
env.AddMethod(getCompilerType)
|
||||
return env
|
||||
|
@ -43,7 +43,7 @@ def BuildFirmware(env):
|
||||
)
|
||||
|
||||
# enable "cyclic reference" for linker
|
||||
if env.get("LIBS", deplibs):
|
||||
if env.get("LIBS", deplibs) and env.getCompilerType() == "gcc":
|
||||
env.Prepend(
|
||||
_LIBFLAGS="-Wl,--start-group "
|
||||
)
|
||||
|
Reference in New Issue
Block a user