[libc-commits] [PATCH] D147985: [LIBC] Implement `sched_yield()`

Noah Goldstein via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Apr 11 13:40:04 PDT 2023


goldstein.w.n added a comment.

In D147985#4259116 <https://reviews.llvm.org/D147985#4259116>, @michaelrj wrote:

> The function looks good, but since you're adding a new function there's a bit of extra configuration that needs to be done. I'll walk you through it here, but if you want an example then this patch should also show what needs to be done: https://reviews.llvm.org/D147970.
>
> First, we need the function to have a `FunctionSpec` in the `spec/` folder. For this function it will be in `spec/gnu_ext.td`, alongside `sched_getaffinity`.
> Next, to get the function to build on the target platform we need to add the entrypoint to the list in `config/linux/x86_64/entrypoints.txt`. If you want you can also add it to the entrypoints list for other CPU architectures (e.g. RISC-V), but x86_64 is the most important one for testing.
> We require all of the functions to have unit tests, which will go in `test/src/sched/sched_yield_test.cpp`. Don't worry about this making this too complex. This is a simple syscall wrapper so it just needs to test that calling the function succeeds.
> Finally, the cmake for the `sched` folder is a little unusual, so you'll also need to add an alias to `src/sched/CMakeLists.txt`.
>
> I know this looks like a lot, but each part should be fairly quick. Feel free to reach out if you want more guidance on how to do it.

Done, thanks for the guidance.

As an aside, are you planning to implement anything along the lines of gnu `ifunc`? If not is the method
for arch-specific just with higher isa builds and compiler flags (i.e `#ifdef __AVX2__` and stuff like that).

Also are you guys planning on implementing dynamic loader?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147985



More information about the libc-commits mailing list