From 4eb686673f7133d0aa000e8828825d1b077ff952 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 25 Jun 2014 15:53:45 +0200 Subject: [PATCH] Don't include .o files from the variant in core.a If a variant supplied source files, these would be included in core.a before. However, object files from core.a would only actually be included in the build if they supplied a symbol for a strong reference that was still missing. In practice, this meant that a variant source file that only defines interrupt handlers, or only defines strong versions of functions that already had weak versions available, was not included. By moving the variant .o files out of core.a and including them in the build directly, this problem is solved. Furthermore, the compilation of variant files is moved to after the generation of core.a, to make it clearer in the code and verbose output what is now happening. --- app/src/processing/app/debug/Compiler.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 92f25a1c5..2a94cbd6e 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -690,6 +690,8 @@ public class Compiler implements MessageConsumer { // 3. compile the core, outputting .o files to and then // collecting them into the core.a library file. + // Also compiles the variant (if it supplies actual source files), + // which are included in the link directly (not through core.a) void compileCore() throws RunnerException { @@ -702,13 +704,9 @@ public class Compiler implements MessageConsumer { if (variantFolder != null) includeFolders.add(variantFolder); - List objectFiles = compileFiles(buildFolder, coreFolder, true, - includeFolders); - if (variantFolder != null) - objectFiles.addAll(compileFiles(buildFolder, variantFolder, true, - includeFolders)); - - for (File file : objectFiles) { + List coreObjectFiles = compileFiles(buildFolder, coreFolder, true, + includeFolders); + for (File file : coreObjectFiles) { PreferencesMap dict = new PreferencesMap(prefs); dict.put("ide_version", "" + Base.REVISION); @@ -724,6 +722,10 @@ public class Compiler implements MessageConsumer { } execAsynchronously(cmdArray); } + + if (variantFolder != null) + objectFiles.addAll(compileFiles(buildFolder, variantFolder, true, + includeFolders)); } // 4. link it all together into the .elf file