summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/gold/options.cc
diff options
context:
space:
mode:
authorHan Shen <shenhan@google.com>2015-11-17 16:29:47 -0800
committerHan Shen <shenhan@google.com>2015-11-19 17:29:00 -0800
commit8bfb6b2bf11cfbc445239158ec28d0988f8fa947 (patch)
tree64baf9be2b2d76eb0d3d83ec6acf3d5ddd452b64 /binutils-2.25/gold/options.cc
parent932d71b859239e834651fdee549dc661cda82fe8 (diff)
downloadtoolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.tar.gz
toolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.tar.bz2
toolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.zip
Create an unified binutils source tree for both Android and ChromiumOS.
About source code - The base version of this binutils is newer than that of aosp/binutils-2.25, it is based on the binutils that is used to build google products and ChromiumOS. And it contains *all* local Android patches as well as all patches that are cherry-picked from upstream for aosp/binutils-2.25 tree (up to Nov. 5 - 932d71b85). You may find the detailed development history for this binutils tree here - https://chromium.googlesource.com/chromiumos/third_party/binutils/+log/unification (This CL is a combination of all the CLs in it. After this CL is submitted the tree will be identical to https://chromium.googlesource.com/chromiumos/third_party/binutils/+log/unification at 2865a3615d80bd5f82d14d7e0484e84dc052596a) About testing - We tested this binutils for both ChromiumOS and Android. For android, we tested building N4, N5X, N6, N7, N9 using new binutils, we also did a full-build of toolchain (by build.py) and built a N5X image; for ChromiumOS - it passed ChromiumOS toolchain release tests on all 4 platforms (x86, x86_64, arm32 and arm64). Change-Id: I2bb2cf579f9458d0a8bc9612331dc7d5043e3d82
Diffstat (limited to 'binutils-2.25/gold/options.cc')
-rw-r--r--binutils-2.25/gold/options.cc37
1 files changed, 36 insertions, 1 deletions
diff --git a/binutils-2.25/gold/options.cc b/binutils-2.25/gold/options.cc
index 7f1f69e0..1bb0cc17 100644
--- a/binutils-2.25/gold/options.cc
+++ b/binutils-2.25/gold/options.cc
@@ -1,6 +1,6 @@
// options.c -- handle command line options for gold
-// Copyright (C) 2006-2015 Free Software Foundation, Inc.
+// Copyright (C) 2006-2014 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -1200,6 +1200,39 @@ General_options::finalize()
// in the path, as appropriate.
this->add_sysroot();
+ // Now check if library_path is poisoned.
+ if (this->warn_poison_system_directories())
+ {
+ std::vector<std::string> bad_paths;
+
+ bad_paths.push_back("/lib");
+ // TODO: This check is disabled for now due to a bunch of packages that
+ // use libtool and relink with -L/usr/lib paths (albeit after the right
+ // sysroot path). Once those are fixed we can enable.
+ // We also need to adjust it so it only rejects one or two levels deep.
+ // Gcc's internal paths also live below /usr/lib.
+ // http://crbug.com/488360
+ // bad_paths.push_back("/usr/lib");
+ bad_paths.push_back("/usr/local/lib");
+ bad_paths.push_back("/usr/X11R6/lib");
+
+ for (std::vector<std::string>::const_iterator b = bad_paths.begin();
+ b != bad_paths.end();
+ ++b)
+ for (Dir_list::iterator p = this->library_path_.value.begin();
+ p != this->library_path_.value.end();
+ ++p)
+ if (!p->name().compare(0, b->size(), *b))
+ {
+ if (this->error_poison_system_directories())
+ gold_fatal(_("library search path \"%s\" is unsafe for "
+ "cross-compilation"), p->name().c_str());
+ else
+ gold_warning(_("library search path \"%s\" is unsafe for "
+ "cross-compilation"), p->name().c_str());
+ }
+ }
+
// Now that we've normalized the options, check for contradictory ones.
if (this->shared() && this->is_static())
gold_fatal(_("-shared and -static are incompatible"));
@@ -1256,6 +1289,8 @@ General_options::finalize()
"--emit-relocs"));
if (this->has_plugins())
gold_fatal(_("incremental linking is not compatible with --plugin"));
+ if (this->relro())
+ gold_fatal(_("incremental linking is not compatible with -z relro"));
if (this->gc_sections())
{
gold_warning(_("ignoring --gc-sections for an incremental link"));