[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] Support clang for explicit_bzero
From: |
Bruno Haible |
Subject: |
Re: [PATCH 3/5] Support clang for explicit_bzero |
Date: |
Sun, 12 Apr 2020 00:26:12 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-174-generic; KDE/5.18.0; x86_64; ; ) |
Hi Bastien,
> diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
> index b355f9bdf..21bbd67e8 100644
> --- a/lib/explicit_bzero.c
> +++ b/lib/explicit_bzero.c
> @@ -56,9 +56,15 @@ explicit_bzero (void *s, size_t len)
> (void) SecureZeroMemory(s,len);
> #else
> memset (s, '\0', len);
> -# if defined __GNUC__ && !defined __clang__
> - /* Compiler barrier. */
> - asm volatile ("" ::: "memory");
> -# endif
> +#if defined __GNUC__
> +# if !defined __clang__
> + /* Compiler barrier. */
> + asm volatile ("" ::: "memory");
> +# else
> + /* https://bugs.llvm.org/show_bug.cgi?id=15495#c11 */
> + __asm__ volatile("" : : "g"(s) : "memory");
> +# endif
> +#endif
> +
> #endif
> }
Looks good, except for the indentation.
Bruno
- [patch] Improve explicit_bzero, roucaries . bastien, 2020/04/11
- [PATCH 1/5] Use memset_s if possible for explicit_bzero, roucaries . bastien, 2020/04/11
- [PATCH 2/5] Use SecureZeroMemory on windows for explicit_bzero, roucaries . bastien, 2020/04/11
- [PATCH 5/5] Fix styling in explicit bzero, roucaries . bastien, 2020/04/11
- [PATCH 3/5] Support clang for explicit_bzero, roucaries . bastien, 2020/04/11
- Re: [PATCH 3/5] Support clang for explicit_bzero,
Bruno Haible <=
- [PATCH 4/5] Use volatile trick for explicit_bzero, roucaries . bastien, 2020/04/11
- Re: [patch] Improve explicit_bzero, Bruno Haible, 2020/04/11