Re: [PATCH 01/11] ftrace: handle generic arch calls

Steven Rostedt
2008-10-29T19:24:30Z

On Wed, 29 Oct 2008, Sam Ravnborg wrote:
> >
> > +if ($arch eq "x86") {
> > + if ($bits == 64) {
> > + $arch = "x86_64";
> > + } else {
> > + $arch = "i386";
> > + }
> > +}
> > +
> > if ($arch eq "x86_64") {
> > $section_regex = "Disassembly of section";
> > $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
> >
>
> This looks strange to my eyes.
> Why not do the more obvious:
> if ($arch eq "x86" && $bits == 64) {
>
> The change above is like trying to stick to the old i386/x86_64
> notation.

Trying to fix it tells me my answer to why I did it his way ;-)

I have queued patches that will support other archs so x86 is not the
only arch that can be used here. But x86 is special, it seems to be the
only arch (that I know of, correct me if I'm wrong) that can compile with
multiple archs defined: make ARCH=x86_64, make ARCH=i386, or
make ARCH=x86. All are legit.

Now how do we handle this. I've been fine for all my testing to do just
x86_64 and i386 because a normal make of x86 will use automatically set
ARCH to i386 or x86_64 depending on the build.

But then Adrian Bunk pointed out that "make ARCH=x86" fails. Now I need to
add a case for x86, but still allow for x86_64 or i386 being passed in.

Since x86 is the ambiguous case, I made it the one that would be converted
to i386 or x86_64 since those could be passed in directly.

Seems that the best approach is still what is there :-/

-- Steve