This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]


GCC emits BINCL/EINCL stabs for a header even if its content is #ifdef'ed out. This results in empty BINCL/EINCL pair. Now, use of -gused (my previous patch) introduces even more empty pairs. And in PCH usage model, precomp contains tons of empty BINCL/EINCLs with -gused (because not many symbols are used while pre-compiling prefix header). So this patch introduces empty BINCL/EINCL optimization by emitting BINCL stabs lazily. If BINCL stab is pending when it is time to emit EINCL stab, it eliminates entire pair. It has significant impact on size of .o files created.

Here is size comparison for and h.c.
- is a three line hello world program that includes iostream.h.
and uses std::cout.
-h.c is hello world using printf().
- EBEO = empty BINCL/EINCL optimization

-g		-gused	-g 		-gused 	no dbg		name
				+ EBEO	+ EBEO	

125908	10904	121324	4052	2488
    6452	  1612	     6240	1032	  812			h.c

One added benefit is that this has significant positive impact on
GDB startup time.

OK to commit if gcc & gdb dejagnu tests does not report any regression?


2003-06-20 Devang Patel <>

* dbxout.c (binclstatus): New enum.
(emit_bincl_stab): New function.
(emit_pending_bincls): Same.
(emit_pending_bincls_if_required): Same.
(struct dbx_file): New members: bincl_status, pending_bincl_name and prev.
(pending_bincls): New static var.
(dbxout_init): Initialize new dbx_file members.
(dbxout_start_source_file): Same.
(dbxout_end_source_file): Emit EINCL stab only if BINCL is already processed.
(dbxout_begin_block): Emit pending BINCL stabs.
(dbxout_end_block): Same.
(dbxout_function_decl): Same.
(dbxout_continue): Same.
(dbxout_type): Same.
(dbxout_symbol): Same.
(dbxout_symbol_location): Same.
(dbxout_parms): Same.

Attachment: empty_bincl.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]