From d6f1c6ce89c16eda7d86c319cc92f551ee352496 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Mon, 20 Oct 2014 18:03:56 -0400 Subject: x86: Fixes to avoid LTO warnings This patch fixes a few minor issues that caused link-time warnings when using LTO, mainly for x86. The most important change is how the syscall array is created. Previously gcc and clang would complain that the declaration and definition types did not match. The organisation is now changed to match how it is done for ARM, moving the code that was previously in syscalls.cc into process.cc, and having a class variable pointing to the static array. With these changes, there are no longer any warnings using gcc 4.6.3 with LTO. --- src/sim/system.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/sim/system.cc') diff --git a/src/sim/system.cc b/src/sim/system.cc index 61c6decf7..1f63dbf33 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -54,7 +54,6 @@ #include "cpu/thread_context.hh" #include "debug/Loader.hh" #include "debug/WorkItems.hh" -#include "kern/kernel_stats.hh" #include "mem/abstract_mem.hh" #include "mem/physical.hh" #include "params/System.hh" @@ -63,6 +62,14 @@ #include "sim/full_system.hh" #include "sim/system.hh" +/** + * To avoid linking errors with LTO, only include the header if we + * actually have a definition. + */ +#if THE_ISA != NULL_ISA +#include "kern/kernel_stats.hh" +#endif + using namespace std; using namespace TheISA; -- cgit v1.2.3