[PATCH] D74361: [Clang] Undef attribute for global variables

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 05:52:09 PST 2020


JonChesterfield added a comment.

The above patch composes sensibly with openmp, e.g.

  #include <omp.h>
  #pragma omp declare target
  int data __attribute__((no_zero_initializer));
  #pragma omp allocate(data) allocator(omp_pteam_mem_alloc)
  #pragma omp end declare target

  @data = hidden addrspace(3) global i32 undef, align 4

I like `loader_uninitialized`. There's some prior art on using NOLOAD from a (gnu) linker script to achieve the same result, which is a similar name. I'll update the patch accordingly.

I found an arm toolchain which supports UNINIT in linker scripts. Asking around I've also heard that games dev is a potential user for this feature (perhaps analogous to mmap's MAP_UNINITIALIZED?) but haven't been able to confirm specifics.

I'll take a first shot at the documentation too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74361/new/

https://reviews.llvm.org/D74361





More information about the cfe-commits mailing list