Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Jul 2010 13:34:26 +0300
From:      Andriy Gapon <avg@freebsd.org>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>, freebsd-hackers@freebsd.org
Cc:        Konstantin Belousov <kib@freebsd.org>, Navdeep Parhar <np@freebsd.org>, Peter Wemm <peter@freebsd.org>
Subject:   Re: elf obj load: skip zero-sized sections early
Message-ID:  <4C36FB32.30901@freebsd.org>
In-Reply-To: <4C343C68.8010302@freebsd.org>
References:  <4C246CD0.3020606@freebsd.org> <20100702082754.S14969@maildrop.int.zabbadoz.net> <4C320E6E.4040007@freebsd.org> <20100705171155.K14969@maildrop.int.zabbadoz.net> <4C321409.2070500@freebsd.org> <4C343C68.8010302@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C36FB32.30901>