qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/4] multiboot: make tests work with clang


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH 4/4] multiboot: make tests work with clang
Date: Fri, 13 Oct 2017 10:01:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 13.10.2017 01:54, Anatol Pomozov wrote:
>  * clang 3.8 enables SSE even for 32bit code. Generate code for pentium
>    CPU to make sure no new instructions are used.
>  * add memset() implementation. Clang implements array zeroing in
>    print_num() via memset() function call.
> ---
>  tests/multiboot/Makefile    | 2 +-
>  tests/multiboot/libc.c      | 9 +++++++++
>  tests/multiboot/libc.h      | 2 ++
>  tests/multiboot/run_test.sh | 1 +
>  4 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/multiboot/Makefile b/tests/multiboot/Makefile
> index b6a5056347..79dfe85afc 100644
> --- a/tests/multiboot/Makefile
> +++ b/tests/multiboot/Makefile
> @@ -1,5 +1,5 @@
>  CC=gcc
> -CCFLAGS=-m32 -Wall -Wextra -Werror -fno-stack-protector -nostdinc 
> -fno-builtin
> +CCFLAGS=-m32 -Wall -Wextra -Werror -fno-stack-protector -nostdinc 
> -fno-builtin -march=pentium
>  ASFLAGS=-m32
>  
>  LD=ld
> diff --git a/tests/multiboot/libc.c b/tests/multiboot/libc.c
> index 6df9bda96d..512fccd7fa 100644
> --- a/tests/multiboot/libc.c
> +++ b/tests/multiboot/libc.c
> @@ -33,6 +33,15 @@ void* memcpy(void *dest, const void *src, int n)
>  
>      return dest;
>  }
> +void *memset(void *s, int c, size_t n)

Add an empty line before the new function?

> +{
> +    size_t i;
> +    char *d = s;
> +    for (i = 0; i < n; i++) {

while (n-- > 0) ?

... that way you don't need the i variable.

> +        *d++ = c;
> +    }
> +    return s;
> +}

 Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]