From patchwork Sun Jun 9 02:33:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Tang X-Patchwork-Id: 2693571 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3DE1C3FC23 for ; Sun, 9 Jun 2013 02:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751488Ab3FICe2 (ORCPT ); Sat, 8 Jun 2013 22:34:28 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:54702 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751430Ab3FICe1 (ORCPT ); Sat, 8 Jun 2013 22:34:27 -0400 Received: by mail-pd0-f171.google.com with SMTP id y14so3321135pdi.16 for ; Sat, 08 Jun 2013 19:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=wD4ANORMIsjg/l55jpol1MFpJl8jv738JIwtIakjd3o=; b=D9kpC6GhiuF1edTuTy4687oZ2Mkknt19xvnadUJklRllemaqLzjI97e4+j8l0kr1nv HNqRKyI8jLrJKd7o54Hc71il29htk3BuEghiw1TlHjxLDEVkug8RfZ7gwHK9J6J2kh1F 8gnzFjbTcQ4ZKuVUPpm//IX7lqxZ1UODMXCGdVcqiaP+KXT3zlFIhytFBWvygTWNxNjv hQnnUBrHh5MqzFs4HHaMbKs+H9fFMsyvtPZaX02nx3XrVhOhYkC3+5xOQLyoMNoycl+6 kkyH0TlIgR/Y1IvwUgn1e14a4HQdrx5/vnNkn64mM8jT8slCRgeipVUbQV77XzPLFw6j VM1A== X-Received: by 10.66.232.129 with SMTP id to1mr8621636pac.144.1370745267206; Sat, 08 Jun 2013 19:34:27 -0700 (PDT) Received: from tangrs.lan (110-175-69-66.static.tpgi.com.au. [110.175.69.66]) by mx.google.com with ESMTPSA id z5sm4908972pbk.0.2013.06.08.19.34.16 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Jun 2013 19:34:25 -0700 (PDT) From: Daniel Tang To: mmarek@suse.cz Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, trivial@kernel.org, Daniel Tang Subject: [PATCH 1/2] Fix a build warning in scripts/sortextable.h Date: Sun, 9 Jun 2013 12:33:54 +1000 Message-Id: <1370745235-12951-1-git-send-email-dt.tangr@gmail.com> X-Mailer: git-send-email 1.8.1.3 MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The pointer passed to the _r() macro does not always match the type of the function that it is aliasing and raises several of the following warnings at compile time: warning: passing argument 1 of ‘r8’ from incompatible pointer type Fixed by casting the pointers to (void *) so they work with both the 32bit and 64bit code. Signed-off-by: Daniel Tang --- scripts/sortextable.h | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/sortextable.h b/scripts/sortextable.h index f5eb43d..0a38fbd 100644 --- a/scripts/sortextable.h +++ b/scripts/sortextable.h @@ -110,9 +110,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) int i; int idx; - shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); + shdr = (Elf_Shdr *)((char *)ehdr + _r((void *)&ehdr->e_shoff)); shstrtab_sec = shdr + r2(&ehdr->e_shstrndx); - secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset); + secstrtab = (const char *)ehdr + _r((void *)&shstrtab_sec->sh_offset); for (i = 0; i < r2(&ehdr->e_shnum); i++) { idx = r(&shdr[i].sh_name); if (strcmp(secstrtab + idx, "__ex_table") == 0) { @@ -122,8 +122,8 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) if ((r(&shdr[i].sh_type) == SHT_REL || r(&shdr[i].sh_type) == SHT_RELA) && r(&shdr[i].sh_info) == extab_index) { - relocs = (void *)ehdr + _r(&shdr[i].sh_offset); - relocs_size = _r(&shdr[i].sh_size); + relocs = (void *)ehdr + _r((void *)&shdr[i].sh_offset); + relocs_size = _r((void *)&shdr[i].sh_size); } if (strcmp(secstrtab + idx, ".symtab") == 0) symtab_sec = shdr + i; @@ -142,14 +142,14 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) fprintf(stderr, "no __ex_table in file: %s\n", fname); fail_file(); } - strtab = (const char *)ehdr + _r(&strtab_sec->sh_offset); + strtab = (const char *)ehdr + _r((void *)&strtab_sec->sh_offset); - extab_image = (void *)ehdr + _r(&extab_sec->sh_offset); + extab_image = (void *)ehdr + _r((void *)&extab_sec->sh_offset); if (custom_sort) { - custom_sort(extab_image, _r(&extab_sec->sh_size)); + custom_sort(extab_image, _r((void *)&extab_sec->sh_size)); } else { - int num_entries = _r(&extab_sec->sh_size) / extable_ent_size; + int num_entries = _r((void *)&extab_sec->sh_size) / extable_ent_size; qsort(extab_image, num_entries, extable_ent_size, compare_extable); } @@ -159,12 +159,13 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) /* find main_extable_sort_needed */ sort_needed_sym = NULL; - for (i = 0; i < _r(&symtab_sec->sh_size) / sizeof(Elf_Sym); i++) { - sym = (void *)ehdr + _r(&symtab_sec->sh_offset); + for (i = 0; i < _r((void *)&symtab_sec->sh_size) / sizeof(Elf_Sym); i++) + { + sym = (void *)ehdr + _r((void *)&symtab_sec->sh_offset); sym += i; if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) continue; - idx = r(&sym->st_name); + idx = r((void *)&sym->st_name); if (strcmp(strtab + idx, "main_extable_sort_needed") == 0) { sort_needed_sym = sym; break; @@ -178,9 +179,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) } sort_needed_sec = &shdr[r2(&sort_needed_sym->st_shndx)]; sort_done_location = (void *)ehdr + - _r(&sort_needed_sec->sh_offset) + - _r(&sort_needed_sym->st_value) - - _r(&sort_needed_sec->sh_addr); + _r((void *)&sort_needed_sec->sh_offset) + + _r((void *)&sort_needed_sym->st_value) - + _r((void *)&sort_needed_sec->sh_addr); #if 0 printf("sort done marker at %lx\n",