bionic: Refactor __get_elf_note()
Factor out generic __get_elf_note() logic and rename __get_elf_note() to
__find_elf_note(). Expose __get_elf_note() in libc/private/bionic_note.h
This will be used in the subsequent patch to test the presence of
NT_ANDROID_TYPE_PAD_SEGMENT note when loading segments.
Test: atest -c linker-unit-tests [Later patch]
Test: m && launch_cvd
Bug: 316403210
Change-Id: Ia7cb2f40b10cfaef402182a675087c8422b37e4d
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
diff --git a/libc/Android.bp b/libc/Android.bp
index d25671e..825b95b 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -222,6 +222,11 @@
name: "libc_bootstrap",
}
+filegroup {
+ name: "elf_note_sources",
+ srcs: ["bionic/elf_note.cpp"],
+}
+
// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
// the stack protector global variable.
@@ -229,7 +234,10 @@
cc_library_static {
name: "libc_init_static",
defaults: ["libc_defaults"],
- srcs: ["bionic/libc_init_static.cpp"],
+ srcs: [
+ "bionic/libc_init_static.cpp",
+ ":elf_note_sources",
+ ],
cflags: [
"-fno-stack-protector",