Skip to content

Commit

Permalink
mason: build kernel as executable [#146]
Browse files Browse the repository at this point in the history
... instead of custom_target.
This is very interesting, as it now uses clang -nostdlib for linking,
which seems to work. This will probably simplify the cross-compilation,
in case clang can find the proper cross ld.
  • Loading branch information
stsp committed Dec 29, 2024
1 parent 6c30dba commit 7dd6671
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions fdpp/kernel/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,15 @@ SRCS = [

nargs = ['-DXCPU=186', '-DWITHFAT32', '-DFDPP']

lib = static_library('dummy',
executable(TARGET + '.elf',
[SRCS, sfiles, plt_inc],
include_directories: incdir2,
nasm_args: nargs,
build_by_default: false)
nasm_ld = find_program(['i686-linux-gnu-ld', 'i386-elf-ld', 'x86_64-linux-gnu-ld', 'ld.bfd'])
custom_target(TARGET + '.elf',
output: [TARGET + '.elf', TARGET + '.map'],
input: lib.extract_all_objects(recursive: true),
command: [nasm_ld, '-melf_i386', '-static',
'-Map=@OUTPUT1@', '-o', '@OUTPUT0@',
'--emit-relocs', '-T' + kernel_ld, '@INPUT@'],
link_args: ['-Wl,-melf_i386', '-Wl,-static',
'-Wl,-Map=' + TARGET + '.map', '-nostdlib',
'-Wl,--emit-relocs', '-Wl,-T' + kernel_ld],
install: true,
install_dir: get_option('datadir') / 'fdpp',
install_mode: 'rw-r--r--',
build_by_default: true)
install_mode: 'rw-r--r--')

VERSION = meson.project_version()

0 comments on commit 7dd6671

Please sign in to comment.