This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[LTO][PATCH] Fix undefined referecnes to global variables for DSO without any functions.


Hi,

    This patch fixes a problem where a DSO without any functions drops
all global variables.  The current code lumps any unused globals to
the last LTRANS file.  In lto_map_1_to_1, LTRANS files are created for
cgraph node sets. When the cgraph is empty, there is no cgraph node
set and hence no LTRANS file.  So all the globals are not output.  The
fix is rather simple.  A large part of this patch actually is to
extend the current LTO testing frame-work to allow for tests that look
for particular symbols in LTO optimized binaries.

-Doug

2008-12-13  Doug Kwan  <dougkwan@google.com>

lto/ChangeLog:
	* lto.c (lto_1_to_1_map): Create a cgraph node set for any global
	variables if there is no function.

testsuite/ChangeLog.lto:
	* gcc.dg/lto/20081212-1_0.c: New.
	* lib/lto.exp (lto-get-options-main): Handle dg-final.
	(lto-execute): Execute any final code in test.
	(scan-symbol): New.

Attachment: patch.txt
Description: Text document


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