[all-commits] [llvm/llvm-project] 3c64a9: [libc] Partially implement 'errno' on the GPU (#97...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Jul 1 04:30:38 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c64a98180148340ed72aa2c19054ddfbcfa72e1
      https://github.com/llvm/llvm-project/commit/3c64a98180148340ed72aa2c19054ddfbcfa72e1
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-07-01 (Mon, 01 Jul 2024)

  Changed paths:
    M libc/docs/gpu/motivation.rst
    M libc/include/errno.h.def
    M libc/src/errno/libc_errno.cpp

  Log Message:
  -----------
  [libc] Partially implement 'errno' on the GPU (#97107)

Summary:
The `errno` variable is expected to be `thread_local` by the standard.
However, the GPU targets do not support `thread_local` and implementing
that would be a large endeavor. Because of that, we previously didn't
provide the `errno` symbol at all. However, to build some programs we at
least need to be able to link against `errno`. Many things that would
normally set `errno` completely ignore it currently (i.e. stdio) but
some programs still need to be able to link against correct C programs.

For this purpose this patch exports the `errno` symbol as a simple
global. Internally, this will be updated atomically so it's at least not
racy. Externally, this will be on the user. I've updated the
documentation to state as such. This is required to get `libc++` to
build.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list