Switch <elf.h> over to linux uapi under the covers.

Remove the linker's reliance on BSD cruft and use the glibc-style
ElfW macro. (Other code too, but the linker contains the majority
of the code that needs to work for Elf32 and Elf64.)

All platforms need dl_iterate_phdr_static, so it doesn't make sense
to have that part of the per-architecture configuration.

Bug: 12476126
Change-Id: I1d7f918f1303a392794a6cd8b3512ff56bd6e487
diff --git a/libc/private/KernelArgumentBlock.h b/libc/private/KernelArgumentBlock.h
index 105965e..4af52ab 100644
--- a/libc/private/KernelArgumentBlock.h
+++ b/libc/private/KernelArgumentBlock.h
@@ -18,6 +18,7 @@
 #define KERNEL_ARGUMENT_BLOCK_H
 
 #include <elf.h>
+#include <link.h>
 #include <stdint.h>
 #include <sys/auxv.h>
 
@@ -43,14 +44,14 @@
     }
     ++p; // Skip second NULL;
 
-    auxv = reinterpret_cast<Elf_auxv_t*>(p);
+    auxv = reinterpret_cast<ElfW(auxv_t)*>(p);
   }
 
   // Similar to ::getauxval but doesn't require the libc global variables to be set up,
   // so it's safe to call this really early on. This function also lets you distinguish
   // between the inability to find the given type and its value just happening to be 0.
   unsigned long getauxval(unsigned long type, bool* found_match = NULL) {
-    for (Elf_auxv_t* v = auxv; v->a_type != AT_NULL; ++v) {
+    for (ElfW(auxv_t)* v = auxv; v->a_type != AT_NULL; ++v) {
       if (v->a_type == type) {
         if (found_match != NULL) {
             *found_match = true;
@@ -67,7 +68,7 @@
   int argc;
   char** argv;
   char** envp;
-  Elf_auxv_t* auxv;
+  ElfW(auxv_t)* auxv;
 
   abort_msg_t** abort_message_ptr;
 
diff --git a/libc/private/bionic_auxv.h b/libc/private/bionic_auxv.h
index 69c5341..53fcc49 100644
--- a/libc/private/bionic_auxv.h
+++ b/libc/private/bionic_auxv.h
@@ -29,11 +29,12 @@
 #define _PRIVATE_BIONIC_AUXV_H_
 
 #include <elf.h>
+#include <link.h>
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
 
-extern Elf_auxv_t* __libc_auxv;
+extern ElfW(auxv_t)* __libc_auxv;
 
 __END_DECLS