Re: [PATCH] pop previous section in alternative.c

From: H. Peter Anvin
Date: Thu Apr 10 2008 - 12:15:57 EST


Linus Torvalds wrote:

The thing is, we'd be much better off with some sanity checking in the assembler.

Which is likely not going to happen - oh well.

In particular, the assembler should see patterns like

.size function, .-function

and it should be _trivially_ able to check that "." and "function" are in the same section, and warn if they aren't. Because I don't see how it could ever be valid to have sizes that cross section boundaries (it's a totally nonsensical concept).

But it doesn't. Oh, well.


Wow. That is utterly braindamaged on the part of gas.

But maybe we can see it in the resulting object file somehow, and do the check there (the same way we do the init-section analysis). I assume the .size directive writes some debug info or similar, and we can create a big warning when a size is unexpectedly huge and crosses section size boundaries?

I just tried it, and it output the difference across the sections, without any consideration that the base was different. Didn't know one could write an assembler that dumb.

-hpa

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/