@@ -45,43 +45,6 @@ func (b *Builder) link() error {
4545 wrapWithDoubleQuotes := func (value string ) string { return "\" " + value + "\" " }
4646 objectFileList := strings .Join (f .Map (objectFiles .AsStrings (), wrapWithDoubleQuotes ), " " )
4747
48- // If command line length is too big (> 30000 chars), try to collect the object files into archives
49- // and use that archives to complete the build.
50- if len (objectFileList ) > 30000 {
51-
52- // We must create an object file for each visited directory: this is required because gcc-ar checks
53- // if an object file is already in the archive by looking ONLY at the filename WITHOUT the path, so
54- // it may happen that a subdir/spi.o inside the archive may be overwritten by a anotherdir/spi.o
55- // because thery are both named spi.o.
56-
57- // Put all the existing archives apart from the other object files
58- existingArchives := objectFiles .Clone ()
59- existingArchives .FilterSuffix (".a" )
60- objectFiles .FilterOutSuffix (".a" )
61-
62- // Generate an archive for each directory from the remaining object files
63- newArchives := paths .NewPathList ()
64- for _ , object := range objectFiles {
65- archive := object .Parent ().Join ("objs.a" )
66- newArchives .AddIfMissing (archive )
67- }
68- for _ , archive := range newArchives {
69- archiveDir := archive .Parent ()
70- relatedObjectFiles := objectFiles .Clone ()
71- relatedObjectFiles .Filter (func (object * paths.Path ) bool {
72- // extract all the object files that are in the same directory of the archive
73- return object .Parent ().EquivalentTo (archiveDir )
74- })
75- b .archiveCompiledFiles (archive , relatedObjectFiles )
76- }
77-
78- // Put everything together
79- allArchives := existingArchives .Clone ()
80- allArchives .AddAll (newArchives )
81- objectFileList = strings .Join (f .Map (allArchives .AsStrings (), wrapWithDoubleQuotes ), " " )
82- objectFileList = "-Wl,--whole-archive " + objectFileList + " -Wl,--no-whole-archive"
83- }
84-
8548 properties := b .buildProperties .Clone ()
8649 properties .Set ("compiler.c.elf.flags" , properties .Get ("compiler.c.elf.flags" ))
8750 properties .Set ("compiler.warning_flags" , properties .Get ("compiler.warning_flags." + b .logger .WarningsLevel ()))
0 commit comments