Skip to content

Commit

Permalink
Don't use weak symbols in the EDK2 build.
Browse files Browse the repository at this point in the history
Change-Id: Ie2ae13569a9000ecc6143ab74b69d4f886e27789
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/70447
Reviewed-by: David Benjamin <davidben@google.com>
Auto-Submit: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
  • Loading branch information
Adam Langley authored and Boringssl LUCI CQ committed Aug 23, 2024
1 parent e13f7e2 commit da3cd90
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crypto/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ static void __asan_unpoison_memory_region(const void *addr, size_t size) {}
// Windows doesn't really support weak symbols as of May 2019, and Clang on
// Windows will emit strong symbols instead. See
// https://bugs.llvm.org/show_bug.cgi?id=37598
#if defined(__ELF__) && defined(__GNUC__)
//
// EDK2 targets UEFI but builds as ELF and then translates the binary to
// COFF(!). Thus it builds with __ELF__ defined but cannot actually cope with
// weak symbols.
#if !defined(__EDK2_BORINGSSL__) && defined(__ELF__) && defined(__GNUC__)
#define WEAK_SYMBOL_FUNC(rettype, name, args) \
rettype name args __attribute__((weak));
#else
Expand Down Expand Up @@ -242,7 +246,7 @@ void *OPENSSL_malloc(size_t size) {
__asan_poison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
return ((uint8_t *)ptr) + OPENSSL_MALLOC_PREFIX;

err:
err:
// This only works because ERR does not call OPENSSL_malloc.
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
return NULL;
Expand Down Expand Up @@ -523,7 +527,7 @@ int OPENSSL_vasprintf_internal(char **str, const char *format, va_list args,
*str = candidate;
return ret;

err:
err:
deallocate(candidate);
*str = NULL;
errno = ENOMEM;
Expand Down

0 comments on commit da3cd90

Please sign in to comment.