Update linkerconfig to target out directory

Current linkerconfig targets for specific output file. However,
linkerconfig will generate more than 1 file based on APEX modules, so it
should take argument for target directory rather than target file. This
change updates linkerconfig's argument to point output directory.

Bug: 146993126
Test: m -j passed & Cuttlefish succeeded to boot
Change-Id: I3a720a047077688582436aabd307adafeafc5398
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 3c32d8b..64d9c59 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -1179,7 +1179,7 @@
 
 static Result<void> GenerateLinkerConfiguration() {
     const char* linkerconfig_binary = "/system/bin/linkerconfig";
-    const char* linkerconfig_target = "/linkerconfig/ld.config.txt";
+    const char* linkerconfig_target = "/linkerconfig";
     const char* arguments[] = {linkerconfig_binary, "--target", linkerconfig_target};
 
     if (logwrap_fork_execvp(arraysize(arguments), arguments, nullptr, false, LOG_KLOG, false,
@@ -1187,11 +1187,6 @@
         return ErrnoError() << "failed to execute linkerconfig";
     }
 
-    mode_t mode = get_mode("0444");
-    if (fchmodat(AT_FDCWD, linkerconfig_target, mode, AT_SYMLINK_NOFOLLOW) < 0) {
-        return ErrnoErrorIgnoreEnoent() << "fchmodat() failed";
-    }
-
     LOG(INFO) << "linkerconfig generated " << linkerconfig_target
               << " with mounted APEX modules info";
 
diff --git a/rootdir/init.rc b/rootdir/init.rc
index fdfcde8..635674f 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -43,7 +43,7 @@
     mkdir /linkerconfig/default 0755
 
     # Generate ld.config.txt for early executed processes
-    exec -- /system/bin/linkerconfig --target /linkerconfig/bootstrap/ld.config.txt
+    exec -- /system/bin/linkerconfig --target /linkerconfig/bootstrap
     chmod 644 /linkerconfig/bootstrap/ld.config.txt
     copy /linkerconfig/bootstrap/ld.config.txt /linkerconfig/default/ld.config.txt
     chmod 644 /linkerconfig/default/ld.config.txt