Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
af92a82d
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
af92a82d
编写于
1月 30, 2010
作者:
U
Uwe Kleine-König
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modpost: make symbol white list a per mismatch type variable
Signed-off-by:
N
Uwe Kleine-König
<
u.kleine-koenig@pengutronix.de
>
上级
fc2f7efa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
18 deletion
+31
-18
scripts/mod/modpost.c
scripts/mod/modpost.c
+31
-18
未找到文件。
scripts/mod/modpost.c
浏览文件 @
af92a82d
...
...
@@ -817,18 +817,15 @@ static const char *data_sections[] = { DATA_SECTIONS, NULL };
/* symbols in .data that may refer to init/exit sections */
static
const
char
*
symbol_white_list
[]
=
{
"*driver"
,
"*_template"
,
/* scsi uses *_template a lot */
"*_timer"
,
/* arm uses ops structures named _timer a lot */
"*_sht"
,
/* scsi also used *_sht to some extent */
"*_ops"
,
"*_probe"
,
"*_probe_one"
,
"*_console"
,
NULL
};
#define DEFAULT_SYMBOL_WHITE_LIST \
"*driver", \
"*_template",
/* scsi uses *_template a lot */
\
"*_timer",
/* arm uses ops structures named _timer a lot */
\
"*_sht",
/* scsi also used *_sht to some extent */
\
"*_ops", \
"*_probe", \
"*_probe_one", \
"*_console"
static
const
char
*
head_sections
[]
=
{
".head.text*"
,
NULL
};
static
const
char
*
linker_symbols
[]
=
...
...
@@ -850,6 +847,7 @@ struct sectioncheck {
const
char
*
fromsec
[
20
];
const
char
*
tosec
[
20
];
enum
mismatch
mismatch
;
const
char
*
symbol_white_list
[
20
];
};
const
struct
sectioncheck
sectioncheck
[]
=
{
...
...
@@ -860,75 +858,88 @@ const struct sectioncheck sectioncheck[] = {
.
fromsec
=
{
TEXT_SECTIONS
,
NULL
},
.
tosec
=
{
ALL_INIT_SECTIONS
,
NULL
},
.
mismatch
=
TEXT_TO_ANY_INIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
{
.
fromsec
=
{
DATA_SECTIONS
,
NULL
},
.
tosec
=
{
ALL_INIT_SECTIONS
,
NULL
},
.
mismatch
=
DATA_TO_ANY_INIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
{
.
fromsec
=
{
TEXT_SECTIONS
,
NULL
},
.
tosec
=
{
ALL_EXIT_SECTIONS
,
NULL
},
.
mismatch
=
TEXT_TO_ANY_EXIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
{
.
fromsec
=
{
DATA_SECTIONS
,
NULL
},
.
tosec
=
{
ALL_EXIT_SECTIONS
,
NULL
},
.
mismatch
=
DATA_TO_ANY_EXIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not reference init code/data from devinit/cpuinit/meminit code/data */
{
.
fromsec
=
{
ALL_XXXINIT_SECTIONS
,
NULL
},
.
tosec
=
{
INIT_SECTIONS
,
NULL
},
.
mismatch
=
XXXINIT_TO_SOME_INIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not reference cpuinit code/data from meminit code/data */
{
.
fromsec
=
{
MEM_INIT_SECTIONS
,
NULL
},
.
tosec
=
{
CPU_INIT_SECTIONS
,
NULL
},
.
mismatch
=
XXXINIT_TO_SOME_INIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not reference meminit code/data from cpuinit code/data */
{
.
fromsec
=
{
CPU_INIT_SECTIONS
,
NULL
},
.
tosec
=
{
MEM_INIT_SECTIONS
,
NULL
},
.
mismatch
=
XXXINIT_TO_SOME_INIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
{
.
fromsec
=
{
ALL_XXXEXIT_SECTIONS
,
NULL
},
.
tosec
=
{
EXIT_SECTIONS
,
NULL
},
.
mismatch
=
XXXEXIT_TO_SOME_EXIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not reference cpuexit code/data from memexit code/data */
{
.
fromsec
=
{
MEM_EXIT_SECTIONS
,
NULL
},
.
tosec
=
{
CPU_EXIT_SECTIONS
,
NULL
},
.
mismatch
=
XXXEXIT_TO_SOME_EXIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not reference memexit code/data from cpuexit code/data */
{
.
fromsec
=
{
CPU_EXIT_SECTIONS
,
NULL
},
.
tosec
=
{
MEM_EXIT_SECTIONS
,
NULL
},
.
mismatch
=
XXXEXIT_TO_SOME_EXIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not use exit code/data from init code */
{
.
fromsec
=
{
ALL_INIT_SECTIONS
,
NULL
},
.
tosec
=
{
ALL_EXIT_SECTIONS
,
NULL
},
.
mismatch
=
ANY_INIT_TO_ANY_EXIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not use init code/data from exit code */
{
.
fromsec
=
{
ALL_EXIT_SECTIONS
,
NULL
},
.
tosec
=
{
ALL_INIT_SECTIONS
,
NULL
},
.
mismatch
=
ANY_EXIT_TO_ANY_INIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
},
/* Do not export init/exit functions or data */
{
.
fromsec
=
{
"__ksymtab*"
,
NULL
},
.
tosec
=
{
INIT_SECTIONS
,
EXIT_SECTIONS
,
NULL
},
.
mismatch
=
EXPORT_TO_INIT_EXIT
.
mismatch
=
EXPORT_TO_INIT_EXIT
,
.
symbol_white_list
=
{
DEFAULT_SYMBOL_WHITE_LIST
,
NULL
},
}
};
...
...
@@ -985,7 +996,8 @@ static const struct sectioncheck *section_mismatch(
* refsymname = __init_begin, _sinittext, _einittext
*
**/
static
int
secref_whitelist
(
const
char
*
fromsec
,
const
char
*
fromsym
,
static
int
secref_whitelist
(
const
struct
sectioncheck
*
mismatch
,
const
char
*
fromsec
,
const
char
*
fromsym
,
const
char
*
tosec
,
const
char
*
tosym
)
{
/* Check for pattern 1 */
...
...
@@ -997,7 +1009,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
/* Check for pattern 2 */
if
(
match
(
tosec
,
init_exit_sections
)
&&
match
(
fromsec
,
data_sections
)
&&
match
(
fromsym
,
symbol_white_list
))
match
(
fromsym
,
mismatch
->
symbol_white_list
))
return
0
;
/* Check for pattern 3 */
...
...
@@ -1202,7 +1214,7 @@ static void report_sec_mismatch(const char *modname,
fromsym
,
sec2annotation
(
tosec
),
tosym
);
break
;
case
DATA_TO_ANY_INIT
:
{
const
char
*
*
s
=
symbol_white_list
;
const
char
*
const
*
s
=
mismatch
->
symbol_white_list
;
fprintf
(
stderr
,
"The variable %s references
\n
"
"the %s %s%s%s
\n
"
...
...
@@ -1223,7 +1235,7 @@ static void report_sec_mismatch(const char *modname,
fromsym
,
to
,
to
,
tosym
,
to_p
,
sec2annotation
(
tosec
),
tosym
);
break
;
case
DATA_TO_ANY_EXIT
:
{
const
char
*
*
s
=
symbol_white_list
;
const
char
*
const
*
s
=
mismatch
->
symbol_white_list
;
fprintf
(
stderr
,
"The variable %s references
\n
"
"the %s %s%s%s
\n
"
...
...
@@ -1304,7 +1316,8 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf,
tosym
=
sym_name
(
elf
,
to
);
/* check whitelist - we may ignore it */
if
(
secref_whitelist
(
fromsec
,
fromsym
,
tosec
,
tosym
))
{
if
(
secref_whitelist
(
mismatch
,
fromsec
,
fromsym
,
tosec
,
tosym
))
{
report_sec_mismatch
(
modname
,
mismatch
,
fromsec
,
r
->
r_offset
,
fromsym
,
is_function
(
from
),
tosec
,
tosym
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录