aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-10-06 05:39:10 -0400
committerMichael S. Tsirkin <mst@redhat.com>2016-10-30 18:21:42 -0400
commit44d65ea1615099ae252407f2554338d450cfdb1c (patch)
tree122999495aa15ccb3944bf064a0af76470c9e590
parent8424af5336b34043a705d66bdf2c1428048ef085 (diff)
ringtest: use link-time optimization
By using -flto and -fwhole-program, all functions from the ring implementation can be treated as static and possibly inlined. Force this to happen through the GCC flatten attribute. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--tools/virtio/ringtest/Makefile4
-rw-r--r--tools/virtio/ringtest/main.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/virtio/ringtest/Makefile b/tools/virtio/ringtest/Makefile
index 877a8a4721b6..c012edbdb13b 100644
--- a/tools/virtio/ringtest/Makefile
+++ b/tools/virtio/ringtest/Makefile
@@ -3,8 +3,8 @@ all:
3all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder ptr_ring noring 3all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder ptr_ring noring
4 4
5CFLAGS += -Wall 5CFLAGS += -Wall
6CFLAGS += -pthread -O2 -ggdb 6CFLAGS += -pthread -O2 -ggdb -flto -fwhole-program
7LDFLAGS += -pthread -O2 -ggdb 7LDFLAGS += -pthread -O2 -ggdb -flto -fwhole-program
8 8
9main.o: main.c main.h 9main.o: main.c main.h
10ring.o: ring.c main.h 10ring.o: ring.c main.h
diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c
index 147abb452a6c..bda7f0dad981 100644
--- a/tools/virtio/ringtest/main.c
+++ b/tools/virtio/ringtest/main.c
@@ -96,7 +96,7 @@ void set_affinity(const char *arg)
96 assert(!ret); 96 assert(!ret);
97} 97}
98 98
99static void run_guest(void) 99static void __attribute__((__flatten__)) run_guest(void)
100{ 100{
101 int completed_before; 101 int completed_before;
102 int completed = 0; 102 int completed = 0;
@@ -149,7 +149,7 @@ static void run_guest(void)
149 } 149 }
150} 150}
151 151
152static void run_host(void) 152static void __attribute__((__flatten__)) run_host(void)
153{ 153{
154 int completed_before; 154 int completed_before;
155 int completed = 0; 155 int completed = 0;