[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 2/3] build: isolate symbols inside libraries



The aim is to avoid symbol name conflicts between different
libraries.

Every lib have to have a file 'export.syms', which is simply a flat
file, with one symbol name per line. All symbols not listed there will
become local to the library.

Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 lib/nolibc/export.syms        | 43 +++++++++++++++++++++++++++++++++++
 lib/ukalloc/export.syms       |  8 +++++++
 lib/ukallocbbuddy/export.syms |  1 +
 lib/ukargparse/export.syms    |  1 +
 lib/ukboot/export.syms        |  2 ++
 lib/ukdebug/export.syms       |  3 +++
 lib/uksched/export.syms       | 11 +++++++++
 lib/ukschedcoop/export.syms   |  3 +++
 lib/uktimeconv/export.syms    |  3 +++
 plat/kvm/export.syms          | 22 ++++++++++++++++++
 plat/xen/export.syms          | 22 ++++++++++++++++++
 support/build/Makefile.rules  |  7 ++++--
 12 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 lib/nolibc/export.syms
 create mode 100644 lib/ukalloc/export.syms
 create mode 100644 lib/ukallocbbuddy/export.syms
 create mode 100644 lib/ukargparse/export.syms
 create mode 100644 lib/ukboot/export.syms
 create mode 100644 lib/ukdebug/export.syms
 create mode 100644 lib/uksched/export.syms
 create mode 100644 lib/ukschedcoop/export.syms
 create mode 100644 lib/uktimeconv/export.syms
 create mode 100644 plat/kvm/export.syms
 create mode 100644 plat/xen/export.syms

diff --git a/lib/nolibc/export.syms b/lib/nolibc/export.syms
new file mode 100644
index 0000000..afe42b2
--- /dev/null
+++ b/lib/nolibc/export.syms
@@ -0,0 +1,43 @@
+_nolibc_errno
+getopt_long
+getopt_long_only
+getopt
+optarg
+optind
+opterr
+optopt
+stdin
+stdout
+stderr
+snprintf
+printf
+vsnprintf
+vfprintf
+fprintf
+fflush
+strtoul
+strtoll
+strtoull
+atoi
+malloc
+free
+calloc
+realloc
+posix_memalign
+memalign
+memcpy
+memset
+memchr
+memcmp
+memmove
+strncpy
+strcpy
+strnlen
+strlen
+strchr
+strncmp
+strcmp
+close
+write
+read
+gettimeofday
diff --git a/lib/ukalloc/export.syms b/lib/ukalloc/export.syms
new file mode 100644
index 0000000..66a9948
--- /dev/null
+++ b/lib/ukalloc/export.syms
@@ -0,0 +1,8 @@
+uk_alloc_get_default
+uk_malloc_ifpages
+uk_calloc_compat
+uk_realloc_ifpages
+uk_posix_memalign_ifpages
+uk_memalign_compat
+uk_free_ifpages
+uk_alloc_register
diff --git a/lib/ukallocbbuddy/export.syms b/lib/ukallocbbuddy/export.syms
new file mode 100644
index 0000000..6c871e3
--- /dev/null
+++ b/lib/ukallocbbuddy/export.syms
@@ -0,0 +1 @@
+uk_allocbbuddy_init
diff --git a/lib/ukargparse/export.syms b/lib/ukargparse/export.syms
new file mode 100644
index 0000000..8995cb1
--- /dev/null
+++ b/lib/ukargparse/export.syms
@@ -0,0 +1 @@
+uk_argnparse
diff --git a/lib/ukboot/export.syms b/lib/ukboot/export.syms
new file mode 100644
index 0000000..08b8999
--- /dev/null
+++ b/lib/ukboot/export.syms
@@ -0,0 +1,2 @@
+ukplat_entry_argp
+main
diff --git a/lib/ukdebug/export.syms b/lib/ukdebug/export.syms
new file mode 100644
index 0000000..4f8faba
--- /dev/null
+++ b/lib/ukdebug/export.syms
@@ -0,0 +1,3 @@
+_uk_printd
+_uk_printk
+uk_printk
diff --git a/lib/uksched/export.syms b/lib/uksched/export.syms
new file mode 100644
index 0000000..c3e0aa4
--- /dev/null
+++ b/lib/uksched/export.syms
@@ -0,0 +1,11 @@
+uk_sched_thread_create
+uk_sched_start
+uk_sched_thread_exit
+uk_thread_fini
+uk_thread_wake
+uk_sched_default_init
+uk_sched_get_default
+uk_sched_thread_destroy
+uk_thread_block
+uk_sched_idle_init
+uk_sched_register
diff --git a/lib/ukschedcoop/export.syms b/lib/ukschedcoop/export.syms
new file mode 100644
index 0000000..8895f9e
--- /dev/null
+++ b/lib/ukschedcoop/export.syms
@@ -0,0 +1,3 @@
+uk_schedcoop_init
+schedcoop_schedule
+ukplat_thread_ctx_destroy
diff --git a/lib/uktimeconv/export.syms b/lib/uktimeconv/export.syms
new file mode 100644
index 0000000..c882c20
--- /dev/null
+++ b/lib/uktimeconv/export.syms
@@ -0,0 +1,3 @@
+uktimeconv_is_leap_year
+uktimeconv_days_in_month
+uktimeconv_bmkclock_to_nsec
diff --git a/plat/kvm/export.syms b/plat/kvm/export.syms
new file mode 100644
index 0000000..ee1711b
--- /dev/null
+++ b/plat/kvm/export.syms
@@ -0,0 +1,22 @@
+# common
+ukplat_memallocator_set
+ukplat_thread_ctx_destroy
+ukplat_lcpu_halt_to
+ukplat_ctx_callbacks_init
+
+# kvm
+_libkvmplat_entry
+ukplat_terminate
+ukplat_virt_to_phys
+ukplat_memregion_count
+ukplat_memregion_get
+ukplat_irq_init
+ukplat_monotonic_clock
+ukplat_time_init
+ukplat_coutd
+ukplat_coutk
+ukplat_lcpu_save_irqf
+ukplat_lcpu_restore_irqf
+ukplat_lcpu_irqs_disabled
+ukplat_lcpu_irqs_handle_pending
+ukplat_lcpu_enable_irq
diff --git a/plat/xen/export.syms b/plat/xen/export.syms
new file mode 100644
index 0000000..15e70b0
--- /dev/null
+++ b/plat/xen/export.syms
@@ -0,0 +1,22 @@
+# common
+ukplat_memallocator_set
+ukplat_ctx_callbacks_init
+ukplat_thread_ctx_destroy
+
+# xen
+_libxenplat_start
+_libxenplat_x86entry
+ukplat_coutk
+ukplat_coutd
+ukplat_time_init
+ukplat_memregion_count
+ukplat_memregion_get
+ukplat_irq_init
+ukplat_terminate
+ukplat_lcpu_enable_irq
+ukplat_monotonic_clock
+ukplat_lcpu_save_irqf
+ukplat_lcpu_restore_irqf
+ukplat_lcpu_irqs_disabled
+ukplat_lcpu_halt_to
+ukplat_lcpu_irqs_handle_pending
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index e317e3d..844cb4b 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -49,6 +49,8 @@ libname2olib = $(addprefix $(BUILD_DIR)/,$(addsuffix .o,$(1)))
 
 libname2preolib = $(addprefix $(BUILD_DIR)/,$(addsuffix .ld.o,$(1)))
 
+libname2exports = $($(call vprefix_lib,$1,BASE))/export.syms
+
 # converts a list of sources to paths pointing to their corresponding object 
file
 # src2obj $libname,$source(s),$variant(optional)
 define src2obj =
@@ -419,11 +421,12 @@ $(call libname2preolib,$(1)): $($(call 
vprefix_lib,$(1),OBJS)) $($(call vprefix_
                      $($(call vprefix_lib,$(1),OBJS)) $($(call 
vprefix_lib,$(1),OBJS-y)) \
                      -o $(call libname2preolib,$(1)))
 
-$(call libname2olib,$(1)): $(call libname2preolib,$(1))
+$(call libname2olib,$(1)): $(call libname2preolib,$(1)) $(call 
libname2exports,$1)
        $(call build_cmd,OBJCOPY,,$(call libname2olib,$(1)),\
                $(OBJCOPY) $(OBJCFLAGS) $(OBJCFLAGS-y) \
                           $($(call vprefix_lib,$(1),OBJCFLAGS)) $($(call 
vprefix_lib,$(1),OBJCFLAGS-y)) \
-                          $(call libname2preolib,$(1)) $(call 
libname2olib,$(1)))
+                          $(call libname2preolib,$(1)) $(call 
libname2olib,$(1))) \
+                          --keep-global-symbols=$(call libname2exports,$1)
 
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(call 
libname2preolib,$(1))))
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(call 
libname2olib,$(1))))
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.