Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: pylib/gyp/generator/make.py

Issue 7076019: make: don't use --whole-archive for loadable_module (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: fix Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/make.py
diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py
index 5b097aac47b56cbdcf1f1d249998c630ba91bb08..816f6a0a74c896a6c4ec15be0bf9c150f968f0fa 100644
--- a/pylib/gyp/generator/make.py
+++ b/pylib/gyp/generator/make.py
@@ -207,15 +207,29 @@ cmd_copy = ln -f $< $@ 2>/dev/null || cp -af $< $@
quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
-# Shared-object link (for generating .so).
+# We support two kinds of shared objects (.so):
+# 1) shared_library, which is just bundling together many dependent libraries
+# into a link line.
+# 2) loadable_module, which is generating a module intended for dlopen().
+#
+# They differ only slightly:
+# In the former case, we want to package all dependent code into the .so.
+# In the latter case, we want to package just the API exposed by the
+# outermost module.
+# This means shared_library uses --whole-archive, while loadable_module doesn't.
+# (Note that --whole-archive is incompatible with the --start-group used in
+# normal linking.)
+
+# Other shared-object link notes:
# - Set SONAME to the library filename so our binaries don't reference
# the local, absolute paths used on the link command-line.
-# - Use --whole-archive so that the .a files we combine end up in the public
-# API of the shared object. (Note that --whole-archive is incompatible with
-# the --start-group used in normal linking.)
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(filter-out FORCE_DO_CMD, $^) -Wl,--no-whole-archive $(LIBS)
+
+quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
+cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
"""
+
r"""
# Define an escape_quotes function to escape single quotes.
# This allows us to handle quotes properly as long as we always use
@@ -1014,8 +1028,10 @@ class MakefileWriter:
self.WriteDoCmd([self.output], link_deps, 'link', part_of_all)
elif self.type == 'static_library':
self.WriteDoCmd([self.output], link_deps, 'alink', part_of_all)
- elif self.type in ('loadable_module', 'shared_library'):
+ elif self.type == 'shared_library':
self.WriteDoCmd([self.output], link_deps, 'solink', part_of_all)
+ elif self.type == 'loadable_module':
+ self.WriteDoCmd([self.output], link_deps, 'solink_module', part_of_all)
elif self.type == 'none':
# Write a stamp line.
self.WriteDoCmd([self.output], deps, 'touch', part_of_all)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698