[patch x64 seh]: Check for validity of segments for seh ops

Kai Tietz ktietz70@googlemail.com
Wed Sep 15 16:42:00 GMT 2010


2010/9/15 Richard Henderson <rth@redhat.com>:
> On 09/15/2010 08:09 AM, Kai Tietz wrote:
>> +static int
>> +seh_validate_seg (const char *directive, segT cseg)
>> +{
>> +  const char *cseg_name, *nseg_name;
>> +  if (cseg == now_seg)
>> +    return 1;
>> +  cseg_name = bfd_get_section_name (stdoutput, cseg);
>> +  nseg_name = bfd_get_section_name (stdoutput, now_seg);
>> +  if (!strcmp (cseg_name, nseg_name))
>> +    return 1;
>
> I should think that the first comparison would be all
> you need, and the second would be redundant.  Do you
> have a test case to the contrary?

Well, I don't. But hypotetically it would be possible. If it isn't, I
can remove this string-compare. I need the names anyway to print
error-message.

> You might as well make use of the global variable,
> since all users pass seh_ctx_cur->code_seg.
Hmm, well, do you think it makes things here better?

> You might consider merging this function into
> verify_context.  One could consider the current
> section part of the context.

Hmm, this isn't a good idea IMHO, as not all .seh_ operands are
requirying to be called in same code-segment as initial .seh_proc
statement.

Regards,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination



More information about the Binutils mailing list