This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: [PATCH 3/3] ld: Extend options for altering orphan handling behaviour.


On Wed, Jul 29, 2015 at 01:52:46PM +0100, Andrew Burgess wrote:
> ld/ChangeLog:
> 
> 	* ld.h (enum orphan_handling_enum): New.
> 	(ld_config_type): Remove warn_orphan, add orphan_handling.
> 	* ldemul.c (ldemul_place_orphan): Remove warning about orphan
> 	sections.
> 	* ldlang.c (ldlang_place_orphan): New function.
> 	(lang_place_orphans): Call ldlang_place_orphan.
> 	* ldlex.h (enum option_values): Remove OPTION_WARN_ORPHAN and
> 	OPTION_NO_WARN_ORPHAN, add OPTION_ORPHAN_HANDLING.
> 	* lexsup.c (ld_options): Remove 'warn-orphan' and
> 	'no-warn-orphan', add 'orphan-handling'.
> 	(parse_args): Remove handling for OPTION_WARN_ORPHAN and
> 	OPTION_NO_WARN_ORPHAN, add handling for OPTION_ORPHAN_HANDLING.
> 	* NEWS: Replace text about --warn-orphan with --orphan-handling.
> 	* ld.texinfo (Options): Remove --warn-orphan entry and add
> 	entry on --orphan-handling.
> 	(Orphan Sections): Add reference to relevant command line options.
> 
> ld/testsuite/ChangeLog:
> 
> 	* ld-elf/elf.exp: Switch to rely on run_dump_test.
> 	* ld-elf/orphan-5.l: Update expected output.
> 	* ld-elf/orphan-5.d: New file.
> 	* ld-elf/orphan-6.d: New file.
> 	* ld-elf/orphan-6.l: New file.
> 	* ld-elf/orphan-7.d: New file.
> 	* ld-elf/orphan-7.map: New file.
> 	* ld-elf/orphan-8.d: New file.
> 	* ld-elf/orphan-8.map: New file.

I think this is a reasonable extension and replacement of the existing
--warn-orphan code.  Keeping the old option for backward compatibility
probably isn't needed since --warn-orphan hasn't been made available
in any official release.  Some comments on the patch:

> +      if (config.orphan_handling == orphan_handling_error)
> +	einfo ("%X%P: error: unplaced orphan section `%A' from `%B'.\n",
> +	       s, s->owner);
> +      else
> +	ASSERT (config.orphan_handling == orphan_handling_warn
> +		|| config.orphan_handling == orphan_handling_place);

The assert doesn't really add anything here.  I'd be inclined to
remove it.

> --- /dev/null
> +++ b/ld/testsuite/ld-elf/orphan-7.map
> @@ -0,0 +1,7 @@
> +
> +Discarded input sections
> +
> + \.notbad        0x0+        0x4 tmpdir/.*\.o
> + \.note\.bar      0x0+        0x4 tmpdir/.*\.o
> +
> +#...
> \ No newline at end of file

Please fix.

> --- /dev/null
> +++ b/ld/testsuite/ld-elf/orphan-8.map
> @@ -0,0 +1,7 @@
> +#...
> +.notbad         0x0000000000000004        0x4
> + .notbad        0x0000000000000004        0x4 tmpdir/dump0.o
> +#...
> +.note.bar       0x0000000000000010        0x4
> + .note.bar      0x0000000000000010        0x4 tmpdir/dump0.o
> +#...
> \ No newline at end of file

Here too.  Otherwise looks good, but give Nick a chance to veto before
committing.

-- 
Alan Modra
Australia Development Lab, IBM


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