Use cyclic linker options just for gcc-based compilers

This commit is contained in:
Ivan Kravets
2015-08-01 17:39:15 +03:00
parent 86e39f9b44
commit 203026a57b
3 changed files with 19 additions and 2 deletions

View File

@ -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"

View File

@ -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

View File

@ -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 "
)