[patch][gold] Fix PR11604

Ian Lance Taylor iant@google.com
Wed May 26 00:21:00 GMT 2010


Rafael Espindola <espindola@google.com> writes:

> @@ -1461,6 +1461,11 @@ Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
>         ++deferred)
>      {
>        typename This::Shdr shdr(deferred->shdr_data_);
> +      // If the output sections is NULL, it is because the garbage collector
> +      // decided it is not needed. Avoid reverting that decision.
> +      if (this->output_sections()[deferred->shndx_] == NULL)
> +        continue;
> +

Write this as
    if (!this->is_section_included(deferred->shndx_))
Update the comment accordingly.  Two spaces after a period in the
comment.


> @@ -1284,6 +1284,25 @@ plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld
>  plugin_test_6.err: plugin_test_6
>  	@touch plugin_test_6.err
>  
> +check_PROGRAMS += plugin_test_7
> +check_SCRIPTS += plugin_test_7.sh
> +check_DATA += plugin_test_7.err plugin_test_7.syms
> +MOSTLYCLEANFILES += plugin_test_7.err
> +plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
> +	$(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.syms plugin_test_7_2.o 2>plugin_test_7.err
> +plugin_test_7.syms: plugin_test_7
> +	$(TEST_READELF) -sW $< >$@ 2>/dev/null
> +plugin_test_7_1.o: plugin_test_7_1.c
> +	$(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
> +plugin_test_7_1_orig.o: plugin_test_7_1.c
> +	$(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
> +plugin_test_7_1.syms: plugin_test_7_1_orig.o
> +	$(TEST_READELF) -sW $< >$@ 2>/dev/null
> +plugin_test_7_2.o: plugin_test_7_2.c
> +	$(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
> +plugin_test_7.err: plugin_test_7
> +	@touch plugin_test_7.err

I don't see why this last command is needed.  The rule for
plugin_test_7 should always create plugin_test_7.err.  The dependency
is fine, but I don't see why you need the touch command.


This is OK with the above changes.

Thanks.

Ian



More information about the Binutils mailing list