You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/12/16 01:01:41 UTC

incubator-mynewt-newt git commit: newt - Don't create empty .a files.

Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop e1b064e8a -> 9991f4713


newt - Don't create empty .a files.

If there are no .o files to archive, then don't create a .a file for the
package.  Empty .a files were causing strange issues with a different
(non-gcc) linker that I was trying.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/9991f471
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/9991f471
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/9991f471

Branch: refs/heads/develop
Commit: 9991f4713b7ddfa1c9bbbec86d26c5e8ca1dd1bb
Parents: e1b064e
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Dec 15 17:00:40 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu Dec 15 17:00:40 2016 -0800

----------------------------------------------------------------------
 newt/toolchain/compiler.go | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/9991f471/newt/toolchain/compiler.go
----------------------------------------------------------------------
diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index 95275a5..12606e4 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -1125,16 +1125,24 @@ func (c *Compiler) CompileArchive(archiveFile string) error {
 	}
 
 	// Delete the old archive, if it exists.
-	err = os.Remove(archiveFile)
+	os.Remove(archiveFile)
 
-	util.StatusMessage(util.VERBOSITY_DEFAULT, "Archiving %s\n",
-		path.Base(archiveFile))
 	objList := c.getObjFiles([]string{})
 	if objList == nil {
 		return nil
 	}
-	util.StatusMessage(util.VERBOSITY_VERBOSE, "Archiving %s with object "+
-		"files %s\n", archiveFile, strings.Join(objList, " "))
+
+	if len(objList) == 0 {
+		util.StatusMessage(util.VERBOSITY_VERBOSE,
+			"Not archiving %s; no object files\n", archiveFile)
+		return nil
+	}
+
+	util.StatusMessage(util.VERBOSITY_DEFAULT, "Archiving %s",
+		path.Base(archiveFile))
+	util.StatusMessage(util.VERBOSITY_VERBOSE, " with object files %s",
+		archiveFile, strings.Join(objList, " "))
+	util.StatusMessage(util.VERBOSITY_DEFAULT, "\n")
 
 	if err != nil && !os.IsNotExist(err) {
 		return util.NewNewtError(err.Error())