@@ -16,20 +16,7 @@ import (
16
16
func (b * builder ) createRawSyscall (call * ssa.CallCommon ) (llvm.Value , error ) {
17
17
num := b .getValue (call .Args [0 ])
18
18
switch {
19
- case b .GOARCH == "amd64" :
20
- if b .GOOS == "darwin" {
21
- // Darwin adds this magic number to system call numbers:
22
- //
23
- // > Syscall classes for 64-bit system call entry.
24
- // > For 64-bit users, the 32-bit syscall number is partitioned
25
- // > with the high-order bits representing the class and low-order
26
- // > bits being the syscall number within that class.
27
- // > The high-order 32-bits of the 64-bit syscall number are unused.
28
- // > All system classes enter the kernel via the syscall instruction.
29
- //
30
- // Source: https://opensource.apple.com/source/xnu/xnu-792.13.8/osfmk/mach/i386/syscall_sw.h
31
- num = b .CreateOr (num , llvm .ConstInt (b .uintptrType , 0x2000000 , false ), "" )
32
- }
19
+ case b .GOARCH == "amd64" && b .GOOS == "linux" :
33
20
// Sources:
34
21
// https://stackoverflow.com/a/2538212
35
22
// https://en.wikibooks.org/wiki/X86_Assembly/Interfacing_with_Linux#syscall
@@ -179,26 +166,6 @@ func (b *builder) createSyscall(call *ssa.CallCommon) (llvm.Value, error) {
179
166
retval = b .CreateInsertValue (retval , zero , 1 , "" )
180
167
retval = b .CreateInsertValue (retval , errResult , 2 , "" )
181
168
return retval , nil
182
- case "darwin" :
183
- syscallResult , err := b .createRawSyscall (call )
184
- if err != nil {
185
- return syscallResult , err
186
- }
187
- // Return values: r0, r1 uintptr, err Errno
188
- // Pseudocode:
189
- // var err uintptr
190
- // if syscallResult != 0 {
191
- // err = syscallResult
192
- // }
193
- // return syscallResult, 0, err
194
- zero := llvm .ConstInt (b .uintptrType , 0 , false )
195
- hasError := b .CreateICmp (llvm .IntNE , syscallResult , llvm .ConstInt (b .uintptrType , 0 , false ), "" )
196
- errResult := b .CreateSelect (hasError , syscallResult , zero , "syscallError" )
197
- retval := llvm .Undef (b .ctx .StructType ([]llvm.Type {b .uintptrType , b .uintptrType , b .uintptrType }, false ))
198
- retval = b .CreateInsertValue (retval , syscallResult , 0 , "" )
199
- retval = b .CreateInsertValue (retval , zero , 1 , "" )
200
- retval = b .CreateInsertValue (retval , errResult , 2 , "" )
201
- return retval , nil
202
169
case "windows" :
203
170
// On Windows, syscall.Syscall* is basically just a function pointer
204
171
// call. This is complicated in gc because of stack switching and the
0 commit comments