This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

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


2010/9/15 Kai Tietz <ktietz70@googlemail.com>:
> 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.

So, my tests have shown that comparison of seh_ctx_cur->code_seg ==
now_seg are working well (for those tests I have).
I removed the cseg argument from the seh_validate_seg function. As
this check is also necessary in obj_coff_seh_endproc and here the
other validation routines aren't used, I want to keep seh_validate_seg
function.

Patch attached, ok for apply?

Regards,
Kai

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

Attachment: seh_validate_seg.diff
Description: Binary data


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