mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 05:54:11 +08:00
Simplify linker set handling
This commit is contained in:
@@ -122,9 +122,7 @@ SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL);
|
||||
* The sysinit table itself. Items are checked off as the are run.
|
||||
* If we want to register new sysinit types, add them to newsysinit.
|
||||
*/
|
||||
#endif /* __rtems__ */
|
||||
SET_DECLARE(sysinit_set, struct sysinit);
|
||||
#ifndef __rtems__
|
||||
struct sysinit **sysinit, **sysinit_end;
|
||||
struct sysinit **newsysinit, **newsysinit_end;
|
||||
|
||||
@@ -162,6 +160,8 @@ sysinit_add(struct sysinit **set, struct sysinit **set_end)
|
||||
newsysinit = newset;
|
||||
newsysinit_end = newset + count;
|
||||
}
|
||||
#else /* __rtems__ */
|
||||
RWSET_DECLARE(sysinit_set, struct sysinit);
|
||||
#endif /* __rtems__ */
|
||||
|
||||
#if defined (DDB) && defined(VERBOSE_SYSINIT)
|
||||
|
@@ -255,7 +255,7 @@ struct sysinit {
|
||||
func, \
|
||||
(ident) \
|
||||
}; \
|
||||
DATA_SET(sysinit_set,SYSINIT_ENTRY_NAME(uniquifier))
|
||||
RWDATA_SET(sysinit_set,SYSINIT_ENTRY_NAME(uniquifier))
|
||||
#define SYSINIT_REFERENCE(uniquifier) \
|
||||
extern struct sysinit SYSINIT_ENTRY_NAME(uniquifier); \
|
||||
static struct sysinit const * const \
|
||||
|
@@ -51,9 +51,25 @@
|
||||
static void const * const __set_##set##_sym_##sym \
|
||||
__section("set_" #set) __used = &sym
|
||||
#else /* __rtems__ */
|
||||
#define RTEMS_BSD_DEFINE_SET(set, ptype) \
|
||||
ptype * const __CONCAT(_bsd__start_set_,set)[0] \
|
||||
__section(".rtemsroset.bsd." __STRING(set) ".begin") __used; \
|
||||
ptype * const __CONCAT(_bsd__stop_set_,set)[0] \
|
||||
__section(".rtemsroset.bsd." __STRING(set) ".end") __used
|
||||
|
||||
#define __MAKE_SET(set, sym) \
|
||||
static void const * const __set_##set##_sym_##sym \
|
||||
__section("_bsd_set_" #set) __used = &sym
|
||||
static const void * const __set_##set##_sym_##sym \
|
||||
__section(".rtemsroset.bsd." __STRING(set) ".content") __used = &sym
|
||||
|
||||
#define RTEMS_BSD_DEFINE_RWSET(set, ptype) \
|
||||
ptype *__CONCAT(_bsd__start_set_,set)[0] \
|
||||
__section(".rtemsrwset.bsd." __STRING(set) ".begin") __used; \
|
||||
ptype *__CONCAT(_bsd__stop_set_,set)[0] \
|
||||
__section(".rtemsrwset.bsd." __STRING(set) ".end") __used
|
||||
|
||||
#define __MAKE_RWSET(set, sym) \
|
||||
static const void * __set_##set##_sym_##sym \
|
||||
__section(".rtemsrwset.bsd." __STRING(set) ".content") __used = &sym
|
||||
#endif /* __rtems__ */
|
||||
#else /* !__GNUCLIKE___SECTION */
|
||||
#ifndef lint
|
||||
@@ -70,6 +86,9 @@
|
||||
#define BSS_SET(set, sym) __MAKE_SET(set, sym)
|
||||
#define ABS_SET(set, sym) __MAKE_SET(set, sym)
|
||||
#define SET_ENTRY(set, sym) __MAKE_SET(set, sym)
|
||||
#ifdef __rtems__
|
||||
#define RWDATA_SET(set, sym) __MAKE_RWSET(set, sym)
|
||||
#endif /* __rtems__ */
|
||||
|
||||
/*
|
||||
* Initialize before referring to a given linker set.
|
||||
@@ -85,8 +104,12 @@
|
||||
(&__CONCAT(__stop_set_,set))
|
||||
#else /* __rtems__ */
|
||||
#define SET_DECLARE(set, ptype) \
|
||||
extern ptype *__CONCAT(_bsd__start_set_,set) []; \
|
||||
extern ptype *__CONCAT(_bsd__stop_set_,set) []
|
||||
extern ptype * const __CONCAT(_bsd__start_set_,set)[]; \
|
||||
extern ptype * const __CONCAT(_bsd__stop_set_,set)[]
|
||||
|
||||
#define RWSET_DECLARE(set, ptype) \
|
||||
extern ptype *__CONCAT(_bsd__start_set_,set)[]; \
|
||||
extern ptype *__CONCAT(_bsd__stop_set_,set)[]
|
||||
|
||||
#define SET_BEGIN(set) \
|
||||
(__CONCAT(_bsd__start_set_,set))
|
||||
|
@@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved.
|
||||
* Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* Dornierstr. 4
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
@@ -57,6 +57,11 @@ SYSINIT_REFERENCE(linker_kernel);
|
||||
SYSINIT_MODULE_REFERENCE(rootbus);
|
||||
SYSINIT_DRIVER_REFERENCE(nexus, root);
|
||||
|
||||
RTEMS_BSD_DEFINE_SET(modmetadata_set, struct mod_metadata);
|
||||
RTEMS_BSD_DEFINE_SET(sysctl_set, struct sysctl_oid);
|
||||
|
||||
RTEMS_BSD_DEFINE_RWSET(sysinit_set, struct sysinit);
|
||||
|
||||
/* In FreeBSD this is a local function */
|
||||
void mi_startup(void);
|
||||
|
||||
|
Reference in New Issue
Block a user