[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 4/4] sched: Use the auto-generated list of schedulers



On 18/12/15 17:24, Jonathan Creekmore wrote:
>> On Dec 18, 2015, at 10:43 AM, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>
>>>>> On 18.12.15 at 17:00, <jonathan.creekmore@xxxxxxxxx> wrote:
>>> Jan Beulich writes:
>>>>>>> On 17.12.15 at 21:59, <jonathan.creekmore@xxxxxxxxx> wrote:
>>>>> +extern const struct scheduler *__schedulers_start[], *__schedulers_end[];
>>>>> +#define NUM_SCHEDULERS 
>>> (((uintptr_t)__schedulers_end-(uintptr_t)__schedulers_start) \
>>>>> +                        / sizeof(struct scheduler *))
>>>>> +static const struct scheduler **schedulers = __schedulers_start;
>>>> I really wonder whether we should continue follow this route of
>>>> __start_ / __stop_ symbols, instead of leveraging gas+ld's
>>>> .startof. and .sizeof. operators.
>>> So, I would love to explore using those operators if you can give me
>>> some link to documentation for using them. I have yet to be able to find
>>> a construct for LD and GCC that works correctly for generating
>>> equivalent symbols.
>> With binutils docs missing any notion of these, I can only refer
>> you to binutils sources, I'm afraid.
>>
> Well, I would prefer not to delve into undocumented behavior in what
> should be a fairly straightforward patch set, so I plan on keeping the use
> of the __start and __stop symbols.

One hint to pick up from the Linux side of things is that you can do:

extern const struct scheduler *__schedulers_start[], *__schedulers_end[];
#define NUM_SCHEDULERS (__schedulers_end - __schedulers_start)

and rely on the semantics of pointer arithmetic.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.