libports: ffi for x86_32

- Required by glib

issue #4201
This commit is contained in:
Sebastian Sumpf 2021-06-24 11:41:01 +02:00 committed by Christian Helmuth
parent 19a7997734
commit a242bfce48
6 changed files with 72 additions and 3 deletions

View File

@ -1,3 +1,7 @@
ifeq ($(filter-out $(SPECS),x86_32),)
INC_DIR += $(call select_from_ports,ffi)/include/ffi/spec/x86_32
endif
ifeq ($(filter-out $(SPECS),x86_64),)
INC_DIR += $(call select_from_ports,ffi)/include/ffi/spec/x86_64
endif

View File

@ -0,0 +1,23 @@
SHARED_LIB = yes
LIBS = libc
FFI_PORT = $(call select_from_ports,ffi)/src/lib/ffi
INC_DIR = $(FFI_PORT)/include
INC_DIR += $(call select_from_ports,ffi)/include/ffi/spec/x86_32 \
$(REP_DIR)/src/lib/ffi
CC_OPT = -DFFI_NO_RAW_API=0
SRC_C = prep_cif.c types.c ffi.c dummies.c
SRC_S = sysv.S
CC_OPT_sysv = -DHAVE_AS_ASCII_PSEUDO_OP=1 -DHAVE_AS_X86_PCREL=1
vpath prep_cif.c $(FFI_PORT)/src
vpath types.c $(FFI_PORT)/src
vpath ffi.c $(FFI_PORT)/src/x86
vpath sysv.S $(FFI_PORT)/src/x86
vpath dummies.c $(REP_DIR)/src/lib/ffi

View File

@ -1 +1 @@
5212feb1aca2937a6e3a9c09d9cf7c1a954a8b69
f4bc2449b826b5884559d6ff453b06269270fff3

View File

@ -8,14 +8,18 @@ DIR(ffi) := src/lib/ffi
$(call check_tool,sed)
DIRS := include/ffi/spec/x86_64 include/ffi/spec/arm include/ffi/spec/arm_64
DIRS := include/ffi/spec/x86_32 include/ffi/spec/x86_64 \
include/ffi/spec/arm include/ffi/spec/arm_64
DIR_CONTENT(include/ffi/spec/x86_32) := src/lib/ffi/src/x86/ffitarget.h
DIR_CONTENT(include/ffi/spec/x86_64) := src/lib/ffi/src/x86/ffitarget.h
DIR_CONTENT(include/ffi/spec/arm) := src/lib/ffi/src/arm/ffitarget.h
DIR_CONTENT(include/ffi/spec/arm_64) := src/lib/ffi/src/aarch64/ffitarget.h
gen_inc := ffi.h
gen_files := $(addprefix include/ffi/spec/x86_64/,$(gen_inc)) \
gen_files := $(addprefix include/ffi/spec/x86_32/,$(gen_inc)) \
$(addprefix include/ffi/spec/x86_64/,$(gen_inc)) \
$(addprefix include/ffi/spec/arm/,$(gen_inc)) \
$(addprefix include/ffi/spec/arm_64/,$(gen_inc))
@ -23,6 +27,12 @@ default: $(gen_files)
$(gen_files): _dirs
subst_x86_32 := \
"@TARGET@/X86" \
"@HAVE_LONG_DOUBLE@/0" \
"@HAVE_LONG_DOUBLE_VARIANT@/0" \
"@FFI_EXEC_TRAMPOLINE_TABLE@/0"
subst_x86_64 := \
"@TARGET@/X86_64" \
"@HAVE_LONG_DOUBLE@/1" \
@ -43,6 +53,11 @@ subst_ARM_64 := \
apply_substitutions = $(VERBOSE)for i in $(2); do sed -i "s/$$i/g" $(1); done
include/ffi/spec/x86_32/ffi.h:
@$(MSG_GENERATE)$@
$(VERBOSE)cp src/lib/ffi/include/ffi.h.in $@
$(call apply_substitutions,$@,$(subst_x86_32))
include/ffi/spec/x86_64/ffi.h:
@$(MSG_GENERATE)$@
$(VERBOSE)cp src/lib/ffi/include/ffi.h.in $@

View File

@ -0,0 +1,20 @@
/**
* \brief Dummy functions not supported by Genode
* \author Sebastian Sumpf
* \date 2021-06-24
*/
/*
* Copyright (C) 2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <ffi.h>
/* win32 specific functions for x86_32 */
void ffi_closure_STDCALL (ffi_closure *c) { }
void ffi_closure_REGISTER (ffi_closure *c) { }
void ffi_closure_THISCALL (ffi_closure *c) { }
void ffi_closure_FASTCALL (ffi_closure *c) { }

View File

@ -1,7 +1,14 @@
#ifndef _FFICONFIG_H_
#define _FFICONFIG_H_
#ifdef LIBFFI_ASM
#define FFI_HIDDEN(name) .hidden name
#else
#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
#endif
#define EH_FRAME_FLAGS "a"
#define STDC_HEADERS 1
#define HAVE_MEMCPY 1