Skip to content

Commit c547778

Browse files
akpm00hnaz
authored andcommitted
powerpc-factor-out-relocation-code-from-module_64c-to-elf_util_64c-checkpatch-fixes
WARNING: do not add new typedefs torvalds#86: FILE: arch/powerpc/include/asm/elf_util.h:35: +typedef unsigned long func_desc_t; WARNING: do not add new typedefs torvalds#90: FILE: arch/powerpc/include/asm/elf_util.h:39: +typedef struct ppc64_opd_entry func_desc_t; WARNING: Block comments use * on subsequent lines torvalds#94: FILE: arch/powerpc/include/asm/elf_util.h:43: +/* Like PPC32, we need little trampolines to do > 24-bit jumps (into + the kernel itself). But on PPC64, these need to be used for every WARNING: Block comments use a trailing */ on a separate line torvalds#95: FILE: arch/powerpc/include/asm/elf_util.h:44: + jump, actually, to reset r2 (TOC+0x8000). */ ERROR: open brace '{' following struct go on the same line torvalds#97: FILE: arch/powerpc/include/asm/elf_util.h:46: +struct ppc64_stub_entry +{ WARNING: Block comments use a trailing */ on a separate line torvalds#100: FILE: arch/powerpc/include/asm/elf_util.h:49: + * so we don't have to modify the trampoline load instruction. */ WARNING: Block comments use * on subsequent lines torvalds#110: FILE: arch/powerpc/include/asm/elf_util.h:59: +/* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this + gives the value maximum span in an instruction which uses a signed WARNING: Block comments use a trailing */ on a separate line torvalds#111: FILE: arch/powerpc/include/asm/elf_util.h:60: + offset) */ WARNING: Block comments use * on subsequent lines torvalds#132: FILE: arch/powerpc/include/asm/module.h:18: +/* Both low and high 16 bits are added as SIGNED additions, so if low + 16 bits has high bit set, high 16 bits must be adjusted. These WARNING: Block comments use a trailing */ on a separate line torvalds#133: FILE: arch/powerpc/include/asm/module.h:19: + macros do that (stolen from binutils). */ WARNING: space prohibited between function name and open parenthesis '(' torvalds#136: FILE: arch/powerpc/include/asm/module.h:22: +#define PPC_HA(v) PPC_HI ((v) + 0x8000) ERROR: Macros with complex values should be enclosed in parentheses torvalds#136: FILE: arch/powerpc/include/asm/module.h:22: +#define PPC_HA(v) PPC_HI ((v) + 0x8000) WARNING: please, no spaces at the start of a line torvalds#210: FILE: arch/powerpc/kernel/elf_util_64.c:32: + (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)$ WARNING: Block comments use a trailing */ on a separate line torvalds#216: FILE: arch/powerpc/kernel/elf_util_64.c:38: + * of function and try to derive r2 from it). */ WARNING: line over 80 characters torvalds#357: FILE: arch/powerpc/kernel/elf_util_64.c:179: + value = stub_for_addr(elf_info, value, obj_name); WARNING: line over 80 characters torvalds#363: FILE: arch/powerpc/kernel/elf_util_64.c:185: + squash_toc_save_inst(strtab + sym->st_name, value); ERROR: space required before the open brace '{' torvalds#369: FILE: arch/powerpc/kernel/elf_util_64.c:191: + if (value + 0x2000000 > 0x3ffffff || (value & 3) != 0){ WARNING: line over 80 characters torvalds#560: FILE: arch/powerpc/kernel/module_64.c:341: + sechdrs[me->arch.elf_info.stubs_section].sh_size = get_stubs_size(hdr, sechdrs); WARNING: line over 80 characters torvalds#613: FILE: arch/powerpc/kernel/module_64.c:380: + struct elf_shdr *stubs_sec = &elf_info->sechdrs[elf_info->stubs_section]; WARNING: line over 80 characters torvalds#889: FILE: arch/powerpc/kernel/module_64.c:498: + num_stubs = sechdrs[me->arch.elf_info.stubs_section].sh_size / sizeof(*entry); total: 3 errors, 17 warnings, 830 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. ./patches/powerpc-factor-out-relocation-code-from-module_64c-to-elf_util_64c.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches Cc: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent c135084 commit c547778

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

arch/powerpc/include/asm/elf_util.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ typedef unsigned long func_desc_t;
3939
typedef struct ppc64_opd_entry func_desc_t;
4040
#endif /* PPC64_ELF_ABI_v2 */
4141

42-
/* Like PPC32, we need little trampolines to do > 24-bit jumps (into
43-
the kernel itself). But on PPC64, these need to be used for every
44-
jump, actually, to reset r2 (TOC+0x8000). */
45-
struct ppc64_stub_entry
46-
{
42+
/*
43+
* Like PPC32, we need little trampolines to do > 24-bit jumps (into
44+
* the kernel itself). But on PPC64, these need to be used for every
45+
* jump, actually, to reset r2 (TOC+0x8000).
46+
*/
47+
struct ppc64_stub_entry {
4748
/* 28 byte jump instruction sequence (7 instructions). We only
4849
* need 6 instructions on ABIv2 but we always allocate 7 so
4950
* so we don't have to modify the trampoline load instruction. */

arch/powerpc/include/asm/module.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
#include <asm-generic/module.h>
1515
#include <asm/elf_util.h>
1616

17-
/* Both low and high 16 bits are added as SIGNED additions, so if low
18-
16 bits has high bit set, high 16 bits must be adjusted. These
19-
macros do that (stolen from binutils). */
17+
/*
18+
* Both low and high 16 bits are added as SIGNED additions, so if low 16 bits
19+
* has high bit set, high 16 bits must be adjusted. These macros do that
20+
* (stolen from binutils).
21+
*/
2022
#define PPC_LO(v) ((v) & 0xffff)
2123
#define PPC_HI(v) (((v) >> 16) & 0xffff)
22-
#define PPC_HA(v) PPC_HI ((v) + 0x8000)
24+
#define PPC_HA(v) PPC_HI((v) + 0x8000)
2325

2426
#ifndef __powerpc64__
2527
/*

arch/powerpc/kernel/elf_util_64.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ struct module;
3333

3434
static unsigned int local_entry_offset(const Elf64_Sym *sym)
3535
{
36-
/* sym->st_other indicates offset to local entry point
36+
/*
37+
* sym->st_other indicates offset to local entry point
3738
* (otherwise it will assume r12 is the address of the start
38-
* of function and try to derive r2 from it). */
39+
* of function and try to derive r2 from it).
40+
*/
3941
return PPC64_LOCAL_ENTRY_OFFSET(sym->st_other);
4042
}
4143
#else
@@ -176,19 +178,21 @@ int elf64_apply_relocate_add(const struct elf_info *elf_info,
176178
/* FIXME: Handle weak symbols here --RR */
177179
if (sym->st_shndx == SHN_UNDEF) {
178180
/* External: go via stub */
179-
value = stub_for_addr(elf_info, value, obj_name);
181+
value = stub_for_addr(elf_info, value,
182+
obj_name);
180183
if (!value)
181184
return -ENOENT;
182185
if (!restore_r2((u32 *)location + 1, obj_name))
183186
return -ENOEXEC;
184187

185-
squash_toc_save_inst(strtab + sym->st_name, value);
188+
squash_toc_save_inst(strtab + sym->st_name,
189+
value);
186190
} else
187191
value += local_entry_offset(sym);
188192

189193
/* Convert value to relative */
190194
value -= (unsigned long)location;
191-
if (value + 0x2000000 > 0x3ffffff || (value & 3) != 0){
195+
if (value + 0x2000000 > 0x3ffffff || (value & 3) != 0) {
192196
pr_err("%s: REL24 %li out of range!\n",
193197
obj_name, (long int)value);
194198
return -ENOEXEC;

arch/powerpc/kernel/module_64.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,11 @@ static inline int create_stub(const struct elf_info *elf_info,
377377
unsigned long stub_for_addr(const struct elf_info *elf_info, unsigned long addr,
378378
const char *obj_name)
379379
{
380-
struct elf_shdr *stubs_sec = &elf_info->sechdrs[elf_info->stubs_section];
380+
struct elf_shdr *stubs_sec;
381381
struct ppc64_stub_entry *stubs;
382382
unsigned int i, num_stubs;
383383

384+
stubs_sec = &elf_info->sechdrs[elf_info->stubs_section];
384385
num_stubs = stubs_sec->sh_size / sizeof(*stubs);
385386

386387
/* Find this stub, or if that fails, the next avail. entry */

0 commit comments

Comments
 (0)