android: fix the "end of text" sentinel with lld.

For code ordering (and --madvise-random-executable-code), we put a
sentinel function at the end of .text. This doesn't work anymore with
lld, as the ordering file doesn't support wildcards.
Use a different mechanism (putting the sentinel code in its own section)
when lld is used.

Bug: 778087
Change-Id: Ie5395cb0d454f2798fccbb15f93ca6e3c0035aef
Reviewed-on: https://chromium-review.googlesource.com/868431
Commit-Queue: Benoit L <lizeb@chromium.org>
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#529490}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 2b31dbb2b212be2402e583d0ce53d30fb7892a5c
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 5376c62..6e7d145 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -225,6 +225,11 @@
     write_compiled_message(root_gen_dir,
         'base/trace_event/etw_manifest/chrome_events_win.man')
 
+  if is_android:
+    write_buildflag_header_manually(
+        root_gen_dir, 'base/android/library_loader.h',
+        {'USE_LLD': 'false'})
+
   write_gn_ninja(os.path.join(tempdir, 'build.ninja'),
                  root_gen_dir, options)
   cmd = ['ninja', '-C', tempdir, '-w', 'dupbuild=err']