elf obj load: skip zero-sized sections early

Andriy Gapon avg at freebsd.org
Fri Jul 9 10:34:32 UTC 2010


Having thought and experimented more, I don't see why we need inline assembly at
all and why DPCPU_DEFINE can not simply be defined as follows:

#define DPCPU_DEFINE(t, n)	\
	t DPCPU_NAME(n) __section("set_pcpu") \
	__aligned(CACHE_LINE_SIZE) __used

And, honestly, I can not understand the following comment in pcpu.h, although I
think I understand what's going on.

> /*
>  * Define a set for pcpu data.
>  * 
>  * We don't use SET_DECLARE because it defines the set as 'a' when we

Hmm, SET_DECLARE doesn't do anything like that.
Perhaps __MAKE_SET or one of its aliases was meant here?

>  * want 'aw'.  gcc considers uninitialized data in a separate section
>  * writable, and there is no generic zero initializer that works for
>  * structs and scalars.
>  */

So, what's the problem here?
Don't we want that data to be considered writable?  Haven't we just said that we
want "aw"?  Don't we explicitly create a section with "aw" flags?

And why do we need a (universal) initializer?  Why is it mentioned here at all?

Educate me.  I demand it! :-)

-- 
Andriy Gapon


More information about the freebsd-hackers mailing list