aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-05-07 17:11:43 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-05-15 07:59:18 +1000
commit2b9fdc7a27b2199830dd9f245eff92d506cc9bf9 (patch)
tree634e348ab1c8da4dca8c6961f2d4942267cf8fdb
parent4fed073fd02ae24c1e3f099e20bed623ac00df2e (diff)
downloadskiboot-2b9fdc7a27b2199830dd9f245eff92d506cc9bf9.zip
skiboot-2b9fdc7a27b2199830dd9f245eff92d506cc9bf9.tar.gz
skiboot-2b9fdc7a27b2199830dd9f245eff92d506cc9bf9.tar.bz2
Enable SKIBOOT_GCOV build option for building with profiling
Enable build options for building skiboot with GCOV profiling, including a skeleton -lgcov replacement in the form of core/gcov-profiling.c We don't actually have to do anything as part of the gcov routines, gcov auto generates everything we need. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--Makefile.main4
-rw-r--r--core/Makefile.inc6
-rw-r--r--core/gcov-profiling.c76
3 files changed, 86 insertions, 0 deletions
diff --git a/Makefile.main b/Makefile.main
index cf41a22..bd03ff4 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -52,6 +52,10 @@ CPPFLAGS += -ffreestanding
CFLAGS := -fno-strict-aliasing -fstack-protector-all -pie -mbig-endian -m64
+ifeq ($(SKIBOOT_GCOV),1)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
ifeq ($(STACK_CHECK),1)
CFLAGS += -fstack-protector-all -pg
CPPFLAGS += -DSTACK_CHECK_ENABLED
diff --git a/core/Makefile.inc b/core/Makefile.inc
index 5f5fe04..d808cc9 100644
--- a/core/Makefile.inc
+++ b/core/Makefile.inc
@@ -8,9 +8,15 @@ CORE_OBJS += device.o exceptions.o trace.o affinity.o vpd.o
CORE_OBJS += hostservices.o platform.o nvram.o hmi.o
CORE_OBJS += console-log.o ipmi.o time-utils.o pel.o pool.o errorlog.o
CORE_OBJS += timer.o i2c.o rtc.o flash.o sensor.o
+
+ifeq ($(SKIBOOT_GCOV),1)
+CORE_OBJS += gcov-profiling.o
+endif
+
CORE=core/built-in.o
CFLAGS_SKIP_core/relocate.o = -pg -fstack-protector-all
CFLAGS_SKIP_core/relocate.o += -fstack-protector -fstack-protector-strong
+CFLAGS_SKIP_core/relocate.o += -fprofile-arcs -ftest-coverage
$(CORE): $(CORE_OBJS:%=core/%)
diff --git a/core/gcov-profiling.c b/core/gcov-profiling.c
new file mode 100644
index 0000000..453ae7f
--- /dev/null
+++ b/core/gcov-profiling.c
@@ -0,0 +1,76 @@
+/* Copyright 2013-2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <compiler.h>
+
+typedef long gcov_type;
+
+void __gcov_init(void* f) __attrconst;
+void __gcov_flush(void) __attrconst;
+void __gcov_merge_add(gcov_type *counters, unsigned int n_counters) __attrconst;
+void __gcov_merge_single(gcov_type *counters, unsigned int n_counters) __attrconst;
+void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters) __attrconst;
+void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters) __attrconst;
+void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters) __attrconst;
+
+void __gcov_init(void* f)
+{
+ (void)f;
+
+ return;
+}
+
+void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
+{
+ (void)counters;
+ (void)n_counters;
+
+ return;
+}
+
+void __gcov_flush(void)
+{
+ return;
+}
+
+void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
+{
+ (void)counters;
+ (void)n_counters;
+
+ return;
+}
+
+void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
+{
+ (void)counters;
+ (void)n_counters;
+
+ return;
+}
+
+void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
+{
+ (void)counters;
+ (void)n_counters;
+ return;
+}
+
+void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
+{
+ (void)counters;
+ (void)n_counters;
+}