traced_perf: re-enable linux build + add x86 regs handling

We need the kernel UAPI headers for the perf regs enums, I'm sourcing
them from buildtools/bionic, as with the in-tree builds.

I've previously promised to look into explicit reassignments instead of
memcpy/loop for arm/arm64, but ended up keeping them, as there's no
really sensible enum to index the "user" regs by (I'm not exactly sure
whether MachineArm64.h is the conceptually right enum either, but that's
what's used in practice, and all of these layouts match anyway).

Bug: 144281346
Change-Id: Id4a388e3772ce10b0f8aa43b6a30f8f43e91c93d
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index bf15131..7c1c444 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -171,9 +171,6 @@
         ('required', {'libperfetto_android_internal', 'trigger_perfetto'}),
     ],
     'libperfetto_android_internal': [('static_libs', {'libhealthhalutils'}),],
-    'traced_perf': [
-        ('include_dirs', {'bionic/libc/kernel'}),
-    ],
     'trace_processor_shell': [
       ('dist', {'targets': ['sdk_repo']}),
       ('stl', 'libc++_static'),
@@ -231,6 +228,10 @@
     module.shared_libs.add('libz')
 
 
+def enable_uapi_headers(module):
+  module.include_dirs.add('bionic/libc/kernel')
+
+
 # Android equivalents for third-party libraries that the upstream project
 # depends on.
 builtin_deps = {
@@ -245,6 +246,7 @@
     '//gn:libunwindstack': enable_libunwindstack,
     '//gn:sqlite': enable_sqlite,
     '//gn:zlib': enable_zlib,
+    '//gn:bionic_kernel_uapi_headers' : enable_uapi_headers,
 }
 
 # ----------------------------------------------------------------------------