diff mbox series

[v1,14/24] tests/tcg/i386: fix test-i386

Message ID 20180410193919.28026-15-alex.bennee@linaro.org
State New
Headers show
Series fix building of tests/tcg | expand

Commit Message

Alex Bennée April 10, 2018, 7:39 p.m. UTC
The test-i386 test case is a little special as it includes assembler
files. Add the additional compile magic to assemble these bits and
link them to the final binary.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 tests/tcg/i386/Makefile.target | 19 +++++++++++++++++++
 tests/tcg/i386/test-i386.c     |  1 -
 2 files changed, 19 insertions(+), 1 deletion(-)

-- 
2.16.2

Comments

Thomas Huth April 11, 2018, 3:36 p.m. UTC | #1
On 10.04.2018 21:39, Alex Bennée wrote:
> The test-i386 test case is a little special as it includes assembler

> files. Add the additional compile magic to assemble these bits and

> link them to the final binary.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  tests/tcg/i386/Makefile.target | 19 +++++++++++++++++++

>  tests/tcg/i386/test-i386.c     |  1 -

>  2 files changed, 19 insertions(+), 1 deletion(-)


Reviewed-by: Thomas Huth <thuth@redhat.com>
Philippe Mathieu-Daudé April 16, 2018, 12:13 a.m. UTC | #2
On 04/10/2018 04:39 PM, Alex Bennée wrote:
> The test-i386 test case is a little special as it includes assembler

> files. Add the additional compile magic to assemble these bits and

> link them to the final binary.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>  tests/tcg/i386/Makefile.target | 19 +++++++++++++++++++

>  tests/tcg/i386/test-i386.c     |  1 -

>  2 files changed, 19 insertions(+), 1 deletion(-)

> 

> diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target

> index 7dbb7992e7..1df69e0dab 100644

> --- a/tests/tcg/i386/Makefile.target

> +++ b/tests/tcg/i386/Makefile.target

> @@ -8,3 +8,22 @@ ifdef CROSS_CC_GUEST_CFLAGS

>  CFLAGS+=$(CROSS_CC_GUEST_CFLAGS)

>  endif

>  endif

> +

> +#

> +# test-386 includes a couple of additional objects that need to be linked together

> +#

> +

> +TEST_I386_DEPS=test-i386-code16.o test-i386-vm86.o

> +

> +# override the default compile and link in one go rule

> +test-i386.o: test-i386.c

> +	$(CC) $(CFLAGS) -c $< -o $@

> +

> +# and provide a rule to compile .S files

> +%.o: %.S

> +	$(CC) $(CFLAGS) -c $< -o $@

> +

> +test-i386: LDFLAGS+=-lm -lc

> +test-i386: test-i386.o $(TEST_I386_DEPS)

> +	$(LD) -melf_i386 $(LDFLAGS) $< $(TEST_I386_DEPS) -o $@

> +

> diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c

> index 9599204895..cae6a7773a 100644

> --- a/tests/tcg/i386/test-i386.c

> +++ b/tests/tcg/i386/test-i386.c

> @@ -17,7 +17,6 @@

>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.

>   */

>  #define _GNU_SOURCE

> -#include "qemu/compiler.h"

>  #include <stdlib.h>

>  #include <stdio.h>

>  #include <string.h>

>
diff mbox series

Patch

diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target
index 7dbb7992e7..1df69e0dab 100644
--- a/tests/tcg/i386/Makefile.target
+++ b/tests/tcg/i386/Makefile.target
@@ -8,3 +8,22 @@  ifdef CROSS_CC_GUEST_CFLAGS
 CFLAGS+=$(CROSS_CC_GUEST_CFLAGS)
 endif
 endif
+
+#
+# test-386 includes a couple of additional objects that need to be linked together
+#
+
+TEST_I386_DEPS=test-i386-code16.o test-i386-vm86.o
+
+# override the default compile and link in one go rule
+test-i386.o: test-i386.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+# and provide a rule to compile .S files
+%.o: %.S
+	$(CC) $(CFLAGS) -c $< -o $@
+
+test-i386: LDFLAGS+=-lm -lc
+test-i386: test-i386.o $(TEST_I386_DEPS)
+	$(LD) -melf_i386 $(LDFLAGS) $< $(TEST_I386_DEPS) -o $@
+
diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c
index 9599204895..cae6a7773a 100644
--- a/tests/tcg/i386/test-i386.c
+++ b/tests/tcg/i386/test-i386.c
@@ -17,7 +17,6 @@ 
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #define _GNU_SOURCE
-#include "qemu/compiler.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>