Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288007
b: refs/heads/master
c: dd2a3ac
h: refs/heads/master
i:
  288005: 9cbe960
  288003: dca2a6d
  287999: bd8cb86
v: v3
  • Loading branch information
Andreas Bießmann authored and Rusty Russell committed Feb 26, 2012
1 parent bba0ac6 commit bb2921c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f694fc9729a12094cd0cef8b0c765071972865c8
refs/heads/master: dd2a3acaecd7abb2d43b09a823cf2e4c967fa2ac
2 changes: 1 addition & 1 deletion trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3780,7 +3780,7 @@ F: Documentation/kdump/

KERNEL AUTOMOUNTER v4 (AUTOFS4)
M: Ian Kent <raven@themaw.net>
L: autofs@vger.kernel.org
L: autofs@linux.kernel.org
S: Maintained
F: fs/autofs4/

Expand Down
35 changes: 31 additions & 4 deletions trunk/scripts/mod/file2alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,37 @@ struct devtable {
void *function;
};

#define ___cat(a,b) a ## b
#define __cat(a,b) ___cat(a,b)

/* we need some special handling for this host tool running eventually on
* Darwin. The Mach-O section handling is a bit different than ELF section
* handling. The differnces in detail are:
* a) we have segments which have sections
* b) we need a API call to get the respective section symbols */
#if defined(__MACH__)
#include <mach-o/getsect.h>

#define INIT_SECTION(name) do { \
unsigned long name ## _len; \
char *__cat(pstart_,name) = getsectdata("__TEXT", \
#name, &__cat(name,_len)); \
char *__cat(pstop_,name) = __cat(pstart_,name) + \
__cat(name, _len); \
__cat(__start_,name) = (void *)__cat(pstart_,name); \
__cat(__stop_,name) = (void *)__cat(pstop_,name); \
} while (0)
#define SECTION(name) __attribute__((section("__TEXT, " #name)))

struct devtable **__start___devtable, **__stop___devtable;
#else
#define INIT_SECTION(name) /* no-op for ELF */
#define SECTION(name) __attribute__((section(#name)))

/* We construct a table of pointers in an ELF section (pointers generally
* go unpadded by gcc). ld creates boundary syms for us. */
extern struct devtable *__start___devtable[], *__stop___devtable[];
#define ___cat(a,b) a ## b
#define __cat(a,b) ___cat(a,b)
#endif /* __MACH__ */

#if __GNUC__ == 3 && __GNUC_MINOR__ < 3
# define __used __attribute__((__unused__))
Expand All @@ -65,8 +91,8 @@ extern struct devtable *__start___devtable[], *__stop___devtable[];
(type *)NULL, \
(char *)NULL)), \
sizeof(type), (function) }; \
static struct devtable *__attribute__((section("__devtable"))) \
__used __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__)
static struct devtable *SECTION(__devtable) __used \
__cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__)

#define ADD(str, sep, cond, field) \
do { \
Expand Down Expand Up @@ -1080,6 +1106,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
do_pnp_card_entries(symval, sym->st_size, mod);
else {
struct devtable **p;
INIT_SECTION(__devtable);

for (p = __start___devtable; p < __stop___devtable; p++) {
if (sym_is(name, namelen, (*p)->device_id)) {
Expand Down

0 comments on commit bb2921c

Please sign in to comment.