Skip to content

Commit 8e7d9cd

Browse files
luzhanningzhanning.lu
andauthored
fix: merge '-Wl,' with next value when (#4367)
**What type of PR is this?** > Bug fix **What does this PR do? Why is it needed?** Previously if we pass `-extldflags,-Wl,--thread` into command line, it will only recognizes `-Wl` and ignores `--thread`. **Which issues(s) does this PR fix?** #3921 Fixes # If we see `-Wl`, we can merge with next value in the list. **Other notes for review** Co-authored-by: zhanning.lu <zhanning.lu@bytedance.com>
1 parent fc0cf79 commit 8e7d9cd

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

go/private/actions/link.bzl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,21 @@ def _extract_extldflags(gc_linkopts, extldflags):
214214
"""
215215
filtered_gc_linkopts = []
216216
is_extldflags = False
217-
for opt in gc_linkopts:
217+
skip_next = False
218+
219+
for i, opt in enumerate(gc_linkopts):
220+
if skip_next:
221+
skip_next = False
222+
continue
223+
218224
if is_extldflags:
225+
if opt == "-Wl" and i + 1 < len(gc_linkopts):
226+
# Merge '-Wl,' and next value
227+
extldflags.append("-Wl," + gc_linkopts[i + 1])
228+
skip_next = True
229+
else:
230+
extldflags.append(opt)
219231
is_extldflags = False
220-
extldflags.append(opt)
221232
elif opt == "-extldflags":
222233
is_extldflags = True
223234
else:

0 commit comments

Comments
 (0)