8000 builder: use ar-chives for linking big sketches (was: use the @ syntax to reduce command line length if needed) by cmaglie · Pull Request #961 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content

builder: use ar-chives for linking big sketches (was: use the @ syntax to reduce command line length if needed) #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 12, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
Prev Previous commit
using paths.PathList to keep objectFileList
  • Loading branch information
cmaglie committed Oct 27, 2020
commit d2dfefc11da0d188192e1169e983048eac205cb9
13 changes: 5 additions & 8 deletions legacy/builder/phases/linker.go
8000
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths
// because thery are both named spi.o.

properties := buildProperties.Clone()
archives := map[string]bool{}
archives := paths.NewPathList()
for _, object := range objectFiles {
archive := object.Parent().Join("objs.a")
if !archives[archive.String()] {
archives[archive.String()] = true
if !archives.Contains(archive) {
archives.Add(archive)
// Cleanup old archives
_ = archive.Remove()
}
Expand All @@ -86,11 +86,8 @@ func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths
}
}

objectFileList = ""
for archive := range archives {
objectFileList += " " + wrapWithDoubleQuotes(archive)
}
objectFileList = "-Wl,--whole-archive" + objectFileList + " -Wl,--no-whole-archive"
objectFileList = strings.Join(utils.Map(archives.AsStrings(), wrapWithDoubleQuotes), " ")
objectFileList = "-Wl,--whole-archive " + objectFileList + " -Wl,--no-whole-archive"
}

properties := buildProperties.Clone()
Expand Down
0