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

Side by Side Diff: chrome/nacl.gypi

Issue 7795010: Use chain-loading for Linux nacl_helper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 { 5 {
6 'target_defaults': { 6 'target_defaults': {
7 'variables': { 7 'variables': {
8 'nacl_target': 0, 8 'nacl_target': 0,
9 }, 9 },
10 'target_conditions': [ 10 'target_conditions': [
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 'NACL_BLOCK_SIZE=32', 176 'NACL_BLOCK_SIZE=32',
177 '<@(nacl_defines)', 177 '<@(nacl_defines)',
178 ], 178 ],
179 }, 179 },
180 }, 180 },
181 ], 181 ],
182 }], 182 }],
183 ['OS=="linux"', { 183 ['OS=="linux"', {
184 'targets': [ 184 'targets': [
185 { 185 {
186 'target_name': 'nacl_helper.so', 186 'target_name': 'nacl_helper',
Brad Chen 2011/08/29 23:25:24 Once this is in we'll need to go back and update t
187 # 'executable' will be overridden below when we add the -shared
188 # flag; here it prevents gyp from using the --whole-archive flag
189 'type': 'executable', 187 'type': 'executable',
190 'include_dirs': [ 188 'include_dirs': [
191 '..', 189 '..',
192 ], 190 ],
193 'dependencies': [ 191 'dependencies': [
194 'nacl', 192 'nacl',
195 ], 193 ],
196 'sources': [ 194 'sources': [
197 '../chrome/nacl/nacl_helper_linux.cc', 195 'nacl/nacl_helper_linux.cc',
198 ], 196 ],
199 'conditions': [ 197 'conditions': [
200 ['toolkit_uses_gtk == 1', { 198 ['toolkit_uses_gtk == 1', {
201 'dependencies': [ 199 'dependencies': [
202 '../build/linux/system.gyp:gtk', 200 '../build/linux/system.gyp:gtk',
203 ], 201 ],
204 }], 202 }],
205 ], 203 ],
204 'cflags': [ '-fPIE' ],
206 'link_settings': { 205 'link_settings': {
207 # NOTE: '-shared' overrides 'executable' above 206 'ldflags': ['-pie'],
208 'ldflags': ['-shared', 207 },
209 '-Wl,--version-script=chrome/nacl/nacl_helper_exports.tx t', 208 },
210 ], 209 {
210 'target_name': 'nacl_helper_bootstrap_munge_phdr',
211 'type': 'executable',
212 'toolsets': ['host'],
213 'sources': [
214 'nacl/nacl_helper_bootstrap_munge_phdr.c',
215 ],
216 'libraries': [
217 '-lelf',
218 ],
219 # This is an ugly kludge because gyp doesn't actually treat
220 # host_arch=x64 target_arch=ia32 as proper cross compilation.
221 # It still wants to compile the "host" program with -m32 et
222 # al. Though a program built that way can indeed run on the
223 # x86-64 host, we cannot reliably build this program on such a
224 # host because Ubuntu does not provide the full suite of
225 # x86-32 libraries in packages that can be installed on an
226 # x86-64 host; in particular, libelf is missing. So here we
227 # use the hack of eliding all the -m* flags from the
Mark Seaborn 2011/08/29 22:26:50 This is scary. See comment elsewhere about using
228 # compilation lines, getting the command close to what they
229 # would be if gyp were to really build properly for the host.
230 # TODO(bradnelson): Clean up with proper cross support.
231 'conditions': [
232 ['host_arch=="x64"', {
233 'cflags/': [ ['exclude', '-m.*'] ],
234 'ldflags/': [ ['exclude', '-m.*'] ],
235 }],
236 ],
237 },
238 {
239 'target_name': 'nacl_helper_bootstrap_raw',
240 'type': 'executable',
241 'sources': [
242 'nacl/nacl_helper_bootstrap_linux.c',
243 # We list the linker script here for documentation purposes.
244 # But even this doesn't make gyp treat it as a dependency,
245 # so incremental builds won't relink when the script changes.
246 # TODO(bradnelson): Fix the dependency handling.
247 'nacl/nacl_helper_bootstrap_linux.x',
248 ],
249 'cflags': [
250 # The tiny standalone bootstrap program is incompatible with
251 # -fstack-protector, which might be on by default.
252 '-fno-stack-protector',
253 # We don't want to compile it PIC (or its cousin PIE), because
254 # it goes at an absolute address anyway, and because any kind
255 # of PIC complicates life for the x86-32 assembly code. We
256 # append -fno-* flags here instead of using a 'cflags!' stanza
257 # to remove -f* flags, just in case some system's compiler
258 # defaults to using PIC for everything.
259 '-fno-pic', '-fno-PIC',
260 '-fno-pie', '-fno-PIE',
261 ],
262 'link_settings': {
263 'ldflags': [
264 # TODO(bradchen): Delete the -B argument when Gold is verified
265 # to produce good results with our custom linker script.
266 # Until then use ld.bfd.
267 '-B', 'tools/ld_bfd',
268 # This programs is (almost) entirely standalone. It has
269 # its own startup code, so no crt1.o for it. It is
270 # statically linked, and on x86 it actually does not use
271 # libc at all. However, on ARM it needs a few (safe)
272 # things from libc, so we don't use '-nostdlib' here.
273 '-static', '-nostartfiles',
274 # Link with our custom linker script to get out special layout.
275 # TODO(bradnelson): Use some <(foo) instead of chrome/ here.
276 '-Wl,--script=chrome/nacl/nacl_helper_bootstrap_linux.x',
277 # On x86-64, the default page size with some
278 # linkers is 2M rather than the real Linux page
279 # size of 4K. A larger page size is incompatible
280 # with our custom linker script's special layout.
281 '-Wl,-z,max-page-size=0x1000',
282 ],
211 }, 283 },
212 }, 284 },
213 { 285 {
214 'target_name': 'nacl_helper_bootstrap', 286 'target_name': 'nacl_helper_bootstrap',
215 'type': 'executable',
216 'dependencies': [ 287 'dependencies': [
217 'nacl_helper.so', 288 'nacl_helper_bootstrap_raw',
218 ], 289 'nacl_helper_bootstrap_munge_phdr#host',
219 'sources': [ 290 ],
220 '../chrome/nacl/nacl_helper_bootstrap_linux.c', 291 'type': 'none',
221 ], 292 'actions': [{
222 # TODO(bradchen): Delete the -B argument when Gold supports 293 'action_name': 'munge_phdr',
223 # -Ttext properly. Until then use ld.bfd. 294 'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py',
224 'link_settings': { 295 '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr',
225 'ldflags': ['-B', 'tools/ld_bfd', 296 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'],
226 # Force text segment at 0x10000 (64KB) 297 'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'],
227 # The max-page-size option is needed on x86-64 linux 298 'message': 'Munging ELF program header',
228 # where 4K pages are not the default in the BFD linker. 299 'action': ['python', '<@(_inputs)', '<@(_outputs)']
229 '-Wl,-Ttext-segment,10000,-z,max-page-size=0x1000', 300 }],
230 # reference nacl_helper as a shared library 301 }
231 '<(PRODUCT_DIR)/nacl_helper.so',
232 '-Wl,-rpath,<(SHARED_LIB_DIR)',
233 ],
234 },
235 },
236 ], 302 ],
237 }], 303 }],
238 ], 304 ],
239 } 305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698