This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Gold: Do not emit locals from discard .eh_frame sections.
On Fri, Jun 5, 2009 at 8:31 AM, Ian Lance Taylor<iant@google.com> wrote:
> "Doug Kwan (關振紱)" <dougkwan@google.com> writes:
>
>> 2009-06-04 Doug Kwan <dougkwan@google.com>
>>
>> * object.cc (Sized_relobj::Sized_relobj): Initialize
>> discarded_eh_frame_shndx_ to -1U.
>> (Sized_relobj::do_layout): Record index of a discard .eh_frame
>> section.
>> (Sized_relobj::do_count_local_symbols): Skip local symbols in
>> a discarded .eh_frame section.
>> (Sized_relobj::do_finalize_local_symbols): Ditto.
>> * object.h (class Sized_relobj): Declare new member
>> discarded_eh_frame_shndx_.
>> * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
>> (local_labels_test_SOURCE, local_labels_test_LDFLAGS): Define new.
>> (local_labels_test.o): New rule.
>> * testsuite/Makefile.in: Regenerate.
>> * testsuite/local_labels_test.cc: New file.
>
>
>> + // There can be at most one .eh_frame section per object.
>> + gold_assert(this->discarded_eh_frame_shndx_ == -1U);
>> + this->discarded_eh_frame_shndx_ = i;
>> + out_section_offsets[i] = invalid_address;
>
> Reading the comment literally makes the loop seem unnecessary. Change
> it to say "An object can contain at most one section holding exception
> frame information."
>
>
>> + // If this object has a GNU sytle .eh_frame section that is discarded in
>> + // output, record the index here. Otherwise it is -1U.
>
> s/sytle/style/
>
>
>> +check_PROGRAMS += local_labels_test
>> +local_labels_test_SOURCES = local_labels_test.cc
>> +local_labels_test_LDFLAGS = -Bgcctestdir/
>> +local_labels_test.o: local_labels_test.cc
>> + $(CXXCOMPILE) -g -c -Wa,--keep-locals -o $@ $<
>
> Use -L here instead of --keep-locals. -L is supported by many
> assemblers, --keep-locals is only supported by gas. We may need to use
> a configure test for this, but let's see if we can get away with -L.
>
> Instead of introducing a new nearly-empty .cc file, just have this test
> compile basic_test.cc with the -L option.
To be clear, this patch is OK with the above changes.
Thanks.
Ian