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: 2 stage BFD linker for LTO plugin


On Mon, Dec 6, 2010 at 9:20 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Dec 6, 2010 at 9:23 AM, Dave Korn <dave.korn.cygwin@gmail.com> wrote:
>> On 06/12/2010 02:20, H.J. Lu wrote:
>>
>>>>>>> BTW, the new linker passed bootstrap-lto with all default languages.
>>>>>>> I am planning to include this patch in the next Linux binutils.
>>>>>>>
>>>>>> I missed the IR object in an archive:
>>>>>>
>>>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42690#c34
>>>>>>
>>>>>> This updated patch fixed it. ?OK for trunk?
>>>>>>
>>>>> We shouldn't clear SEC_EXCLUDE if BFD_PLUGIN is set:
>>>>>
>>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42690#c38
>>>>>
>>>>> This updated patch fixed it. ?OK for trunk?
>>>>>
>>>> It turns out that my patch also fixes:
>>>>
>>>> http://sourceware.org/bugzilla/show_bug.cgi?id=12277
>>>>
>>>
>>> Updated patch, adjusted for plugin ELF symbol visibility bug fix.
>>> OK for trunk?
>>
>> ?Well, I reckon this patch is great (but don't have the approval rights).
>> It's passed an lto-bootstrap of gcc on i686-pc-cygwin and the tests are well
>> underway without anything abnormal showing up.
>>
>>> + ? ? ? /* Free the old already linked table and create a new one. ?*/
>>> + ? ? ? bfd_section_already_linked_table_free ();
>>> + ? ? ? if (!bfd_section_already_linked_table_init ())
>>> + ? ? ? ? einfo (_("%P%F: Failed to create hash table\n"));
>>> +
>>> + ? ? ? /* Free the old hash table and create a new one. ?*/
>>> + ? ? ? bfd_link_hash_table_free (link_info.output_bfd,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? link_info.hash);
>>> + ? ? ? link_info.hash
>>> + ? ? ? ? = bfd_link_hash_table_create (link_info.output_bfd);
>>> + ? ? ? if (link_info.hash == NULL)
>>> + ? ? ? ? einfo (_("%P%F: can not create hash table: %E\n"));
>>
>> ?If I had known that there was really this little stored state to be unwound
>> and regenerated, I would have wanted to do it this way in the first place.
>>
>>> +typedef struct cmdlin_header_struct
>>
>> ?Typo there.
>
> Fixed.
>

cmdline_set_next_claimed_output took the address of an stack
variable:

http://www.sourceware.org/bugzilla/show_bug.cgi?id=12293

Fixed in this updated patch.

-- 
H.J.
---
bfd/

2010-12-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	* bfd.c (BFD_PLUGIN): New.
	(BFD_FLAGS_SAVED): Add BFD_PLUGIN.
	(BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.

	* bfd-in2.h: Regenerated.

ld/

2010-12-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	* ldfile.c (ldfile_try_open_bfd): Set BFD_PLUGIN for plugin. Set
	stage1.

	* ldlang.c (cmdline_list): New.
	(cmdline_next_claimed_output): Likewise.
	(cmdline_list_init): Likewise.
	(cmdline_get_stage2_input_files): Likewise.
	(debug_cmdline_list): Likewise.
	(cmdline_list_append): Likewise.
	(cmdline_set_next_claimed_output): Likewise.
	(cmdline_list_insert_claimed_output): Likewise.
	(new_afile): Set stage1 to FALSE;
	(lang_init): Call cmdline_list_init.
	(lang_gc_sections): Don't clear SEC_EXCLUDE if BFD_PLUGIN is
	set.
	(lang_process): Call plugin_active_plugins_p to check plugin
	support.  Check cmdline_next_claimed_output before opening
	stage 2 input.  Call debug_cmdline_list if trace_file_tries
	is set.  Call cmdline_get_stage2_input_files to get stage 2
	input files.

	* ldlang.h (lang_input_statement_struct): Add stage1.
	(cmdline_enum_type): New.
	(cmdline_header_type): Likewise.
	(cmdline_input_statement_type): Likewise.
	(cmdline_claimed_output_type): Likewise.
	(cmdline_union_type): Likewise.
	(cmdline_list_type): Likewise.
	(cmdline_list_append): Likewise.
	(cmdline_list_insert_claimed_output): Likewise.
	(cmdline_set_next_claimed_output): Likewise.

	* ldmain.c (add_archive_element): Call
	cmdline_set_next_claimed_output with archive BFD.  Set
	BFD_PLUGIN for plugin.

	* lexsup.c (parse_args): Call cmdline_list_append if needed.

	* plugin.c (plugin_opt_plugin_arg): Ignore -pass-through=.
	(add_input_file): Replace lang_add_input_file with
	cmdline_list_insert_claimed_output.
	(add_input_library): Likewise.

ld/testsuite/

2010-12-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	* ld-plugin/func1p.c: New.
	* ld-plugin/func2.c: Likewise.
	* ld-plugin/func2i.c: Likewise.
	* ld-plugin/func3h.c: Likewise.

	* ld-plugin/plugin.exp: Add object files for symbols claimed
	or created by testplugin.
	* ld-plugin/plugin-7.d: Updated.
	* ld-plugin/plugin-8.d: Likewise.
	* ld-plugin/plugin-9.d: Likewise.

Attachment: binutils-2stage-6.patch
Description: Text document


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