https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65070

            Bug ID: 65070
           Summary: libgomp calls syscall instruction directly
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nyh at math dot technion.ac.il
                CC: jakub at gcc dot gnu.org

The code in libgomp/config/linux/x86/futex.h is needlessly complicated: It
contains a definition of SYS_futex, and contains two variants (x86 and x86_64)
of the assembly code needed to run a system call. But unless I'm missing
something, all of this is quite redundant - glibc already has the
<sys/syscall.h> defining SYS_futex, and a syscall() function calling a system
call in the right way for both x86 and x86_64. 

Using the assembly code directly instead of calling the syscall() function is a
tiny bit faster, but since this code only use for fairly slow situations anyway
(a futex is only used when a context switch is necessary), the extra
function-call overhead should be, I think, negligible.

Finally, my ulterior motive for making this code call syscall() instead of
machine instructions directly is that the latter breaks on the OSv operating
system: https://github.com/cloudius-systems/osv/issues/590

Reply via email to