[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [mini-os master] Mini-OS: explicitly mark symbols to be visible for apps
commit 584b8565b6b2c427526dd22f89d8bf77452dcd0b Author: Juergen Gross <jgross@xxxxxxxx> AuthorDate: Mon Nov 27 11:24:53 2023 +0100 Commit: Julien Grall <jgrall@xxxxxxxxxx> CommitDate: Mon Dec 4 16:52:57 2023 +0000 Mini-OS: explicitly mark symbols to be visible for apps Add an EXPORT_SYMBOL() macro to explicitly mark a symbol to be visible for an app or library linked with Mini-OS. This prepares hiding all other symbols from external components, avoiding any problems with duplicate symbol names. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> --- .gitignore | 1 + Makefile | 3 ++- include/export.h | 10 ++++++++++ include/lib.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index abef46b..bacf787 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ mini-os.gz minios-config.mk mini-os-debug mini-os-debug.gz +syms diff --git a/Makefile b/Makefile index 85c6db7..588496c 100644 --- a/Makefile +++ b/Makefile @@ -166,10 +166,11 @@ $(OBJ_DIR)/arch/x86/minios-x86%.lds: arch/x86/minios-x86.lds.S $(OBJ_DIR)/$(TARGET)-kern.o: $(OBJS) arch_lib $(OBJ_DIR)/$(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) -o $@ + $(OBJCOPY) --dump-section .export_symbol=$(OBJ_DIR)/syms $@ $(OBJ_DIR)/$(TARGET): $(OBJ_DIR)/$(TARGET)-kern.o $(APP_O) $(LD) -r $(LDFLAGS) $(OBJ_DIR)/$(TARGET)-kern.o $(APP_O) $(LDLIBS) -o $@.o - $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o + $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start --remove-section=.export_symbol $@.o $@.o $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@-debug strip -s $@-debug -o $@ gzip -n -f -9 -c $@-debug >$@-debug.gz diff --git a/include/export.h b/include/export.h new file mode 100644 index 0000000..7140ac6 --- /dev/null +++ b/include/export.h @@ -0,0 +1,10 @@ +#ifndef _EXPORT_H_ +#define _EXPORT_H_ + +/* Mark a symbol to be visible for apps and libs. */ +#define EXPORT_SYMBOL(sym) \ + asm(".section .export_symbol\n" \ + ".ascii \""#sym"\\n\"\n" \ + ".previous\n") + +#endif /* _EXPORT_H_ */ diff --git a/include/lib.h b/include/lib.h index dd68985..abd4e9a 100644 --- a/include/lib.h +++ b/include/lib.h @@ -53,6 +53,7 @@ #include <stddef.h> #include <xen/xen.h> #include <xen/event_channel.h> +#include <mini-os/export.h> #include "gntmap.h" #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) -- generated by git-patchbot for /home/xen/git/mini-os.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |