提交 44d65ea1 编写于 作者: P Paolo Bonzini 提交者: Michael S. Tsirkin

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: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 8424af53
...@@ -3,8 +3,8 @@ all: ...@@ -3,8 +3,8 @@ all:
all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder ptr_ring noring all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder ptr_ring noring
CFLAGS += -Wall CFLAGS += -Wall
CFLAGS += -pthread -O2 -ggdb CFLAGS += -pthread -O2 -ggdb -flto -fwhole-program
LDFLAGS += -pthread -O2 -ggdb LDFLAGS += -pthread -O2 -ggdb -flto -fwhole-program
main.o: main.c main.h main.o: main.c main.h
ring.o: ring.c main.h ring.o: ring.c main.h
......
...@@ -96,7 +96,7 @@ void set_affinity(const char *arg) ...@@ -96,7 +96,7 @@ void set_affinity(const char *arg)
assert(!ret); assert(!ret);
} }
static void run_guest(void) static void __attribute__((__flatten__)) run_guest(void)
{ {
int completed_before; int completed_before;
int completed = 0; int completed = 0;
...@@ -149,7 +149,7 @@ static void run_guest(void) ...@@ -149,7 +149,7 @@ static void run_guest(void)
} }
} }
static void run_host(void) static void __attribute__((__flatten__)) run_host(void)
{ {
int completed_before; int completed_before;
int completed = 0; int completed = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册