Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LIB.patch 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. commit b7d219220e10699dedb2c90e2d4010cbfab74a86
  2. Author: Emery Hemingway <ehmry@posteo.net>
  3. Date: Sun Aug 30 10:47:51 2020 +0200
  4. Produce libraries with conventional names
  5. diff --git a/repos/base/mk/dep_lib.mk b/repos/base/mk/dep_lib.mk
  6. index 21fcb77e58..533aebffa3 100644
  7. --- a/repos/base/mk/dep_lib.mk
  8. +++ b/repos/base/mk/dep_lib.mk
  9. @@ -142,8 +142,8 @@ endif
  10. echo " DEBUG_DIR=\$$(DEBUG_DIR)"; \
  11. echo "") >> $(LIB_DEP_FILE)
  12. ifdef SHARED_LIB
  13. - @(echo "SO_NAME($(LIB)) := $(LIB).lib.so"; \
  14. - echo "") >> $(LIB_DEP_FILE)
  15. + @(echo "SO_NAME($(LIB)) := lib$(LIB).so"; \
  16. + echo "") | sed -e 's/libld.so/ld.lib.so/' -e 's/liblib/lib/' >> $(LIB_DEP_FILE)
  17. else
  18. @(echo "ARCHIVE_NAME($(LIB)) := $(LIB).lib.a"; \
  19. echo "") >> $(LIB_DEP_FILE)
  20. diff --git a/repos/base/mk/dep_prg.mk b/repos/base/mk/dep_prg.mk
  21. index 190dd92aa1..6611d05d2a 100644
  22. --- a/repos/base/mk/dep_prg.mk
  23. +++ b/repos/base/mk/dep_prg.mk
  24. @@ -93,7 +93,7 @@ endif
  25. # if the target does not depend on any library with unsatisfied build
  26. # requirements. In such a case, the target cannot be linked anyway.
  27. #
  28. - @(echo "ifeq (\$$(filter \$$(DEP_A_$(TARGET).prg:.lib.a=) \$$(DEP_SO_$(TARGET).prg:.lib.so=) $(LIBS),\$$(INVALID_DEPS)),)"; \
  29. + @(echo "ifeq (\$$(filter \$$(DEP_A_$(TARGET).prg:.lib.a=) \$$(patsubst lib%.lib.so,%,$(DEP_SO_$(TARGET).prg)) $(LIBS),\$$(INVALID_DEPS)),)"; \
  30. echo "all: $(TARGET).prg"; \
  31. echo "endif") >> $(LIB_DEP_FILE)
  32. #
  33. diff --git a/repos/base/mk/generic.mk b/repos/base/mk/generic.mk
  34. index 0531c08d58..4eefc6822c 100644
  35. --- a/repos/base/mk/generic.mk
  36. +++ b/repos/base/mk/generic.mk
  37. @@ -139,7 +139,7 @@ binary_%.o: %
  38. # This is a problem in situations where the undefined symbol is resolved by an
  39. # archive rather than the target. I.e., when linking posix.lib.a (which
  40. # provides 'Libc::Component::construct'), the 'construct' function is merely
  41. -# referenced by the libc.lib.so's 'Component::construct' function. But this
  42. +# referenced by the libc.so's 'Component::construct' function. But this
  43. # reference apparently does not suffice to keep the posix.lib.a's symbol. By
  44. # adding a hard dependency, we force the linker to resolve the symbol and don't
  45. # drop posix.lib.a.
  46. @@ -174,12 +174,17 @@ endif
  47. # time a user of the library is linked, the ABI stub should be used instead of
  48. # the library.
  49. #
  50. -select_so = $(firstword $(wildcard $(LIB_CACHE_DIR)/$(1:.lib.so=)/$(1:.lib.so=).abi.so \
  51. - $(LIB_CACHE_DIR)/$(1:.lib.so=)/$(1:.lib.so=).lib.so))
  52. +select_so = $(firstword $(wildcard \
  53. + $(LIB_CACHE_DIR)/$(patsubst lib%.so,%,$1)/$(patsubst lib%.so,%,$1).abi.so \
  54. + $(LIB_CACHE_DIR)/$(patsubst lib%.so,%,$1)/$(1) \
  55. + $(LIB_CACHE_DIR)/$(patsubst %.so,%,$1)/$(1) \
  56. + $(LIB_CACHE_DIR)/$(1:.lib.so=)/$(1:.lib.so=).abi.so \
  57. + $(LIB_CACHE_DIR)/$(1:.lib.so=)/$(1:.lib.so=).lib.so \
  58. + $(LIB_CACHE_DIR)/$(1:.so=)/$(1:.so=).abi.so ))
  59. ifneq ($(filter-out $(foreach s,$(SHARED_LIBS),$(realpath $s)), \
  60. $(foreach s,$(SHARED_LIBS),$(call select_so,$s))),)
  61. .PHONY: $(SHARED_LIBS)
  62. endif
  63. $(SHARED_LIBS):
  64. - $(VERBOSE)ln -sf $(call select_so,$@) $@
  65. + $(VERBOSE)ln -sf $(call select_so,$@) $(patsubst liblib%,lib%,$@)
  66. diff --git a/repos/base/mk/lib.mk b/repos/base/mk/lib.mk
  67. index c8ac049563..776aea82aa 100644
  68. --- a/repos/base/mk/lib.mk
  69. +++ b/repos/base/mk/lib.mk
  70. @@ -95,7 +95,12 @@ endif
  71. #
  72. ifneq ($(SYMBOLS),)
  73. ABI_SO := $(addsuffix .abi.so,$(LIB))
  74. +ifeq ($(LIB),ld)
  75. ABI_SONAME := $(addsuffix .lib.so,$(LIB))
  76. +else
  77. +ABI_SONAME := $(addsuffix .so,$(addprefix lib,$(patsubst lib%,%,$(LIB))))
  78. +endif
  79. +
  80. $(LIB).symbols:
  81. $(VERBOSE)ln -sf $(SYMBOLS) $@
  82. @@ -124,14 +129,20 @@ message:
  83. include $(BASE_DIR)/mk/generic.mk
  84. #
  85. -# Name of <libname>.lib.a or <libname>.lib.so file to create
  86. +# Name of <libname>.lib.a or lib<libname>.so file to create
  87. #
  88. # Skip the creation and installation of an .so file if there are no
  89. # ingredients. This is the case if the library is present as ABI only.
  90. #
  91. ifdef SHARED_LIB
  92. ifneq ($(sort $(OBJECTS) $(LIBS)),)
  93. - LIB_SO := $(addsuffix .lib.so,$(LIB))
  94. + ifeq ($(LIB),ld)
  95. + LIB_SO := ld.lib.so
  96. + else ifeq ($(patsubst ld-%,ld-,$(LIB)),ld-)
  97. + LIB_SO := $(LIB).lib.so
  98. + else
  99. + LIB_SO := $(patsubst liblib%,lib%,$(patsubst %,lib%.so,$(LIB)))
  100. + endif
  101. INSTALL_SO := $(INSTALL_DIR)/$(LIB_SO)
  102. DEBUG_SO := $(DEBUG_DIR)/$(LIB_SO)
  103. endif
  104. @@ -151,7 +162,7 @@ ifneq ($(LIB_SO),)
  105. endif
  106. #
  107. -# Trigger the creation of the <libname>.lib.a or <libname>.lib.so file
  108. +# Trigger the creation of the <libname>.lib.a or lib<libname>.so file
  109. #
  110. LIB_TAG := $(addsuffix .lib.tag,$(LIB))
  111. all: $(LIB_TAG)
  112. @@ -204,7 +215,7 @@ STATIC_LIBS := $(sort $(foreach l,$(ARCHIVES:.lib.a=),$(LIB_CACHE_DIR)/$l/
  113. STATIC_LIBS_BRIEF := $(subst $(LIB_CACHE_DIR),$$libs,$(STATIC_LIBS))
  114. #
  115. -# Rule to build the <libname>.lib.so file
  116. +# Rule to build the lib<libname>.so file
  117. #
  118. # When linking the shared library, we have to link all shared sub libraries
  119. # (LIB_SO_DEPS) to the library to store the library-dependency information in
  120. diff --git a/repos/base/mk/prg.mk b/repos/base/mk/prg.mk
  121. index 04caae01b2..8d64b0d34e 100644
  122. --- a/repos/base/mk/prg.mk
  123. +++ b/repos/base/mk/prg.mk
  124. @@ -235,6 +235,6 @@ endif
  125. clean_prg_objects:
  126. $(MSG_CLEAN)$(PRG_REL_DIR)
  127. $(VERBOSE)$(RM) -f $(OBJECTS) $(OBJECTS:.o=.d) $(TARGET) $(TARGET).stripped $(BINDER_SRC)
  128. - $(VERBOSE)$(RM) -f *.d *.i *.ii *.s *.ali *.lib.so
  129. + $(VERBOSE)$(RM) -f *.d *.i *.ii *.s *.ali *.lib.so lib*.so
  130. clean: clean_prg_objects
  131. diff --git a/repos/base/src/lib/ldso/include/file.h b/repos/base/src/lib/ldso/include/file.h
  132. index 1c9ce53ca3..a8875a781e 100644
  133. --- a/repos/base/src/lib/ldso/include/file.h
  134. +++ b/repos/base/src/lib/ldso/include/file.h
  135. @@ -132,10 +132,10 @@ struct Linker::Elf_file : File
  136. * the end of the linker area to ensure that the newly loaded
  137. * binary has enough room within the linker area.
  138. */
  139. - bool const resident = (name == "libc.lib.so")
  140. - || (name == "libm.lib.so")
  141. - || (name == "posix.lib.so")
  142. - || (strcmp(name.string(), "vfs", 3) == 0);
  143. + bool const resident = (name == "libc.so")
  144. + || (name == "libm.so")
  145. + || (name == "libposix.so")
  146. + || (strcmp(name.string(), "libvfs", 6) == 0);
  147. reloc_base = resident ? Region_map::r()->alloc_region_at_end(size)
  148. : Region_map::r()->alloc_region(size);
  149. diff --git a/repos/libports/src/lib/libc/execve.cc b/repos/libports/src/lib/libc/execve.cc
  150. index 73fd407db7..554d943763 100644
  151. --- a/repos/libports/src/lib/libc/execve.cc
  152. +++ b/repos/libports/src/lib/libc/execve.cc
  153. @@ -325,10 +325,10 @@ void Libc::init_execve(Env &env, Genode::Allocator &alloc, void *user_stack_ptr,
  154. _binary_name_ptr = &binary_name;
  155. _fd_alloc_ptr = &fd_alloc;
  156. - Dynamic_linker::keep(env, "libc.lib.so");
  157. - Dynamic_linker::keep(env, "libm.lib.so");
  158. - Dynamic_linker::keep(env, "posix.lib.so");
  159. - Dynamic_linker::keep(env, "vfs.lib.so");
  160. + Dynamic_linker::keep(env, "libc.so");
  161. + Dynamic_linker::keep(env, "libm.so");
  162. + Dynamic_linker::keep(env, "libposix.so");
  163. + Dynamic_linker::keep(env, "libvfs.so");
  164. }
  165. diff --git a/repos/libports/src/lib/libc/kernel.cc b/repos/libports/src/lib/libc/kernel.cc
  166. index b1bca7c80f..a4bebaeae1 100644
  167. --- a/repos/libports/src/lib/libc/kernel.cc
  168. +++ b/repos/libports/src/lib/libc/kernel.cc
  169. @@ -418,10 +418,10 @@ void Libc::Kernel::_clone_state_from_parent()
  170. * regular startup of the child.
  171. */
  172. bool const blacklisted = (name == "ld.lib.so")
  173. - || (name == "libc.lib.so")
  174. - || (name == "libm.lib.so")
  175. - || (name == "posix.lib.so")
  176. - || (strcmp(name.string(), "vfs", 3) == 0);
  177. + || (name == "libc.so")
  178. + || (name == "libm.so")
  179. + || (name == "libposix.so")
  180. + || (strcmp(name.string(), "libvfs", 6) == 0);
  181. if (!blacklisted)
  182. copy_from_parent(range_attr(node));
  183. }
  184. diff --git a/repos/os/src/lib/vfs/file_system_factory.cc b/repos/os/src/lib/vfs/file_system_factory.cc
  185. index 48069d3fb8..53e8678757 100644
  186. --- a/repos/os/src/lib/vfs/file_system_factory.cc
  187. +++ b/repos/os/src/lib/vfs/file_system_factory.cc
  188. @@ -117,7 +117,7 @@ Vfs::Global_file_system_factory::_try_create(Vfs::Env &env,
  189. Library_name Vfs::Global_file_system_factory::_library_name(Node_name const &node_name)
  190. {
  191. char lib_name [Library_name::capacity()];
  192. - Genode::snprintf(lib_name, sizeof(lib_name), "vfs_%s.lib.so",
  193. + Genode::snprintf(lib_name, sizeof(lib_name), "libvfs_%s.so",
  194. node_name.string());
  195. return Library_name(lib_name);