From 4cde8bceb1ff14896884c224850f6c7611551175 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 12 May 2023 00:36:18 +0300 Subject: fix LLVM compilation + RELEASE=1 doesn't work for some reason, though --- arch/riscv64/conf/init-link.S | 7 ++----- arch/riscv64/init/start.S | 7 +------ arch/riscv64/kernel/entry.S | 1 - arch/riscv64/source.mk | 10 ---------- 4 files changed, 3 insertions(+), 22 deletions(-) (limited to 'arch/riscv64') diff --git a/arch/riscv64/conf/init-link.S b/arch/riscv64/conf/init-link.S index 0933fbb..2f48814 100644 --- a/arch/riscv64/conf/init-link.S +++ b/arch/riscv64/conf/init-link.S @@ -15,7 +15,7 @@ SECTIONS { final binary */ .text ALIGN(4K) : AT(0) { - *(.init.start) + *(.init*) *(.text*); } @@ -31,10 +31,7 @@ SECTIONS { *(.sbss*) *(.bss*) *(COMMON) } - .top : { - *(.top*) - } - + __kernel = .; __kernel_size = ; .garbage : { diff --git a/arch/riscv64/init/start.S b/arch/riscv64/init/start.S index 759c409..7439d93 100644 --- a/arch/riscv64/init/start.S +++ b/arch/riscv64/init/start.S @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: copyleft-next-0.3.1 */ /* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */ -.section .init.start +.section .init .global _start /* Entry point to the kernel loader. */ _start: @@ -20,8 +20,3 @@ li sp, VM_STACK_TOP // load virtual stack address li fp, 0 li gp, 0 jr a2 // jump to kernel - -/* there should be a kernel payload after this address */ -.section .top -.global __kernel -__kernel: diff --git a/arch/riscv64/kernel/entry.S b/arch/riscv64/kernel/entry.S index fe25854..5331385 100644 --- a/arch/riscv64/kernel/entry.S +++ b/arch/riscv64/kernel/entry.S @@ -14,7 +14,6 @@ /* very much based on linux, but why change it if works, eh? */ .section .text -.align 4 .global handle_irq handle_irq: csrrw tp, CSR_SSCRATCH, tp diff --git a/arch/riscv64/source.mk b/arch/riscv64/source.mk index 5de5309..321ba7c 100644 --- a/arch/riscv64/source.mk +++ b/arch/riscv64/source.mk @@ -4,16 +4,6 @@ INIT_SOURCES += $(ARCH_SOURCE)/init/*.[cS] # this doesn't work for rv32, but fine for now */ ARCH_CFLAGS := -mcmodel=medany -ARCH_LDFLAGS := -fuse-ld=bfd - -# slightly hacky but bfd is currently the only compiler that correctly handles -# riscv relocations, but it doesn't recognise LLVM lto files, so if we're -# doing an LLVM compilation, remove lto support -DEBUGFLAGS != [ $(LLVM) ] && echo $(DEBUGFLAGS:-flto=) || echo $(DEBUGFLAGS) - -# llvm-objcopy is buggy, use gnu tools instead -# christ, not much LLVM tooling available for RISCV :D -OBJCOPY := $(CROSS_COMPILE)objcopy run: $(ARCH_SOURCE)/conf/mkimage.sh $(ARCH) -- cgit v1.3