This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Handle relocations against removed sections
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: Re: RFC: Handle relocations against removed sections
- From: Alan Modra <amodra at bigpond dot net dot au>
- Date: Sat, 3 Nov 2001 20:20:48 +1030
- Cc: binutils at sourceware dot cygnus dot com, GDB <gdb at sourceware dot cygnus dot com>
- References: <20011102121027.A11866@lucon.org>
On Fri, Nov 02, 2001 at 12:10:27PM -0800, H . J . Lu wrote:
> This patch handles relocations against removed sections. It has:
>
> 1. A section is removed iff
>
> ! bfd_is_abs_section (sec) && bfd_is_abs_section (sec->output_section)
>
> 2. Zero relocations against removed sections in debug sections before
> 20031005 and issue a fatal error after that.
>
> 3. Zero relocations against removed linkonce sections before 20031005 and
> issue a fatal error after that.
>
> 4. Relocation against removed section is a fatal error.
>
> Any comments?
What you're doing here looks reasonable to me.
> + {
> +#define SECTION_MESSAGE "local symbols in discarded section"
> + boolean ok;
> + char *buf
> + = (char *) bfd_malloc
> + (strlen (sec->name) + 3
> + + sizeof ( SECTION_MESSAGE));
> + if (buf != NULL)
> + sprintf (buf, "%s: %s",
> + SECTION_MESSAGE, sec->name);
> + else
> + buf = (char *) sec->name;
> + ok = (*finfo->info->callbacks->undefined_symbol)
> + (finfo->info, buf,
> + input_bfd, o, rel->r_offset,
> + true);
> + if (buf != sec->name)
> + free (buf);
> + if (!ok)
> + return false;
> + }
Except for this bit, because the message needs to be internationalised.
I would just call undefined_symbol on the section name.
Alan