Skip to content

Commit 4eb6866

Browse files
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.
1 parent 7d71b84 commit 4eb6866

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/src/processing/app/debug/Compiler.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,8 @@ private void compileFilesInFolder(File buildFolder, File srcFolder, List<File> i
690690

691691
// 3. compile the core, outputting .o files to <buildPath> and then
692692
// collecting them into the core.a library file.
693+
// Also compiles the variant (if it supplies actual source files),
694+
// which are included in the link directly (not through core.a)
693695
void compileCore()
694696
throws RunnerException {
695697

@@ -702,13 +704,9 @@ void compileCore()
702704
if (variantFolder != null)
703705
includeFolders.add(variantFolder);
704706

705-
List<File> objectFiles = compileFiles(buildFolder, coreFolder, true,
706-
includeFolders);
707-
if (variantFolder != null)
708-
objectFiles.addAll(compileFiles(buildFolder, variantFolder, true,
709-
includeFolders));
710-
711-
for (File file : objectFiles) {
707+
List<File> coreObjectFiles = compileFiles(buildFolder, coreFolder, true,
708+
includeFolders);
709+
for (File file : coreObjectFiles) {
712710

713711
PreferencesMap dict = new PreferencesMap(prefs);
714712
dict.put("ide_version", "" + Base.REVISION);
@@ -724,6 +722,10 @@ void compileCore()
724722
}
725723
execAsynchronously(cmdArray);
726724
}
725+
726+
if (variantFolder != null)
727+
objectFiles.addAll(compileFiles(buildFolder, variantFolder, true,
728+
includeFolders));
727729
}
728730

729731
// 4. link it all together into the .elf file

0 commit comments

Comments
 (0)