OpenBSD: x86 update

This commit is contained in:
herman ten brugge 2021-01-11 19:26:10 +01:00
parent bbc7070c82
commit cd91ea658a
3 changed files with 10 additions and 5 deletions

View File

@ -379,7 +379,7 @@ static uint8_t fastcallw_regs[2] = { TREG_ECX, TREG_EDX };
returning via struct pointer. */
ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize)
{
#if defined(TCC_TARGET_PE) || TARGETOS_FreeBSD
#if defined(TCC_TARGET_PE) || TARGETOS_FreeBSD || TARGETOS_OpenBSD
int size, align;
*ret_align = 1; // Never have to re-align return values for x86
*regsize = 4;
@ -495,7 +495,7 @@ ST_FUNC void gfunc_call(int nb_args)
args_size -= 4;
}
}
#if !defined(TCC_TARGET_PE) && !TARGETOS_FreeBSD
#if !defined(TCC_TARGET_PE) && !TARGETOS_FreeBSD || TARGETOS_OpenBSD
else if ((vtop->type.ref->type.t & VT_BTYPE) == VT_STRUCT)
args_size -= 4;
#endif
@ -545,7 +545,7 @@ ST_FUNC void gfunc_prolog(Sym *func_sym)
func_sub_sp_offset = ind;
/* if the function returns a structure, then add an
implicit pointer parameter */
#if defined(TCC_TARGET_PE) || TARGETOS_FreeBSD
#if defined(TCC_TARGET_PE) || TARGETOS_FreeBSD || TARGETOS_OpenBSD
size = type_size(&func_vt,&align);
if (((func_vt.t & VT_BTYPE) == VT_STRUCT)
&& (size > 8 || (size & (size - 1)))) {
@ -586,7 +586,7 @@ ST_FUNC void gfunc_prolog(Sym *func_sym)
/* pascal type call or fastcall ? */
if (func_call == FUNC_STDCALL || func_call == FUNC_FASTCALLW)
func_ret_sub = addr - 8;
#if !defined(TCC_TARGET_PE) && !TARGETOS_FreeBSD
#if !defined(TCC_TARGET_PE) && !TARGETOS_FreeBSD || TARGETOS_OpenBSD
else if (func_vc)
func_ret_sub = 4;
#endif

View File

@ -1477,6 +1477,11 @@ static int tcc_set_linker(TCCState *s, const char *option)
s->filetype |= AFF_WHOLE_ARCHIVE;
else
s->filetype &= ~AFF_WHOLE_ARCHIVE;
} else if (ret = link_option(option, "z=", &p), ret) {
if (!strcmp(p, "notext"))
; /* ignore */
else
goto err;
} else if (p) {
return 0;
} else {

View File

@ -56,7 +56,7 @@ endif
ifeq ($(ARCH),i386)
# tcctest.c:get_asm_string uses a construct that is checked too strictly
# by GCC in 32bit mode when PIC is enabled.
test.ref: CFLAGS+=-fno-PIC -fno-PIE
test.ref: CFLAGS+=-fno-PIC -fno-PIE -Wl,-z,notext
endif
ifeq ($(CC_NAME),msvc)
test.ref abitest : CC = gcc