Skip to content

Commit

Permalink
SPARC WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
badochov committed Aug 30, 2024
1 parent 3a6a521 commit 7278f65
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions ld.elf_so/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ else ifeq ($(findstring riscv,$(TARGET_SUFF)),riscv)
include $(addprefix $(LOCAL_DIR), arch/riscv/Makefile.inc)
else ifeq ($(findstring arm,$(TARGET_SUFF)),arm)
include $(addprefix $(LOCAL_DIR), arch/arm/Makefile.inc)
else ifeq ($(findstring sparc,$(TARGET_SUFF)),sparc)
include $(addprefix $(LOCAL_DIR), arch/sparc/Makefile.inc)
endif

LANGUAGE_EXTENSIONS_OLD := $(LANGUAGE_EXTENSIONS)
Expand Down
23 changes: 16 additions & 7 deletions ld.elf_so/arch/sparc/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# $NetBSD: Makefile.inc,v 1.15 2018/04/03 21:10:27 joerg Exp $
#
# Makefile for Phoenix-RTOS ld.elf_so/arch
#
# Copyright 2024 Phoenix Systems
#

SRCS+= rtld_start.S mdreloc.c
LDSO_ARCH_DIR := $(call my-dir)
LDSO_ARCH_PREFIX := $(LDSO_ARCH_DIR:$(LOCAL_DIR)%=%)

# XXX Should not be in CPPFLAGS!
CPPFLAGS+= -fpic
LOCAL_SRCS += $(addprefix $(LDSO_ARCH_PREFIX), rtld_start.S mdreloc.c)

CPPFLAGS+= -DELFSIZE=32
CPPFLAGS+= -DRTLD_COMMON_CALL_IFUNC_RELA
LOCAL_CFLAGS += -DELFSIZE=32
LOCAL_CFLAGS += -DRTLD_COMMON_CALL_IFUNC_REL

LDFLAGS+= -Wl,-e,_rtld_start
LOCAL_LDFLAGS += $(LDFLAGS_PREFIX)-e,.rtld_start
LOCAL_LDFLAGS += $(TARGET_PIC_FLAG)

# FIXME: improve tls implementation in Phoenix
LOCAL_CFLAGS += -D__HAVE_TLS_VARIANT_II
LOCAL_CFLAGS += -D__HAVE_COMMON___TLS_GET_ADDR
2 changes: 1 addition & 1 deletion ld.elf_so/arch/sparc/mdreloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
__RCSID("$NetBSD: mdreloc.c,v 1.60 2024/08/03 21:59:58 riastradh Exp $");
#endif /* not lint */

#include <machine/elf_support.h>
#include "../../include/arch/sparc/elf_support.h"

#include <errno.h>
#include <stdio.h>
Expand Down
2 changes: 0 additions & 2 deletions ld.elf_so/arch/sparc/rtld_start.S
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <machine/asm.h>

.section ".text"
.align 4
.global _rtld_start
Expand Down
3 changes: 2 additions & 1 deletion ld.elf_so/reloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ _rtld_call_ifunc(Obj_Entry *obj, sigset_t *mask, u_int cur_objgen)

#ifdef RTLD_COMMON_CALL_IFUNC_RELA
# ifdef __sparc__
# include <machine/elf_support.h>
/* FIXME: split to sparc and sparc64 include. */
# include "include/NetBSD/arch/sparc/elf_support.h"
# endif

void
Expand Down

0 comments on commit 7278f65

Please sign in to comment.