mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-17 17:45:19 +00:00
Simpify startup of dynamically linked binaries
This patch removes the component_entry_point library, which used to proved a hook for the libc to intercept the call of the 'Component::construct' function. The mechansim has several shortcomings (see the discussion in the associated issue) and was complex. So we eventually discarded the approach in favor of the explicit handling of the startup. A regular Genode component provides a 'Component::construct' function, which is determined by the dynamic linker via a symbol lookup. For the time being, the dynamic linker falls back to looking up a 'main' function if no 'Component::construct' function could be found. The libc provides an implementation of 'Component::construct', which sets up the libc's task handling and finally call the function 'Libc::Component::construct' from the context of the appllication task. This function is expected to be provided by the libc-using application. Consequently, Genode components that use the libc have to implement the 'Libc::Component::construct' function. The new 'posix' library provides an implementation of 'Libc::Component::construct' that calls a main function. Hence, POSIX programs that merely use the POSIX API merely have to add 'posix' to the 'LIBS' declaration in their 'target.mk' file. Their execution starts at 'main'. Issue #2199
This commit is contained in:
parent
8d521036fb
commit
4da52517c1
@ -43,7 +43,6 @@ SRC_CC += env.cc
|
||||
SRC_CC += region_map_support.cc
|
||||
SRC_CC += pager.cc
|
||||
SRC_CC += _main.cc
|
||||
SRC_CC += component_construct.cc
|
||||
SRC_CC += kernel/cpu_scheduler.cc
|
||||
SRC_CC += kernel/double_list.cc
|
||||
SRC_CC += kernel/init.cc
|
||||
|
@ -78,16 +78,6 @@ namespace Genode {
|
||||
extern void bootstrap_component();
|
||||
extern void call_global_static_constructors();
|
||||
|
||||
/*
|
||||
* Hook for intercepting the call of the 'Component::construct' method. By
|
||||
* hooking this function pointer in a library constructor, the libc is able
|
||||
* to create a task context for the component code. This context is
|
||||
* scheduled by the libc in a cooperative fashion, i.e. when the
|
||||
* component's entrypoint is activated.
|
||||
*/
|
||||
|
||||
extern void (*call_component_construct)(Genode::Env &) __attribute__((weak));
|
||||
|
||||
/*
|
||||
* This function is normally provided by the cxx library, which is not
|
||||
* used for lx_hybrid programs. For lx_hybrid programs, the exception
|
||||
@ -96,13 +86,6 @@ namespace Genode {
|
||||
void init_exception_handling(Env &) { }
|
||||
}
|
||||
|
||||
static void lx_hybrid_component_construct(Genode::Env &env)
|
||||
{
|
||||
Component::construct(env);
|
||||
}
|
||||
|
||||
void (*Genode::call_component_construct)(Genode::Env &) = &lx_hybrid_component_construct;
|
||||
|
||||
/*
|
||||
* Static constructors are handled by the Linux startup code - so implement
|
||||
* this as empty function.
|
||||
|
@ -1,6 +0,0 @@
|
||||
#
|
||||
# All dynamic executables must be linked to the component entry-point library
|
||||
# (a trampoline for component startup from ldso), so, enforce the library
|
||||
# dependency here.
|
||||
#
|
||||
LIBS += component_entry_point
|
@ -1 +0,0 @@
|
||||
include $(BASE_DIR)/lib/import/import-base.mk
|
@ -1,7 +0,0 @@
|
||||
#
|
||||
# Component entry point (a trampoline for component startup from ldso)
|
||||
#
|
||||
|
||||
SRC_CC = component_entry_point.cc component_construct.cc
|
||||
|
||||
vpath %.cc $(REP_DIR)/src/lib/startup
|
@ -38,8 +38,6 @@ ENTRY_POINT = _start
|
||||
LD_OPT += -T$(DIR)/linker.ld
|
||||
endif
|
||||
|
||||
include $(BASE_DIR)/lib/import/import-ld.mk
|
||||
|
||||
vpath %.cc $(DIR)
|
||||
|
||||
# vi:ft=make
|
||||
|
@ -1 +0,0 @@
|
||||
LIBS = component_entry_point
|
@ -1,5 +1,5 @@
|
||||
SRC_S += crt0.s
|
||||
SRC_CC += _main.cc init_main_thread.cc component_construct.cc
|
||||
SRC_CC += _main.cc init_main_thread.cc
|
||||
REP_INC_DIR += src/include
|
||||
LIBS += syscall
|
||||
|
||||
|
@ -184,7 +184,6 @@ _ZN6Genode18Signal_transmitterC1ENS_10CapabilityINS_14Signal_contextEEE T
|
||||
_ZN6Genode18Signal_transmitterC2ENS_10CapabilityINS_14Signal_contextEEE T
|
||||
_ZN6Genode18server_socket_pairEv T
|
||||
_ZN6Genode20env_session_id_spaceEv T
|
||||
_ZN6Genode21component_entry_pointERNS_3EnvE T
|
||||
_ZN6Genode25env_stack_area_region_mapE B
|
||||
_ZN6Genode26env_stack_area_ram_sessionE B
|
||||
_ZN6Genode29upgrade_pd_quota_non_blockingEm T
|
||||
|
@ -106,11 +106,9 @@ endif
|
||||
#
|
||||
ifeq ($(LIBS),)
|
||||
ifneq ($(LIB),platform)
|
||||
ifneq ($(LIB),component_entry_point)
|
||||
LIBS += platform
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Check if the requirements of the target are satisfied
|
||||
|
@ -159,7 +159,7 @@ $(LIB_RLIB): $(OBJECTS)
|
||||
#
|
||||
ifdef SHARED_LIB
|
||||
ifneq ($(LIB_IS_DYNAMIC_LINKER),yes)
|
||||
override DEPS := $(filter-out $(BASE_LIBS:=.lib) component_entry_point.lib,$(DEPS))
|
||||
override DEPS := $(filter-out $(BASE_LIBS:=.lib),$(DEPS))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -110,14 +110,8 @@ LD_CMD ?= $(CXX)
|
||||
LD_CMD += $(CXX_LINK_OPT)
|
||||
|
||||
ifeq ($(SHARED_LIBS),)
|
||||
FILTER_DEPS := $(DEPS:.lib=)
|
||||
LD_SCRIPTS := $(LD_SCRIPT_STATIC)
|
||||
|
||||
#
|
||||
# Filter out the component-entry-point library since its not used for static
|
||||
# binaries
|
||||
#
|
||||
FILTER_DEPS := $(filter-out component_entry_point,$(DEPS:.lib=))
|
||||
|
||||
else
|
||||
|
||||
#
|
||||
@ -135,13 +129,6 @@ LD_CMD += -Wl,--dynamic-linker=$(DYNAMIC_LINKER).lib.so \
|
||||
FILTER_DEPS := $(filter-out $(BASE_LIBS),$(DEPS:.lib=))
|
||||
SHARED_LIBS += $(LIB_CACHE_DIR)/$(DYNAMIC_LINKER)/$(DYNAMIC_LINKER).lib.so
|
||||
|
||||
|
||||
#
|
||||
# Link all dynamic executables to the component entry-point library (a
|
||||
# trampoline for component startup from ldso)
|
||||
#
|
||||
FILTER_DEPS += component_entry_point
|
||||
|
||||
#
|
||||
# Build program position independent as well
|
||||
#
|
||||
|
@ -13,4 +13,7 @@
|
||||
_ctors_end;
|
||||
_dtors_start;
|
||||
_dtors_end;
|
||||
_ZN9Component9constructERN6Genode3EnvE;
|
||||
_ZN9Component10stack_sizeEv;
|
||||
main;
|
||||
};
|
||||
|
@ -11,14 +11,10 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Components don't need to startup with CRT0 as LDSO has done this
|
||||
* initialization during its own CRT0 already. The component always starts at
|
||||
* Genode::component_entry_point() as a trampoline to
|
||||
* call_component_construct().
|
||||
* The entry point of dynamically linked components is unused. The dynamic
|
||||
* linker determines the 'Component::construct' function via a symbol lookup.
|
||||
*/
|
||||
ENTRY(_ZN6Genode21component_entry_pointERNS_3EnvE)
|
||||
|
||||
PHDRS
|
||||
{
|
||||
@ -37,10 +33,21 @@ SECTIONS
|
||||
{
|
||||
_prog_img_beg = .;
|
||||
|
||||
/* put entry code at the start of the text segment / raw binary */
|
||||
*(.text._ZN6Genode21component_entry_pointERNS_3EnvE)
|
||||
/*
|
||||
* The ELF entry point is unused for dynamically linked components. The
|
||||
* dynamic linker determined the entry point by looking up the symbol of
|
||||
* the 'Component::construct' function or - if it does not exist - the
|
||||
* 'main' function (for legacy components).
|
||||
*
|
||||
* \deprecated The support for legacy main functions will be removed.
|
||||
*
|
||||
* The 'KEEP' directive prevents text that is reachable from one of the
|
||||
* possible entry points from being garbage collected.
|
||||
*/
|
||||
KEEP(*(.text._ZN9Component9constructERN6Genode3EnvE .text.main))
|
||||
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
*(.text
|
||||
.stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
} : ro =0x0
|
||||
|
@ -152,6 +152,10 @@ namespace Genode {
|
||||
}
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() __attribute__((weak));
|
||||
Genode::size_t Component::stack_size() { return 64*1024; }
|
||||
|
||||
|
||||
/*
|
||||
* We need to execute the constructor of the main entrypoint from a
|
||||
* class called 'Startup' as 'Startup' is a friend of 'Entrypoint'.
|
||||
|
@ -31,8 +31,6 @@ namespace Genode {
|
||||
extern bool inhibit_tracing;
|
||||
void call_global_static_constructors();
|
||||
void destroy_signal_thread();
|
||||
|
||||
extern void (*call_component_construct)(Genode::Env &);
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +150,7 @@ namespace {
|
||||
|
||||
Genode::call_global_static_constructors();
|
||||
|
||||
Genode::call_component_construct(env);
|
||||
Component::construct(env);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -317,6 +317,20 @@ Linker::Ld &Linker::Ld::linker()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Defined in the startup library, passed to legacy main functions.
|
||||
*/
|
||||
extern char **genode_argv;
|
||||
extern int genode_argc;
|
||||
extern char **genode_envp;
|
||||
|
||||
void genode_exit(int status);
|
||||
|
||||
static int exit_status;
|
||||
|
||||
static void exit_on_suspended() { genode_exit(exit_status); }
|
||||
|
||||
|
||||
/**
|
||||
* The dynamic binary to load
|
||||
*/
|
||||
@ -348,16 +362,26 @@ struct Linker::Binary : Root_object, Elf_object
|
||||
|
||||
Elf::Addr lookup_symbol(char const *name)
|
||||
{
|
||||
Elf::Sym const *symbol = 0;
|
||||
|
||||
if ((symbol = Elf_object::lookup_symbol(name, Hash_table::hash(name))))
|
||||
return reloc_base() + symbol->st_value;
|
||||
|
||||
return 0;
|
||||
try {
|
||||
Elf::Addr base = 0;
|
||||
Elf::Sym const *sym = Linker::lookup_symbol(name, dynamic().dep(), &base);
|
||||
return base + sym->st_value;
|
||||
}
|
||||
catch (Linker::Not_found) { return 0; }
|
||||
}
|
||||
|
||||
void call_entry_point(Env &env)
|
||||
{
|
||||
/* apply the component-provided stack size */
|
||||
if (Elf::Addr addr = lookup_symbol("_ZN9Component10stack_sizeEv")) {
|
||||
|
||||
/* call 'Component::stack_size()' */
|
||||
size_t const stack_size = ((size_t(*)())addr)();
|
||||
|
||||
/* expand stack according to the component's needs */
|
||||
Thread::myself()->stack_size(stack_size);
|
||||
}
|
||||
|
||||
/* call static construtors and register destructors */
|
||||
Func * const ctors_start = (Func *)lookup_symbol("_ctors_start");
|
||||
Func * const ctors_end = (Func *)lookup_symbol("_ctors_end");
|
||||
@ -367,13 +391,33 @@ struct Linker::Binary : Root_object, Elf_object
|
||||
Func * const dtors_end = (Func *)lookup_symbol("_dtors_end");
|
||||
for (Func * dtor = dtors_start; dtor != dtors_end; genode_atexit(*dtor++));
|
||||
|
||||
/* call component entry point */
|
||||
/* XXX the function type for call_component_construct() is a candidate
|
||||
* for a base-internal header */
|
||||
typedef void (*Entry)(Env &);
|
||||
Entry const entry = reinterpret_cast<Entry>(_file->entry);
|
||||
/* call 'Component::construct' function if present */
|
||||
if (Elf::Addr addr = lookup_symbol("_ZN9Component9constructERN6Genode3EnvE")) {
|
||||
((void(*)(Env &))addr)(env);
|
||||
return;
|
||||
}
|
||||
|
||||
entry(env);
|
||||
/*
|
||||
* The 'Component::construct' function is missing. This may be the
|
||||
* case for legacy components that still implement a 'main' function.
|
||||
*
|
||||
* \deprecated the handling of legacy 'main' functions will be removed
|
||||
*/
|
||||
if (Elf::Addr addr = lookup_symbol("main")) {
|
||||
warning("using legacy main function, please convert to 'Component::construct'");
|
||||
|
||||
exit_status = ((int (*)(int, char **, char **))addr)(genode_argc,
|
||||
genode_argv,
|
||||
genode_envp);
|
||||
|
||||
/* trigger suspend in the entry point */
|
||||
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
||||
|
||||
/* return to entrypoint and exit via exit_on_suspended() */
|
||||
return;
|
||||
}
|
||||
|
||||
error("dynamic linker: component-entrypoint lookup failed");
|
||||
}
|
||||
|
||||
void relocate(Bind bind) override
|
||||
@ -486,7 +530,6 @@ Elf::Sym const *Linker::lookup_symbol(char const *name, Dependency const &dep,
|
||||
if (binary_ptr && &dep != binary_ptr->first_dep()) {
|
||||
return lookup_symbol(name, *binary_ptr->first_dep(), base, undef, other);
|
||||
} else {
|
||||
error("LD: could not lookup symbol \"", name, "\"");
|
||||
throw Not_found();
|
||||
}
|
||||
}
|
||||
|
@ -250,3 +250,24 @@ extern "C" int _main()
|
||||
/* never reached */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int exit_status;
|
||||
static void exit_on_suspended() { genode_exit(exit_status); }
|
||||
|
||||
|
||||
extern int main(int argc, char **argv, char **envp);
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) __attribute__((weak));
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* call real main function */
|
||||
exit_status = main(genode_argc, genode_argv, genode_envp);
|
||||
|
||||
/* trigger suspend in the entry point */
|
||||
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
||||
|
||||
/* return to entrypoint and exit via exit_on_suspended() */
|
||||
}
|
||||
|
||||
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* \brief Startup code for component construction
|
||||
* \author Christian Helmuth
|
||||
* \date 2016-01-21
|
||||
*
|
||||
* The component construction code is used by the startup library, which is
|
||||
* linked to static binaries and ld.lib.so. The code is also used by the
|
||||
* component_entry_point static library, which is linked to all dynamic
|
||||
* executables to make the fallback implementation and the
|
||||
* call_component_construct-hook function pointer available to these binaries.
|
||||
*
|
||||
* Note, for dynamic binaries we can't refer to the default implementation in
|
||||
* ld.lib.so as it is a component itself implementing the Component functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
|
||||
|
||||
namespace Genode {
|
||||
|
||||
/*
|
||||
* Hook for intercepting the call of the 'Component::construct' method. By
|
||||
* hooking this function pointer in a library constructor, the libc is able
|
||||
* to create a task context for the component code. This context is
|
||||
* scheduled by the libc in a cooperative fashion, i.e. when the
|
||||
* component's entrypoint is activated.
|
||||
*/
|
||||
|
||||
extern void (*call_component_construct)(Genode::Env &) __attribute__((weak));
|
||||
}
|
||||
|
||||
static void default_component_construct(Genode::Env &env)
|
||||
{
|
||||
Component::construct(env);
|
||||
}
|
||||
|
||||
void (*Genode::call_component_construct)(Genode::Env &) = &default_component_construct;
|
||||
|
||||
|
||||
/****************************************************
|
||||
** Fallback implementation of Component interface **
|
||||
****************************************************/
|
||||
|
||||
extern void genode_exit(int status);
|
||||
|
||||
static int exit_status;
|
||||
|
||||
static void exit_on_suspended() { genode_exit(exit_status); }
|
||||
|
||||
/*
|
||||
* Regular components provide the 'Component' interface as defined in
|
||||
* base/component.h. This fallback accommodates legacy components that lack the
|
||||
* implementation of this interface but come with a main function.
|
||||
*/
|
||||
|
||||
/*
|
||||
* XXX these symbols reside in the startup library - candidate for
|
||||
* base-internal header?
|
||||
*/
|
||||
extern char **genode_argv;
|
||||
extern int genode_argc;
|
||||
extern char **genode_envp;
|
||||
|
||||
extern int main(int argc, char **argv, char **envp);
|
||||
|
||||
void Component::construct(Genode::Env &env) __attribute__((weak));
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* call real main function */
|
||||
exit_status = main(genode_argc, genode_argv, genode_envp);
|
||||
|
||||
/* trigger suspend in the entry point */
|
||||
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
||||
|
||||
/* return to entrypoint and exit via exit_on_suspended() */
|
||||
}
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() __attribute__((weak));
|
||||
Genode::size_t Component::stack_size() { return 64*1024; }
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* \brief Component entry point for dynamic executables
|
||||
* \author Christian Helmuth
|
||||
* \date 2016-01-21
|
||||
*
|
||||
* The ELF entry point of dynamic binaries is set to component_entry_point(),
|
||||
* which calls the call_component_construct-hook function pointer.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
|
||||
|
||||
/* FIXME move to base-internal header */
|
||||
namespace Genode {
|
||||
extern void (*call_component_construct)(Env &);
|
||||
}
|
||||
|
||||
namespace Genode {
|
||||
|
||||
void component_entry_point(Genode::Env &env)
|
||||
{
|
||||
call_component_construct(env);
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <base/sleep.h>
|
||||
@ -254,4 +254,4 @@ struct Main
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Main server(env); }
|
||||
void Libc::Component::construct(Genode::Env &env) { static Main server(env); }
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-lxip_http_srv
|
||||
LIBS = libc libc_lxip
|
||||
LIBS = posix libc_lxip
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-lxip_udp_client
|
||||
LIBS = libc libc_lxip config
|
||||
LIBS = posix libc_lxip config
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-lxip_udp_echo
|
||||
LIBS = libc libc_lxip config
|
||||
LIBS = posix libc_lxip config
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = backdrop
|
||||
SRC_CC = main.cc
|
||||
LIBS = base config libc libpng zlib blit file
|
||||
LIBS = base config posix libpng zlib blit file
|
||||
|
@ -1,6 +1,6 @@
|
||||
TARGET = menu_view
|
||||
SRC_CC = main.cc
|
||||
LIBS = base config libc libpng zlib blit file
|
||||
LIBS = base config posix libpng zlib blit file
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
||||
.PHONY: menu_view_styles.tar
|
||||
|
@ -8,4 +8,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
main_window.o: main_window.moc
|
||||
|
||||
LIBS += config qoost
|
||||
LIBS += config qoost posix
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/component.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <os/reporter.h>
|
||||
@ -317,4 +317,4 @@ void Decorator::Main::_handle_pointer_update()
|
||||
}
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Decorator::Main main(env); }
|
||||
void Libc::Component::construct(Genode::Env &env) { static Decorator::Main main(env); }
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = file_terminal
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc
|
||||
LIBS = posix
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/log.h>
|
||||
#include <block/component.h>
|
||||
#include <libc/component.h>
|
||||
|
||||
/* local includes */
|
||||
#include "http.h"
|
||||
@ -106,4 +107,4 @@ struct Main
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Main m(env); }
|
||||
void Libc::Component::construct(Genode::Env &env) { static Main m(env); }
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = tcp_terminal
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libc_lwip_nic_dhcp libc_pipe
|
||||
LIBS = posix libc_lwip_nic_dhcp libc_pipe
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/component.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/session_label.h>
|
||||
#include <util/arg_string.h>
|
||||
@ -721,4 +721,4 @@ struct Main
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Main inst(env); }
|
||||
void Libc::Component::construct(Genode::Env &env) { static Main inst(env); }
|
||||
|
@ -1,6 +1,6 @@
|
||||
TARGET = test-decorator_stress
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libm
|
||||
LIBS = posix
|
||||
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
||||
|
48
repos/libports/include/libc/component.h
Normal file
48
repos/libports/include/libc/component.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* \brief Hook functions for bootstrapping a libc-using Genode component
|
||||
* \author Norman Feske
|
||||
* \date 2016-12-23
|
||||
*
|
||||
* This interface is implemented by components that use both Genode's API and
|
||||
* the libc. For such components, the libc provides the 'Component::construct'
|
||||
* function that takes the precautions needed for letting the application use
|
||||
* blocking I/O via POSIX functions like 'read' or 'select'. The libc's
|
||||
* 'Component::construct' function finally passes control to the application by
|
||||
* calling the application-provided 'Libc::Component::construct' function.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__LIBC__COMPONENT_H_
|
||||
#define _INCLUDE__LIBC__COMPONENT_H_
|
||||
|
||||
#include <base/env.h>
|
||||
#include <base/stdint.h>
|
||||
|
||||
namespace Genode { struct Env; }
|
||||
|
||||
|
||||
/**
|
||||
* Interface to be provided by the component implementation
|
||||
*/
|
||||
namespace Libc { namespace Component {
|
||||
|
||||
/**
|
||||
* Return stack size of the component's initial entrypoint
|
||||
*/
|
||||
Genode::size_t stack_size();
|
||||
|
||||
/**
|
||||
* Construct component
|
||||
*
|
||||
* \param env interface to the component's execution environment
|
||||
*/
|
||||
void construct(Genode::Env &env);
|
||||
} }
|
||||
|
||||
#endif /* _INCLUDE__LIBC__COMPONENT_H_ */
|
3
repos/libports/lib/import/import-posix.mk
Normal file
3
repos/libports/lib/import/import-posix.mk
Normal file
@ -0,0 +1,3 @@
|
||||
LIBS += libc libm
|
||||
|
||||
include $(call select_from_repositories,lib/import/import-libc.mk)
|
@ -105,7 +105,6 @@ include $(call select_from_repositories,lib/import/import-gallium.mk)
|
||||
|
||||
# custom main() thread stack size support via main() wrapper
|
||||
ifeq ($(findstring -DQT_MAIN_STACK_SIZE, $(CC_CXX_OPT)), -DQT_MAIN_STACK_SIZE)
|
||||
CC_CXX_OPT += -Dmain=qt_main
|
||||
SRC_CC += qt_main.cc
|
||||
vpath qt_main.cc $(QT5_REP_DIR)/src/lib/qt5
|
||||
endif
|
||||
|
5
repos/libports/lib/mk/posix.mk
Normal file
5
repos/libports/lib/mk/posix.mk
Normal file
@ -0,0 +1,5 @@
|
||||
SRC_CC = construct.cc
|
||||
|
||||
LIBS += libc
|
||||
|
||||
vpath construct.cc $(REP_DIR)/src/lib/posix
|
@ -100,7 +100,7 @@ install_config $config
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
test-libc_block
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ install_config $config
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer ffat_fs
|
||||
ld.lib.so libc.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
test-libc_vfs
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ install_config $config
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
}
|
||||
|
||||
append boot_modules test-libc_$filesystem
|
||||
|
@ -32,7 +32,7 @@ install_config {
|
||||
|
||||
build_boot_image {
|
||||
core init test-libc_pipe
|
||||
ld.lib.so libc.lib.so libc_pipe.lib.so pthread.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so libc_pipe.lib.so pthread.lib.so
|
||||
}
|
||||
|
||||
append qemu_args " -nographic -m 64 "
|
||||
|
@ -62,7 +62,7 @@ install_config $config
|
||||
|
||||
build_boot_image {
|
||||
core init
|
||||
ld.lib.so libc.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
ram_fs test-libc_vfs
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ install_config $config
|
||||
|
||||
build_boot_image {
|
||||
core init vfs
|
||||
ld.lib.so libc.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
test-libc_vfs
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ install_config $config
|
||||
|
||||
build_boot_image {
|
||||
core init
|
||||
ld.lib.so libc.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
test-libc_vfs
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ install_config $config
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
ld.lib.so libc.lib.so libm.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
}
|
||||
|
||||
# platform-specific modules
|
||||
|
@ -369,7 +369,7 @@ install_config $config
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
|
||||
core init timer nic_router nic_bridge ld.lib.so libc.lib.so
|
||||
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
||||
libc_resolv.lib.so lwip.lib.so lxip.lib.so test-http_clnt
|
||||
test-lwip_httpsrv_static test-lxip_udp_echo test-lxip_udp_client
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ install_config {
|
||||
|
||||
build_boot_image {
|
||||
core init test-pthread
|
||||
ld.lib.so libc.lib.so pthread.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so pthread.lib.so
|
||||
}
|
||||
|
||||
append qemu_args " -nographic -m 128 "
|
||||
|
@ -109,7 +109,7 @@ install_config $config
|
||||
set boot_modules {
|
||||
core init timer usb_drv test-smartcard
|
||||
ld.lib.so pcsc-lite.lib.so ccid.lib.so libusb.lib.so
|
||||
libc.lib.so libc_pipe.lib.so pthread.lib.so
|
||||
libc.lib.so libm.lib.so libc_pipe.lib.so pthread.lib.so
|
||||
Info.plist
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/component.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/log.h>
|
||||
#include <base/signal.h>
|
||||
#include <base/heap.h>
|
||||
@ -303,4 +303,4 @@ ACPI_STATUS AcpiOsInstallInterruptHandler(UINT32 irq, ACPI_OSD_HANDLER handler,
|
||||
}
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Acpica::Main main(env); }
|
||||
void Libc::Component::construct(Genode::Env &env) { static Acpica::Main main(env); }
|
||||
|
@ -3,7 +3,7 @@ include $(REP_DIR)/lib/import/import-av.inc
|
||||
TARGET = avplay
|
||||
SRC_C = avplay.c cmdutils.c libc_dummies.c
|
||||
LIBS += avfilter avformat avcodec avutil avresample swscale
|
||||
LIBS += sdl libc libm config_args
|
||||
LIBS += sdl posix config_args
|
||||
|
||||
CC_WARN += -Wno-parentheses -Wno-switch -Wno-uninitialized \
|
||||
-Wno-format-zero-length -Wno-pointer-sign
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = eglgears
|
||||
SRC_C = eglgears.c
|
||||
LIBS = libc libm gallium
|
||||
LIBS = posix gallium
|
||||
|
@ -2,7 +2,7 @@ MUPDF_DIR := $(call select_from_ports,mupdf)/src/lib/mupdf
|
||||
TARGET := mupdf
|
||||
SRC_C := pdfapp.c
|
||||
SRC_CC := main.cc
|
||||
LIBS := libc mupdf
|
||||
LIBS := posix mupdf
|
||||
INC_DIR += $(MUPDF_DIR)/apps
|
||||
|
||||
vpath pdfapp.c $(MUPDF_DIR)/apps
|
||||
|
@ -15,3 +15,5 @@ vpath % $(QMAKE_PROJECT_PATH)
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
|
@ -15,3 +15,5 @@ vpath % $(QMAKE_PROJECT_PATH)
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
|
@ -15,3 +15,5 @@ vpath % $(QMAKE_PROJECT_PATH)
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
|
@ -36,3 +36,5 @@ $(addprefix $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/, $(SAMEGAME3_RESOURCES)): $(
|
||||
|
||||
$(addprefix $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/shared/pics/, $(SAMEGAME_RESOURCES)): $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/shared/pics
|
||||
$(VERBOSE)ln -sf $(QT5_CONTRIB_DIR)/qtdeclarative/examples/quick/tutorials/samegame/shared/pics/$(notdir $@) $@
|
||||
|
||||
LIBS += posix
|
||||
|
@ -17,3 +17,5 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
CC_CXX_OPT += -DQT_NO_SCRIPTTOOLS
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
|
@ -16,3 +16,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
|
@ -18,8 +18,7 @@
|
||||
#include "main_window.h"
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/printf.h>
|
||||
#include <libc/component.h>
|
||||
|
||||
|
||||
static inline void load_stylesheet()
|
||||
@ -38,7 +37,7 @@ static inline void load_stylesheet()
|
||||
extern int genode_argc;
|
||||
extern char **genode_argv;
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
void Libc::Component::construct(Genode::Env &env)
|
||||
{
|
||||
QApplication app(genode_argc, genode_argv);
|
||||
|
||||
|
@ -27,3 +27,4 @@ $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/player_stop.png: $(BUILD_BASE_DIR)/bin/qt
|
||||
|
||||
$(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)/volume.png: $(BUILD_BASE_DIR)/bin/qt5_fs/$(TARGET)
|
||||
$(VERBOSE)ln -sf $(QT5_CONTRIB_DIR)/qtwebkit/Source/WebKit/efl/DefaultTheme/widget/mediacontrol/mutebutton/unmutebutton.png $@
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <QApplication>
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/env.h>
|
||||
|
||||
extern int genode_argc;
|
||||
@ -56,7 +56,8 @@ struct Qt_launchpad_namespace::Local_env : Genode::Env
|
||||
void close(Parent::Client::Id id) { return genode_env.close(id); }
|
||||
};
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
|
||||
void Libc::Component::construct(Genode::Env &env)
|
||||
{
|
||||
static Qt_launchpad_namespace::Local_env local_env(env);
|
||||
|
||||
|
@ -6,3 +6,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
||||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
|
@ -19,6 +19,9 @@
|
||||
#include <base/rpc_client.h>
|
||||
#include <base/heap.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <libc/component.h>
|
||||
|
||||
/* libc-internal includes */
|
||||
#include <internal/call_func.h>
|
||||
#include <base/internal/unmanaged_singleton.h>
|
||||
@ -41,12 +44,7 @@
|
||||
} while (0)
|
||||
|
||||
|
||||
namespace Libc {
|
||||
class Task;
|
||||
|
||||
void (*original_call_component_construct)(Genode::Env &);
|
||||
void call_component_construct(Genode::Env &env);
|
||||
}
|
||||
namespace Libc { class Task; }
|
||||
|
||||
|
||||
struct Task_resume
|
||||
@ -56,9 +54,6 @@ struct Task_resume
|
||||
};
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() {
|
||||
return 32UL * 1024 * sizeof(Genode::addr_t); }
|
||||
|
||||
/**
|
||||
* Libc task
|
||||
*
|
||||
@ -165,7 +160,7 @@ class Libc::Task : public Genode::Rpc_object<Task_resume, Libc::Task>
|
||||
|
||||
void Libc::Task::_app_entry(Task *task)
|
||||
{
|
||||
original_call_component_construct(task->_env);
|
||||
Libc::Component::construct(task->_env);
|
||||
|
||||
/* returned from task - switch stack to libc and return to dispatch loop */
|
||||
_longjmp(task->_libc_task, 1);
|
||||
@ -190,31 +185,37 @@ namespace Libc {
|
||||
|
||||
void schedule_suspend(void (*suspended) ())
|
||||
{
|
||||
if (!task) {
|
||||
error("libc task handling not initialized, needed for suspend");
|
||||
return;
|
||||
}
|
||||
task->schedule_suspend(suspended);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************
|
||||
** Component-startup hook **
|
||||
****************************/
|
||||
/***************************
|
||||
** Component entry point **
|
||||
***************************/
|
||||
|
||||
/* XXX needs base-internal header? */
|
||||
namespace Genode { extern void (*call_component_construct)(Genode::Env &); }
|
||||
Genode::size_t Component::stack_size() { return Libc::Component::stack_size(); }
|
||||
|
||||
void Libc::call_component_construct(Genode::Env &env)
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* pass Genode::Env to libc subsystems that depend on it */
|
||||
init_dl(env);
|
||||
Libc::init_dl(env);
|
||||
|
||||
task = unmanaged_singleton<Libc::Task>(env);
|
||||
task->run();
|
||||
}
|
||||
|
||||
|
||||
static void __attribute__((constructor)) libc_task_constructor(void)
|
||||
{
|
||||
/* hook into component startup */
|
||||
Libc::original_call_component_construct = Genode::call_component_construct;
|
||||
Genode::call_component_construct = &Libc::call_component_construct;
|
||||
}
|
||||
/**
|
||||
* Default stack size for libc-using components
|
||||
*/
|
||||
Genode::size_t Libc::Component::stack_size() __attribute__((weak));
|
||||
Genode::size_t Libc::Component::stack_size() {
|
||||
return 32UL * 1024 * sizeof(Genode::addr_t); }
|
||||
|
||||
|
||||
|
32
repos/libports/src/lib/posix/construct.cc
Normal file
32
repos/libports/src/lib/posix/construct.cc
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* \brief Entry point for POSIX applications
|
||||
* \author Norman Feske
|
||||
* \date 2016-12-23
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <libc/component.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <stdlib.h> /* for 'exit' */
|
||||
|
||||
extern char **genode_argv;
|
||||
extern int genode_argc;
|
||||
extern char **genode_envp;
|
||||
|
||||
|
||||
/* provided by the application */
|
||||
extern "C" int main(int argc, char ** argv, char **envp);
|
||||
|
||||
|
||||
void Libc::Component::construct(Genode::Env &env)
|
||||
{
|
||||
exit(main(genode_argc, genode_argv, genode_envp));
|
||||
}
|
@ -13,19 +13,8 @@
|
||||
|
||||
#ifdef QT_MAIN_STACK_SIZE
|
||||
|
||||
#include <base/thread.h>
|
||||
#include <libc/component.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
extern int qt_main(int argc, char *argv[]);
|
||||
|
||||
#define qt_main main
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Genode::Thread::myself()->stack_size(QT_MAIN_STACK_SIZE);
|
||||
|
||||
return qt_main(argc, argv);
|
||||
}
|
||||
Genode::size_t Libc::Component::stack_size() { return QT_MAIN_STACK_SIZE; }
|
||||
|
||||
#endif /* QT_MAIN_STACK_SIZE */
|
||||
|
@ -6,7 +6,7 @@ SRC_C = $(notdir $(EXFAT_DIR)/fuse/main.c)
|
||||
SRC_CC = fuse_fs_main.cc \
|
||||
init.cc
|
||||
|
||||
LIBS = base config server libc libfuse libexfat
|
||||
LIBS = config libc libfuse libexfat
|
||||
INC_DIR += $(PRG_DIR)/..
|
||||
|
||||
CC_OPT += -Wno-unused-function
|
||||
|
@ -9,7 +9,7 @@ SRC_C = $(filter-out $(FILTER_OUT), $(notdir $(wildcard $(FUSE_EXT2_DIR)/*.c)))
|
||||
SRC_CC = fuse_fs_main.cc \
|
||||
init.cc
|
||||
|
||||
LIBS = base config server libc libfuse libext2fs
|
||||
LIBS = config libc libfuse libext2fs
|
||||
|
||||
CC_OPT += -DHAVE_CONFIG_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
|
||||
|
@ -17,10 +17,10 @@
|
||||
#include <file_system_session/rpc_object.h>
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <os/config.h>
|
||||
#include <os/server.h>
|
||||
#include <os/session_policy.h>
|
||||
#include <root/component.h>
|
||||
#include <util/xml_node.h>
|
||||
#include <libc/component.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <errno.h>
|
||||
@ -41,13 +41,13 @@ class File_system::Session_component : public Session_rpc_object
|
||||
{
|
||||
private:
|
||||
|
||||
Server::Entrypoint &_ep;
|
||||
Genode::Entrypoint &_ep;
|
||||
Allocator &_md_alloc;
|
||||
Directory &_root;
|
||||
Node_handle_registry _handle_registry;
|
||||
bool _writeable;
|
||||
|
||||
Signal_rpc_member<Session_component> _process_packet_dispatcher;
|
||||
Signal_handler<Session_component> _process_packet_handler;
|
||||
|
||||
|
||||
/******************************
|
||||
@ -115,10 +115,10 @@ class File_system::Session_component : public Session_rpc_object
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by signal dispatcher, executed in the context of the main
|
||||
* Called by signal handler, executed in the context of the main
|
||||
* thread (not serialized with the RPC functions)
|
||||
*/
|
||||
void _process_packets(unsigned)
|
||||
void _process_packets()
|
||||
{
|
||||
while (tx_sink()->packet_avail()) {
|
||||
|
||||
@ -158,7 +158,7 @@ class File_system::Session_component : public Session_rpc_object
|
||||
* Constructor
|
||||
*/
|
||||
Session_component(size_t tx_buf_size,
|
||||
Server::Entrypoint &ep,
|
||||
Genode::Entrypoint &ep,
|
||||
char const *root_dir,
|
||||
bool writeable,
|
||||
Allocator &md_alloc)
|
||||
@ -168,10 +168,10 @@ class File_system::Session_component : public Session_rpc_object
|
||||
_md_alloc(md_alloc),
|
||||
_root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)),
|
||||
_writeable(writeable),
|
||||
_process_packet_dispatcher(_ep, *this, &Session_component::_process_packets)
|
||||
_process_packet_handler(_ep, *this, &Session_component::_process_packets)
|
||||
{
|
||||
_tx.sigh_packet_avail(_process_packet_dispatcher);
|
||||
_tx.sigh_ready_to_ack(_process_packet_dispatcher);
|
||||
_tx.sigh_packet_avail(_process_packet_handler);
|
||||
_tx.sigh_ready_to_ack(_process_packet_handler);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -408,7 +408,7 @@ class File_system::Root : public Root_component<Session_component>
|
||||
{
|
||||
private:
|
||||
|
||||
Server::Entrypoint &_ep;
|
||||
Genode::Entrypoint &_ep;
|
||||
|
||||
protected:
|
||||
|
||||
@ -501,7 +501,7 @@ class File_system::Root : public Root_component<Session_component>
|
||||
* data-flow signals of packet streams
|
||||
* \param md_alloc meta-data allocator
|
||||
*/
|
||||
Root(Server::Entrypoint &ep, Allocator &md_alloc)
|
||||
Root(Genode::Entrypoint &ep, Allocator &md_alloc)
|
||||
:
|
||||
Root_component<Session_component>(&ep.rpc_ep(), &md_alloc),
|
||||
_ep(ep)
|
||||
@ -511,7 +511,7 @@ class File_system::Root : public Root_component<Session_component>
|
||||
|
||||
struct File_system::Main
|
||||
{
|
||||
Server::Entrypoint &ep;
|
||||
Genode::Entrypoint &ep;
|
||||
|
||||
/*
|
||||
* Initialize root interface
|
||||
@ -520,7 +520,7 @@ struct File_system::Main
|
||||
|
||||
Root fs_root = { ep, sliced_heap };
|
||||
|
||||
Main(Server::Entrypoint &ep) : ep(ep)
|
||||
Main(Genode::Entrypoint &ep) : ep(ep)
|
||||
{
|
||||
if (!Fuse::init_fs()) {
|
||||
Genode::error("FUSE fs initialization failed");
|
||||
@ -539,10 +539,12 @@ struct File_system::Main
|
||||
};
|
||||
|
||||
|
||||
/**********************
|
||||
** Server framework **
|
||||
**********************/
|
||||
/***************
|
||||
** Component **
|
||||
***************/
|
||||
|
||||
void Libc::Component::construct(Genode::Env &env)
|
||||
{
|
||||
static File_system::Main inst(env.ep());
|
||||
}
|
||||
|
||||
char const * Server::name() { return "fuse_fs_ep"; }
|
||||
Genode::size_t Server::stack_size() { return 16*1024*sizeof(long); }
|
||||
void Server::construct(Server::Entrypoint &ep) { static File_system::Main inst(ep); }
|
||||
|
@ -6,7 +6,7 @@ SRC_C := ntfs-3g.c ntfs-3g_common.c
|
||||
SRC_CC := fuse_fs_main.cc \
|
||||
init.cc
|
||||
|
||||
LIBS := base config server libc libfuse libntfs-3g
|
||||
LIBS := config libc libfuse libntfs-3g
|
||||
|
||||
CC_OPT := -DHAVE_TIMESPEC -DHAVE_CONFIG_H -DRECORD_LOCKING_NOT_IMPLEMENTED
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-expat
|
||||
SRC_CC = main.cc
|
||||
LIBS = expat libc
|
||||
LIBS = expat posix
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <rom_session/connection.h>
|
||||
#include <base/env.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/component.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/shared_object.h>
|
||||
|
||||
using namespace Genode;
|
||||
@ -185,7 +185,7 @@ static void test_shared_object_api(Env &env, Allocator &alloc)
|
||||
/**
|
||||
* Main function of LDSO test
|
||||
*/
|
||||
void Component::construct(Genode::Env &env)
|
||||
void Libc::Component::construct(Genode::Env &env)
|
||||
{
|
||||
static Heap heap(env.ram(), env.rm());
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-libc
|
||||
SRC_CC = main.cc
|
||||
LIBS = libm libc
|
||||
LIBS = posix
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-libc_block
|
||||
LIBS = libc
|
||||
LIBS = posix
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-libc_ffat
|
||||
LIBS = libc libc_ffat
|
||||
LIBS = posix libc_ffat
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-libc_pipe
|
||||
LIBS = libc libc_pipe pthread
|
||||
LIBS = posix libc_pipe pthread
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-libc_resolv
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libc_resolv
|
||||
LIBS = posix libc_resolv
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-libc_vfs
|
||||
LIBS = libc
|
||||
LIBS = posix
|
||||
SRC_CC = main.cc
|
||||
|
||||
# we re-use the libc_ffat test
|
||||
|
@ -11,4 +11,6 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
int main() { }
|
||||
#include <libc/component.h>
|
||||
|
||||
void Libc::Component::construct(Genode::Env &) { }
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-http_clnt
|
||||
LIBS = lwip libc
|
||||
LIBS = lwip posix
|
||||
SRC_CC = main.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-lwip_httpsrv
|
||||
LIBS = lwip libc
|
||||
LIBS = lwip posix
|
||||
SRC_CC = main.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-lwip_httpsrv_static
|
||||
LIBS = lwip libc config
|
||||
LIBS = lwip posix config
|
||||
SRC_CC = main.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-lwip_loop
|
||||
LIBS = lwip libc libc_lwip_loopback
|
||||
LIBS = lwip posix libc_lwip_loopback
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-ping_client_libc_lwip
|
||||
LIBS = base libc lwip libc_lwip_nic_dhcp config_args
|
||||
LIBS = posix lwip libc_lwip_nic_dhcp config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-ping_client_lwip
|
||||
LIBS = base libc lwip config_args
|
||||
LIBS = posix lwip config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-ping_server_libc_lwip
|
||||
LIBS = base libc libc_lwip_nic_dhcp libc_lwip lwip config_args
|
||||
LIBS = posix libc_lwip_nic_dhcp libc_lwip lwip config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-ping_server_lwip
|
||||
LIBS = base libc lwip config_args
|
||||
LIBS = posix lwip config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
CC_OPT += -DLWIP_NATIVE
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-moon
|
||||
LIBS = luacxx libc libm
|
||||
LIBS = luacxx posix
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-pthread
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc pthread
|
||||
LIBS = posix pthread
|
||||
|
@ -1,4 +1,4 @@
|
||||
TARGET = test-python
|
||||
LIBS = python libc libm
|
||||
LIBS = python posix
|
||||
REQUIRES = x86
|
||||
SRC_CC = main.cc
|
||||
|
@ -15,3 +15,5 @@ test-plugin.tar: config.plugin
|
||||
|
||||
clean:
|
||||
$(VERBOSE)rm test-plugin.tar
|
||||
|
||||
LIBS += posix
|
||||
|
@ -1,4 +1,5 @@
|
||||
TARGET = test-rust
|
||||
SRC_RS = main.rs
|
||||
SRC_CC = printf.cc
|
||||
LIBS = libcore-rust libcollections-rust base librustc_unicode-rust liballoc-rust liblibc-rust liballoc_system-rust
|
||||
LIBS = libcore-rust libcollections-rust base librustc_unicode-rust \
|
||||
liballoc-rust liblibc-rust liballoc_system-rust posix
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-sdl
|
||||
LIBS = sdl libc
|
||||
LIBS = sdl posix
|
||||
SRC_CC = main.cc
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = test-smartcard
|
||||
LIBS = pcsc-lite libc
|
||||
LIBS = pcsc-lite posix
|
||||
SRC_CC = main.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-stdcxx
|
||||
SRC_CC = main.cc
|
||||
LIBS = base stdcxx
|
||||
LIBS = posix stdcxx
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <block_session/connection.h>
|
||||
#include <os/server.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <libc/component.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -153,13 +154,7 @@ struct Test::Main
|
||||
};
|
||||
|
||||
|
||||
namespace Server {
|
||||
|
||||
char const *name() { return "block_bench_ep"; };
|
||||
Genode::size_t stack_size() { return 16*1024*sizeof(long); }
|
||||
|
||||
void construct(Entrypoint &ep)
|
||||
{
|
||||
static Test::Main server(ep);
|
||||
}
|
||||
void Libc::Component::construct(Genode::Env &env)
|
||||
{
|
||||
static Test::Main server(env.ep());
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = test-blk-bench
|
||||
SRC_CC = main.cc
|
||||
LIBS = base server libc
|
||||
LIBS = base libc
|
||||
|
@ -30,7 +30,7 @@
|
||||
TARGET ?= $(lastword $(subst /, ,$(PRG_DIR)))
|
||||
PKG ?= $(TARGET)
|
||||
|
||||
LIBS += libc libm
|
||||
LIBS += posix
|
||||
|
||||
PWD = $(shell pwd)
|
||||
|
||||
@ -107,18 +107,9 @@ CXXFLAGS += $(COMMON_CFLAGS_CXXFLAGS)
|
||||
# Unfortunately, the use of '--start-group' and '--end-group' does not suffice
|
||||
# in all cases because 'libtool' strips those arguments from the 'LIBS' variable.
|
||||
#
|
||||
# Furthermore, 'libtool' reorders library names on the command line in a way that
|
||||
# shared libraries appear before static libraries. This has the unfortunate effect
|
||||
# that the program's entry symbol 'Genode::component_entry_point' in the static
|
||||
# library 'component_entry_point.lib.a' is not found anymore. Passing the static
|
||||
# library names as linker arguments (-Wl,...) works around this problem, because
|
||||
# 'libtool' keeps command line arguments before the shared library names.
|
||||
#
|
||||
|
||||
LDLIBS_A = $(filter %.a, $(sort $(LINK_ITEMS)) $(EXT_OBJECTS) $(LIBGCC))
|
||||
LDLIBS_SO = $(filter %.so,$(sort $(LINK_ITEMS)) $(EXT_OBJECTS) $(LIBGCC))
|
||||
comma := ,
|
||||
LDLIBS += $(addprefix -Wl$(comma),$(LDLIBS_A)) $(LDLIBS_SO) $(LDLIBS_A)
|
||||
LDLIBS += $(LDLIBS_A) $(LDLIBS_SO) $(LDLIBS_A)
|
||||
|
||||
#
|
||||
# Re-configure the Makefile if the Genode build environment changes
|
||||
|
@ -84,3 +84,5 @@ vpath % $(ARORA_PORT_DIR)/src/app/arora/src/useragent
|
||||
vpath % $(ARORA_PORT_DIR)/src/app/arora/src/utils
|
||||
|
||||
-include $(QT_TMPL_DIR)/target_final.inc
|
||||
|
||||
LIBS += posix
|
||||
|
@ -53,5 +53,5 @@ CC_WARN += -Wno-unused-variable -Wno-unused-function -Wno-switch -Wno-unused-val
|
||||
-Wno-sign-compare -Wno-narrowing -Wno-missing-braces -Wno-array-bounds \
|
||||
-Wno-parentheses
|
||||
|
||||
LIBS += libc libm libpng sdl sdl_net stdcxx zlib
|
||||
LIBS += posix libpng sdl sdl_net stdcxx zlib
|
||||
LIBS += libc_lwip_nic_dhcp config_args
|
||||
|
@ -11,7 +11,7 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#include <base/component.h>
|
||||
#include <libc/component.h>
|
||||
|
||||
/*
|
||||
* Suppress messages of libc dummy functions
|
||||
@ -33,7 +33,7 @@ extern "C" int gdbserver_main(int argc, const char *argv[]);
|
||||
|
||||
extern Genode::Env *genode_env;
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
void Libc::Component::construct(Genode::Env &env)
|
||||
{
|
||||
genode_env = &env;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user