This is the mail archive of the binutils@sources.redhat.com 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]

Re: RFC: Handle relocations against removed sections


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


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