Allow Statically Linking in Go (#2067)
* unset -L and -rpath from CGO_LDFLAGS Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com> * allow go statically linking Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com> * fix setup.py --------- Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com> Co-authored-by: mio <mio@lazym.io>
This commit is contained in:
4
bindings/go/unicorn/cgo.go
Normal file
4
bindings/go/unicorn/cgo.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package unicorn
|
||||
|
||||
// #cgo CFLAGS: -I../../../include -O3 -Wall -Werror
|
||||
import "C"
|
||||
6
bindings/go/unicorn/cgo_dynamic.go
Normal file
6
bindings/go/unicorn/cgo_dynamic.go
Normal file
@@ -0,0 +1,6 @@
|
||||
//go:build !static
|
||||
|
||||
package unicorn
|
||||
|
||||
// #cgo LDFLAGS: -lunicorn
|
||||
import "C"
|
||||
7
bindings/go/unicorn/cgo_static.go
Normal file
7
bindings/go/unicorn/cgo_static.go
Normal file
@@ -0,0 +1,7 @@
|
||||
//go:build static
|
||||
|
||||
package unicorn
|
||||
|
||||
// #cgo !darwin LDFLAGS: -lunicorn -lpthread -lm -latomic
|
||||
// #cgo darwin LDFLAGS: -lunicorn.o
|
||||
import "C"
|
||||
@@ -7,9 +7,6 @@ import (
|
||||
)
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -O3 -Wall -Werror -I../../../include
|
||||
#cgo LDFLAGS: -L../../../ -lunicorn -Wl,-rpath,${SRCDIR}/../../../
|
||||
#cgo linux LDFLAGS: -L../../../ -lunicorn -lrt -Wl,-rpath,${SRCDIR}/../../../
|
||||
#include <unicorn/unicorn.h>
|
||||
#include "uc.h"
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user