summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-07 21:28:41 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-07 21:28:41 +0000
commitc0c7376ea4d7a4dca4c060e9a394317ec80e4db9 (patch)
treedb59cc0ec084ff625d100a8c36cdc895d2abb000 /chrome
parent4a8fdae6d6303a62f4a7e8f4be29f2ff3da74191 (diff)
downloadchromium_src-c0c7376ea4d7a4dca4c060e9a394317ec80e4db9.zip
chromium_src-c0c7376ea4d7a4dca4c060e9a394317ec80e4db9.tar.gz
chromium_src-c0c7376ea4d7a4dca4c060e9a394317ec80e4db9.tar.bz2
Don't use NXArgc or NXArgv. Access them via _NSGetArgc() and _NSGetArgv().
This allows dead code stripping to be turned back on for the main executables and for the NXArgc and NXArgv symbols to be stripped. BUG=139902 Review URL: https://chromiumcodereview.appspot.com/10837149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/app.saves2
-rw-r--r--chrome/app/app_asan.saves2
-rw-r--r--chrome/browser/mac/relauncher.cc21
-rw-r--r--chrome/chrome.gyp10
-rw-r--r--chrome/chrome_exe.gypi10
5 files changed, 10 insertions, 35 deletions
diff --git a/chrome/app/app.saves b/chrome/app/app.saves
index 8ae1b93..f002013 100644
--- a/chrome/app/app.saves
+++ b/chrome/app/app.saves
@@ -6,5 +6,3 @@
# helper app executables.
_main
-_NXArgc
-_NXArgv
diff --git a/chrome/app/app_asan.saves b/chrome/app/app_asan.saves
index 2cadbb2..fd8b352 100644
--- a/chrome/app/app_asan.saves
+++ b/chrome/app/app_asan.saves
@@ -13,8 +13,6 @@
# Chromium-specific symbols.
_main
-_NXArgc
-_NXArgv
# AddressSanitizer-specific symbols.
___asan_init
diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc
index aaaacb9..d028d3e 100644
--- a/chrome/browser/mac/relauncher.cc
+++ b/chrome/browser/mac/relauncher.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <AvailabilityMacros.h>
+#include <crt_externs.h>
#include <dlfcn.h>
#include <string.h>
#include <sys/event.h>
@@ -264,22 +265,20 @@ int RelauncherMain(const content::MainFunctionParams& main_parameters) {
// after the separator should be given to the relaunched process; it's also
// important to not treat the path to the relaunched process as a "loose"
// argument. NXArgc and NXArgv are pointers to the original argc and argv as
- // passed to main(), so use those. The typical mechanism to do this is to
- // provide "extern" declarations to access these, but they're only present
- // in the crt1.o start file. This function will be linked into the framework
- // dylib, having no direct access to anything in crt1.o. dlsym to the
- // rescue.
- const int* argcp = static_cast<const int*>(dlsym(RTLD_MAIN_ONLY, "NXArgc"));
+ // passed to main(), so use those. Access them through _NSGetArgc and
+ // _NSGetArgv because NXArgc and NXArgv are normally only available to a
+ // main executable via crt1.o and this code will run from a dylib, and
+ // because of http://crbug.com/139902.
+ const int* argcp = _NSGetArgc();
if (!argcp) {
- LOG(ERROR) << "dlsym NXArgc: " << dlerror();
+ NOTREACHED();
return 1;
}
int argc = *argcp;
- const char* const** argvp =
- static_cast<const char* const**>(dlsym(RTLD_MAIN_ONLY, "NXArgv"));
+ const char* const* const* argvp = _NSGetArgv();
if (!argvp) {
- LOG(ERROR) << "dlsym NXArgv: " << dlerror();
+ NOTREACHED();
return 1;
}
const char* const* argv = *argvp;
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index e9a108c..9c1e903 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -420,16 +420,6 @@
'CHROMIUM_STRIP_SAVE_FILE': 'app/app.saves',
'INFOPLIST_FILE': 'app/helper-Info.plist',
},
- # Turn off -dead_strip in Release mode for the helper app. There's
- # little here to strip, and doing so preserves symbols from
- # crt1.10.6.o, which get removed incorrectly. http://crbug.com/139902
- 'configurations': {
- 'Release': {
- 'xcode_settings': {
- 'DEAD_CODE_STRIPPING': 'NO',
- },
- },
- },
'postbuilds': [
{
# The helper doesn't have real localizations, it just has
diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi
index b570f98..39f30b5 100644
--- a/chrome/chrome_exe.gypi
+++ b/chrome/chrome_exe.gypi
@@ -247,16 +247,6 @@
'CHROMIUM_CREATOR': '<(mac_creator)',
'CHROMIUM_SHORT_NAME': '<(branding)',
},
- # Turn off -dead_strip in Release mode for the main app. There's
- # little here to strip, and doing so preserves symbols from
- # crt1.10.6.o, which get removed incorrectly. http://crbug.com/139902
- 'configurations': {
- 'Release': {
- 'xcode_settings': {
- 'DEAD_CODE_STRIPPING': 'NO',
- },
- },
- },
'dependencies': [
'helper_app',
'infoplist_strings_tool',