diff --git a/HISTORY.rst b/HISTORY.rst index 864ef433b0..3fded02680 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,6 +18,7 @@ PlatformIO Core 4.0 * Warn about broken library manifest when scanning dependencies (`issue #3268 `_) * Fixed an issue with the broken latest news for PIO Home * Fixed an issue when ``env.BoardConfig()`` does not work for custom boards in extra scripts of libraries (`issue #3264 `_) +* Fixed an issue with "start-group/end-group" linker flags on Native development platform (`issue #3282 `_) 4.1.0 (2019-11-07) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 82b81a0f9d..5d8222f63e 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -59,6 +59,15 @@ def BuildProgram(env): env.ProcessProgramDeps() env.ProcessProjectDeps() + # append into the beginning a main LD script + if env.get("LDSCRIPT_PATH") and not any("-Wl,-T" in f for f in env["LINKFLAGS"]): + env.Prepend(LINKFLAGS=["-T", env.subst("$LDSCRIPT_PATH")]) + + # enable "cyclic reference" for linker + if env.get("LIBS") and env.GetCompilerType() == "gcc": + env.Prepend(_LIBFLAGS="-Wl,--start-group ") + env.Append(_LIBFLAGS=" -Wl,--end-group") + program = env.Program( os.path.join("$BUILD_DIR", env.subst("$PROGNAME")), env["PIOBUILDFILES"] ) @@ -115,15 +124,6 @@ def _append_pio_macros(): if "__test" in COMMAND_LINE_TARGETS: env.ConfigureTestTarget() - # append into the beginning a main LD script - if env.get("LDSCRIPT_PATH") and not any("-Wl,-T" in f for f in env["LINKFLAGS"]): - env.Prepend(LINKFLAGS=["-T", env.subst("$LDSCRIPT_PATH")]) - - # enable "cyclic reference" for linker - if env.get("LIBS") and env.GetCompilerType() == "gcc": - env.Prepend(_LIBFLAGS="-Wl,--start-group ") - env.Append(_LIBFLAGS=" -Wl,--end-group") - def ProcessProjectDeps(env): project_lib_builder = env.ConfigureProjectLibBuilder()