This is an automated email from the ASF dual-hosted git repository.
kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
The following commit(s) were added to refs/heads/master by this push:
new 923a0e21 newt/toolchain: Close whole-archive list file
923a0e21 is described below
commit 923a0e2176ec65558410ebc4748626d2d6e1a534
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sun Oct 18 21:39:33 2026 +0200
newt/toolchain: Close whole-archive list file
For packages with pkg.whole_archive set, CompileArchive() writes a
.list file with object file names that is later passed to the linker
as @file. The file was never closed, and since the list is recreated
on every build, newt still held it open when the linker ran.
On Windows the xc32 driver fails to read such file:
Error reading file
(../src/xc-sh.c,2570): Fatal shell error
so every PIC32 application using e.g. sys/shell failed to link.
Close the file when done writing.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jerzy Kasenberg <[email protected]>
---
newt/toolchain/compiler.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index 0cc42a7b..d1590200 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -1439,6 +1439,7 @@ func (c *Compiler) CompileArchive(outputFile string,
createList bool) error {
if err != nil {
return util.NewNewtError(err.Error())
}
+ defer file.Close()
for _, objFilePath := range objList {
_, err = file.WriteString(objFilePath + "\n")