We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 65f30dd commit 708eff2Copy full SHA for 708eff2
platformio/builder/tools/platformio.py
@@ -122,6 +122,25 @@ def _append_pio_macros():
122
if (env.get("LDSCRIPT_PATH")
123
and not any("-Wl,-T" in f for f in env['LINKFLAGS'])):
124
env.Prepend(LINKFLAGS=["-T", "$LDSCRIPT_PATH"])
125
+ # or parse user-provided -Wl,-T... and prepend it before any other arguments
126
+ else:
127
+ flags = env["LINKFLAGS"]
128
+ filtered = []
129
+ ldscript = None
130
+
131
+ while len(flags):
132
+ flag = flags.pop(0)
133
+ if "-Wl,-T" in flag:
134
+ ldscript = flag.replace("-Wl,", "")
135
+ continue
136
137
+ filtered.append(flag)
138
139
+ filtered.insert(0, ldscript)
140
+ env.Replace(LINKFLAGS=filtered)
141
142
+ # TODO removeme
143
+ print(env["LINKFLAGS"])
144
145
# enable "cyclic reference" for linker
146
if env.get("LIBS") and env.GetCompilerType() == "gcc":
0 commit comments