2008-01-11  Tristan Gingold  <gingold@adacore.com>
	    Eric Botcazou  <ebotcazou@adacore.com>

	* ldlang.c (lang_end): Warns if the entry point is not found when
	--gc-sections.
	Emit an error if no root is specified when --gc-sections -r.
	* ld.texinfo (Options): Document that --gc-sections is compatible
	with -r and -q.
	* ldmain.c (main): Do not error out if -r and --gc-sections.
	* scripttempl/elf.sc: Emit ENTRY command only if relocating.

ld/testsuite:
2008-01-11  Tristan Gingold  <gingold@adacore.com>

	* lib/ld-lib.exp (check_gc_sections_available): Now available on
	VxWorks.
	* ld-gc: New directory for testing --gc-sections.
	* ld-gc/gc.c: New file.
	* ld-gc/gc.exp: New file.
	* ld-gc/noent.s: New file.
	* ld-gc/noent.d: New file.
This commit is contained in:
Tristan Gingold
2008-01-11 09:11:18 +00:00
parent 7dda2462a7
commit ac69cbc672
12 changed files with 141 additions and 17 deletions

View File

@ -5077,11 +5077,20 @@ lang_end (void)
struct bfd_link_hash_entry *h;
bfd_boolean warn;
if (link_info.relocatable || link_info.shared)
if ((link_info.relocatable && !link_info.gc_sections)
|| link_info.shared)
warn = entry_from_cmdline;
else
warn = TRUE;
/* Force the user to specify a root when generating a relocatable with
--gc-sections. */
if (link_info.gc_sections && link_info.relocatable
&& (entry_symbol.name == NULL
&& ldlang_undef_chain_list_head == NULL))
einfo (_("%P%F: gc-sections requires either an entry or "
"an undefined symbol\n"));
if (entry_symbol.name == NULL)
{
/* No entry has been specified. Look for the default entry, but