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.
This commit is contained in:
Matthijs Kooijman 2014-06-25 15:53:45 +02:00
parent 7d71b84ae2
commit 4eb686673f
1 changed files with 9 additions and 7 deletions

View File

@ -690,6 +690,8 @@ public class Compiler implements MessageConsumer {
// 3. compile the core, outputting .o files to <buildPath> 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<File> objectFiles = compileFiles(buildFolder, coreFolder, true,
List<File> coreObjectFiles = compileFiles(buildFolder, coreFolder, true,
includeFolders);
if (variantFolder != null)
objectFiles.addAll(compileFiles(buildFolder, variantFolder, true,
includeFolders));
for (File file : objectFiles) {
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