This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GOLD] Handle symbols with section index SHN_XINDEX correctly.
- From: Ian Lance Taylor <iant at google dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Wed, 07 Apr 2010 20:48:11 -0700
- Subject: Re: [PATCH][GOLD] Handle symbols with section index SHN_XINDEX correctly.
- References: <o2r498552561004071859xdc181026kad89b0bb5da713e0@mail.gmail.com>
"Doug Kwan (éæå)" <dougkwan@google.com> writes:
> 2010-04-07 Doug Kwan <dougkwan@google.com>
>
> * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
> if section is marked as containing instructions but has no mapping
> symbols.
> (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
> correct section index.
> (Arm_relobj::find_linked_text_section): Ditto.
> @@ -6101,7 +6108,9 @@ Arm_relobj<big_endian>::do_count_local_s
> const char* sym_name = pnames + sym.get_st_name();
> if (Target_arm<big_endian>::is_mapping_symbol_name(sym_name))
> {
> - unsigned int input_shndx = sym.get_st_shndx();
> + bool is_ordinary;
> + unsigned int input_shndx =
> + this->adjust_sym_shndx(i, sym.get_st_shndx(), &is_ordinary);
>
> // Strip of LSB in case this is a THUMB symbol.
> Mapping_symbol_position msp(input_shndx, input_value & ~1U);
> @@ -6284,7 +6293,9 @@ Arm_relobj<big_endian>::find_linked_text
> elfcpp::Sym<32, big_endian> sym(psyms + r_sym * sym_size);
> if (sym.get_st_type() == elfcpp::STT_SECTION)
> {
> - *pshndx = this->adjust_shndx(sym.get_st_shndx());
> + bool is_ordinary;
> + *pshndx =
> + this->adjust_sym_shndx(r_sym, sym.get_st_shndx(), &is_ordinary);
> return true;
> }
> else
I'm not sure it's safe to ignore is_ordinary. I think you should at
least add
gold_assert(is_ordinary);
Otherwise you could silently do something really weird. Presumably
is_ordinary is expected to be always true for these symbols.
This is OK with that change.
Ian