*(.init.setup)
__setup_end = .;
- __initcall_start = .;
+ __presmp_initcall_start = .;
*(.initcallpresmp.init)
__presmp_initcall_end = .;
+ __initcall_start = .;
*(.initcall1.init)
__initcall_end = .;
*(.init.setup)
__setup_end = .;
- __initcall_start = .;
+ __presmp_initcall_start = .;
*(.initcallpresmp.init)
__presmp_initcall_end = .;
+ __initcall_start = .;
*(.initcall1.init)
__initcall_end = .;
tainted |= flag;
}
-extern const initcall_t __initcall_start[], __presmp_initcall_end[],
- __initcall_end[];
+DECLARE_ARRAY_BOUNDS(initcall);
+typedef initcall_t presmp_initcall_t;
+DECLARE_ARRAY_BOUNDS(presmp_initcall);
void __init do_presmp_initcalls(void)
{
const initcall_t *call;
- for ( call = __initcall_start; call < __presmp_initcall_end; call++ )
+ for ( call = __presmp_initcall_start;
+ presmp_initcall_lt(call, __presmp_initcall_end);
+ call++ )
(*call)();
}
void __init do_initcalls(void)
{
const initcall_t *call;
- for ( call = __presmp_initcall_end; call < __initcall_end; call++ )
+ for ( call = __initcall_start;
+ initcall_lt(call, __initcall_end);
+ call++ )
(*call)();
}
}
typedef void (*ctor_func_t)(void);
-extern const ctor_func_t __ctors_start[], __ctors_end[];
+DECLARE_BOUNDS(ctor_func, __ctors_start, __ctors_end);
void __init init_constructors(void)
{
const ctor_func_t *f;
- for ( f = __ctors_start; f < __ctors_end; ++f )
+
+ for ( f = __ctors_start;
+ ctor_func_lt(f, __ctors_end);
+ ++f )
(*f)();
/* Putting this here seems as good (or bad) as any other place. */
/* Scratch space for cpumasks. */
DEFINE_PER_CPU(cpumask_t, cpumask_scratch);
-extern const struct scheduler *__start_schedulers_array[], *__end_schedulers_array[];
-#define NUM_SCHEDULERS (__end_schedulers_array - __start_schedulers_array)
+/*
+ * Cannot use typedef because it would make the schedulers array
+ * const: the pointers become const, instead of the pointed
+ * struct schedulers.
+ */
+#define schedulers_t struct scheduler*
+DECLARE_BOUNDS(schedulers, __start_schedulers_array, __end_schedulers_array);
+#define NUM_SCHEDULERS (schedulers_diff(__start_schedulers_array, \
+ __end_schedulers_array))
#define schedulers __start_schedulers_array
static struct scheduler __read_mostly ops;
typedef void lock_profile_subfunc(
struct lock_profile *, int32_t, int32_t, void *);
-extern struct lock_profile *__lock_profile_start;
-extern struct lock_profile *__lock_profile_end;
+typedef struct lock_profile* lock_profile_t;
+DECLARE_BOUNDS(lock_profile, __lock_profile_start, __lock_profile_end);
static s_time_t lock_profile_start;
static struct lock_profile_anc lock_profile_ancs[LOCKPROF_TYPE_N];
{
struct lock_profile **q;
- for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
+ for ( q = &__lock_profile_start;
+ lock_profile_lt(q, &__lock_profile_end);
+ q++ )
{
(*q)->next = lock_profile_glb_q.elem_q;
lock_profile_glb_q.elem_q = *q;
#ifdef BUILD_ID
/* Defined in linker script. */
-extern const Elf_Note __note_gnu_build_id_start[], __note_gnu_build_id_end[];
+typedef Elf_Note elf_note_t;
+DECLARE_BOUNDS(elf_note, __note_gnu_build_id_start, __note_gnu_build_id_end);
int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
const void **p, unsigned int *len)
int rc;
/* --build-id invoked with wrong parameters. */
- if ( __note_gnu_build_id_end <= &n[0] )
+ if ( !elf_note_lt(&n[0], __note_gnu_build_id_end) )
return -ENODATA;
/* Check for full Note header. */
- if ( &n[1] >= __note_gnu_build_id_end )
+ if ( !elf_note_lt(&n[1], __note_gnu_build_id_end) )
return -ENODATA;
- sz = (void *)__note_gnu_build_id_end - (void *)n;
+ sz = elf_note_bytediff(n, __note_gnu_build_id_end);
rc = xen_build_id_check(n, sz, &build_id_p, &build_id_len);