Make GN --as=output relative to the root build directory.

The intended use for this parameter is to give files that can be passed to Ninja to compile. Ninja takes files relative to the root build directory.

BUG=546127

Review URL: https://codereview.chromium.org/1413573006

Cr-Original-Commit-Position: refs/heads/master@{#355555}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 1c010e5f6ccb6b5d65044500fb1f656d3f8b5d6b
diff --git a/tools/gn/commands.cc b/tools/gn/commands.cc
index 3778d5b..ed7a009 100644
--- a/tools/gn/commands.cc
+++ b/tools/gn/commands.cc
@@ -323,8 +323,6 @@
   const BuildSettings* build_settings =
       targets[0]->settings()->build_settings();
 
-  SourceDir current_dir = SourceDirForCurrentDirectory(
-      build_settings->root_path());
   for (const Target* target : targets) {
     // Use the link output file if there is one, otherwise fall back to the
     // dependency output file (for actions, for example).
@@ -334,7 +332,8 @@
 
     SourceFile output_as_source =
         output_file.AsSourceFile(build_settings);
-    std::string result = RebasePath(output_as_source.value(), current_dir,
+    std::string result = RebasePath(output_as_source.value(),
+                                    build_settings->build_dir(),
                                     build_settings->root_path_utf8());
     if (indent)
       OutputString("  ");
diff --git a/tools/gn/commands.h b/tools/gn/commands.h
index d294a89..ca4b0f2 100644
--- a/tools/gn/commands.h
+++ b/tools/gn/commands.h
@@ -154,7 +154,7 @@
     "          Prints the label of the target.\n"\
     "      output\n"\
     "          Prints the first output file for the target relative to the\n"\
-    "          current directory.\n"
+    "          root build directory.\n"
 #define TARGET_TYPE_FILTER_COMMAND_LINE_HELP \
     "  --type=(action|copy|executable|group|loadable_module|shared_library|\n"\
     "          source_set|static_library)\n"\