Skip to content

Commit 6e7b64b

Browse files
arndbtorvalds
authored andcommitted
elfcore: fix building with clang
kernel/elfcore.c only contains weak symbols, which triggers a bug with clang in combination with recordmcount: Cannot find symbol for section 2: .text. kernel/elfcore.o: failed Move the empty stubs into linux/elfcore.h as inline functions. As only two architectures use these, just use the architecture specific Kconfig symbols to key off the declaration. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Barret Rhoden <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 55d5b7d commit 6e7b64b

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed

include/linux/elfcore.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ static inline int elf_core_copy_task_fpregs(struct task_struct *t, struct pt_reg
104104
#endif
105105
}
106106

107+
#if defined(CONFIG_UM) || defined(CONFIG_IA64)
107108
/*
108109
* These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
109110
* extra segments containing the gate DSO contents. Dumping its
@@ -118,5 +119,26 @@ elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset);
118119
extern int
119120
elf_core_write_extra_data(struct coredump_params *cprm);
120121
extern size_t elf_core_extra_data_size(void);
122+
#else
123+
static inline Elf_Half elf_core_extra_phdrs(void)
124+
{
125+
return 0;
126+
}
127+
128+
static inline int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
129+
{
130+
return 1;
131+
}
132+
133+
static inline int elf_core_write_extra_data(struct coredump_params *cprm)
134+
{
135+
return 1;
136+
}
137+
138+
static inline size_t elf_core_extra_data_size(void)
139+
{
140+
return 0;
141+
}
142+
#endif
121143

122144
#endif /* _LINUX_ELFCORE_H */

kernel/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
9797
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
9898
obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
9999
obj-$(CONFIG_LATENCYTOP) += latencytop.o
100-
obj-$(CONFIG_ELFCORE) += elfcore.o
101100
obj-$(CONFIG_FUNCTION_TRACER) += trace/
102101
obj-$(CONFIG_TRACING) += trace/
103102
obj-$(CONFIG_TRACE_CLOCK) += trace/

kernel/elfcore.c

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)