Skip to content

Commit

Permalink
Fixed an issue with "start-group/end-group" linker flags on Native de…
Browse files Browse the repository at this point in the history
…velopment platform // Resolve #3282
  • Loading branch information
ivankravets committed Nov 21, 2019
1 parent 8675d3f commit 9cf777b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ PlatformIO Core 4.0
* Warn about broken library manifest when scanning dependencies (`issue #3268 <https://github.com/platformio/platformio-core/issues/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 <https://github.com/platformio/platformio-core/issues/3264>`_)
* Fixed an issue with "start-group/end-group" linker flags on Native development platform (`issue #3282 <https://github.com/platformio/platformio-core/issues/3282>`_)

4.1.0 (2019-11-07)
~~~~~~~~~~~~~~~~~~
Expand Down
18 changes: 9 additions & 9 deletions platformio/builder/tools/platformio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 9cf777b

Please sign in to comment.