mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
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>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
VERSION = (2, 2, 2)
|
VERSION = (2, 3, "0.dev0")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -7,6 +7,8 @@ from glob import glob
|
|||||||
from os import remove
|
from os import remove
|
||||||
from os.path import basename, join
|
from os.path import basename, join
|
||||||
|
|
||||||
|
from platformio.util import exec_command
|
||||||
|
|
||||||
|
|
||||||
class InoToCPPConverter(object):
|
class InoToCPPConverter(object):
|
||||||
|
|
||||||
@ -157,6 +159,20 @@ def DumpIDEData(env):
|
|||||||
return data
|
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(_):
|
def exists(_):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -164,4 +180,5 @@ def exists(_):
|
|||||||
def generate(env):
|
def generate(env):
|
||||||
env.AddMethod(ConvertInoToCpp)
|
env.AddMethod(ConvertInoToCpp)
|
||||||
env.AddMethod(DumpIDEData)
|
env.AddMethod(DumpIDEData)
|
||||||
|
env.AddMethod(getCompilerType)
|
||||||
return env
|
return env
|
||||||
|
@ -43,7 +43,7 @@ def BuildFirmware(env):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# enable "cyclic reference" for linker
|
# enable "cyclic reference" for linker
|
||||||
if env.get("LIBS", deplibs):
|
if env.get("LIBS", deplibs) and env.getCompilerType() == "gcc":
|
||||||
env.Prepend(
|
env.Prepend(
|
||||||
_LIBFLAGS="-Wl,--start-group "
|
_LIBFLAGS="-Wl,--start-group "
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user