Alex Richardson bf6ab93088 [riscv] Workaround for undef-weak symbol relocations with clang+lld
When building with clang -mcmodel=medany and linking with ld.lld, we get
out-of-range relocation errors for undefined __start_<section> symbols
since 0 cannot be represented as a PC-relative offset). This is not a
problem with ld.bfd since ld.bfd rewrites the instructions to avoid the
out-of-range PC-relative relocation. For now, the simplest workaround is
to build with -fpie -mcmodel=medany (thus indirecting these symbols via
the GOT). This will be done automatically once clang includes
https://reviews.llvm.org/D107280.

Without this change I get the following linker errors:
ld.lld: error: dev/driver.c:21:(.text+0x1E): relocation R_RISCV_PCREL_HI20 out of range: -524295 is not in [-524288, 524287]; references __start_devices

See https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/126 and
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/201.
2023-06-08 07:08:49 -07:00
2015-01-29 20:38:19 -08:00

The Little Kernel Embedded Operating System

The LK kernel is an SMP-aware kernel designed for small systems ported to a variety of platforms and cpu architectures.

See https://github.com/littlekernel/lk for the latest version.

High Level Features

  • Fully-reentrant multi-threaded preemptive kernel
  • Portable to many 32 and 64 bit architectures
  • Support for wide variety of embedded and larger platforms
  • Powerful modular build system
  • Large number of utility components selectable at build time

Supported architectures

  • ARM32
    • Cortex-M class cores (armv6m - armv8m)
    • ARMv7+ Cortex-A class cores
  • ARM64
  • RISC-V 32 and 64bit bit in machine and supervisor mode
  • x86-32 and x86-64 386 up through modern cores
  • microblaze
  • MIPS
  • OpenRISC 1000

TODO

To build and test for ARM on linux

  1. install or build qemu. v2.4 and above is recommended.
  2. install gcc for embedded arm (see note 1)
  3. run scripts/do-qemuarm (from the lk directory)
  4. you should see 'welcome to lk/MP'

This will get you a interactive prompt into LK which is running in qemu arm machine 'virt' emulation. type 'help' for commands.

Note: for ubuntu x86-64: sudo apt-get install gcc-arm-none-eabi or fetch a prebuilt toolchain from https://newos.org/toolchains/x86_64-elf-10.2.0-Linux-x86_64.tar.xz

Description
No description provided
Readme MIT 39 MiB
Languages
C 80.6%
C++ 10.8%
Assembly 3.6%
Makefile 3.4%
Python 1%
Other 0.6%