[51/59] libctf, link: add CTF_LINK_OMIT_VARIABLES_SECTION

Message ID 20200630233146.338613-52-nick.alcock@oracle.com
State New
Headers show
Series
  • Deduplicating CTF linker
Related show

Commit Message

H.J. Lu via Binutils June 30, 2020, 11:31 p.m.
This flag (not used anywhere yet) causes the variables section to be
omitted from the output CTF dict.

include/
	* ctf-api.h (CTF_LINK_OMIT_VARIABLES_SECTION): New.
libctf/
	* ctf-link.c (ctf_link_one_input_archive_member): Check
	CTF_LINK_OMIT_VARIABLES_SECTION.
---
 include/ctf-api.h | 3 +++
 libctf/ctf-link.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.27.0.247.g3dff7de930

Patch

diff --git a/include/ctf-api.h b/include/ctf-api.h
index c3683db0996..f034f9859dd 100644
--- a/include/ctf-api.h
+++ b/include/ctf-api.h
@@ -90,6 +90,9 @@  typedef struct ctf_link_sym
    emitted into them.  */
 #define CTF_LINK_EMPTY_CU_MAPPINGS 0x4
 
+/* Omit the content of the variables section.  */
+#define CTF_LINK_OMIT_VARIABLES_SECTION 0x8
+
 /* Symbolic names for CTF sections.  */
 
 typedef enum ctf_sect_names
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 886106cb478..043d6a2f530 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -685,7 +685,8 @@  ctf_link_one_input_archive_member (ctf_file_t *in_fp, const char *name, void *ar
   arg->in_fp = in_fp;
 
   if ((err = ctf_type_iter_all (in_fp, ctf_link_one_type, arg)) > -1)
-    err = ctf_variable_iter (in_fp, ctf_link_one_variable, arg);
+    if (!(in_fp->ctf_link_flags & CTF_LINK_OMIT_VARIABLES_SECTION))
+      err = ctf_variable_iter (in_fp, ctf_link_one_variable, arg);
 
   arg->in_input_cu_file = 0;