From patchwork Wed Apr 3 14:42:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antony Pavlov X-Patchwork-Id: 2387681 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4FEBBDFB79 for ; Wed, 3 Apr 2013 14:41:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758541Ab3DCOlD (ORCPT ); Wed, 3 Apr 2013 10:41:03 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:63132 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758844Ab3DCOlC (ORCPT ); Wed, 3 Apr 2013 10:41:02 -0400 Received: by mail-lb0-f176.google.com with SMTP id y8so1651114lbh.21 for ; Wed, 03 Apr 2013 07:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=RAkmWbh+Sx2l1hpE0e6w6wPVp8IaZpCK4F0FNlW6aTE=; b=ofJ2MWNGvA7WmmdKOfjvnsci+lVayGHXfEkAatgeKFchUUPlJMpVmN73OL/fM9y5Cu irlZn+4xh4K56L74XIU0CQFl+ERVP1Sv39+Fz8GFMCMr6kMhKctJACPXIjiav9J2dr56 TRd3dfyVwTn20M8rPKmluBQcIWNvn5kgydnJOGyIxPDMJ0pDOG/2ALgQX5WExBK0ANk0 9k/jpkZH0qwd+7IUxRnXtcmARar0TeLIawvQ5957hBuFxfRdCqbhG+9VQgV8b8h3biuw i7EYODE35VVO0guRSebcdbqpWlwP2yjvjcWGuKn48c7At8g93yKCE2AX/9gJJzj91Xgf V3uQ== X-Received: by 10.112.155.100 with SMTP id vv4mr1242737lbb.81.1365000061049; Wed, 03 Apr 2013 07:41:01 -0700 (PDT) Received: from localhost.localdomain (ppp37-190-57-44.pppoe.spdop.ru. [37.190.57.44]) by mx.google.com with ESMTPS id z1sm2482992lbk.2.2013.04.03.07.40.58 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 07:40:59 -0700 (PDT) From: Antony Pavlov To: Michal Marek Cc: Sascha Hauer , linux-kbuild@vger.kernel.org, Antony Pavlov Subject: [PATCH v2] kbuild: fix ld-option function Date: Wed, 3 Apr 2013 18:42:33 +0400 Message-Id: <1365000153-8318-1-git-send-email-antonynpavlov@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The kbuild's ld-option function is broken because the command $(CC) /dev/null -c -o "$$TMPO" does not create object file! I have used a relatively old mips gcc 3.4.6 cross-compiler and a relatively new gcc 4.7.2 to check this fact but the results are the same. EXAMPLE: $ rm /tmp/1.o $ mips-linux-gcc /dev/null -c -o /tmp/1.o mips-linux-gcc: /dev/null: linker input file unused because linking not done $ ls -la /tmp/1.o ls: cannot access /tmp/1.o: No such file or directory We can easily fix the problem by adding the '-x c' compiler option. EXAMPLE: $ rm /tmp/1.o $ mips-linux-gcc -x c /dev/null -c -o /tmp/1.o $ ls -la /tmp/1.o -rw-r--r-- 1 antony antony 778 Apr 2 20:40 /tmp/1.o Also fix wrong ld-option example. Signed-off-by: Antony Pavlov --- Documentation/kbuild/makefiles.txt | 2 +- scripts/Kbuild.include | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 5198b74..5836294 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -593,7 +593,7 @@ more details, with real examples. Example: #Makefile - LDFLAGS_vmlinux += $(call really-ld-option, -X) + LDFLAGS_vmlinux += $(call ld-option, -X) === 4 Host Program support diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 978416d..547e15d 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -148,7 +148,7 @@ cc-ldoption = $(call try-run,\ # ld-option # Usage: LDFLAGS += $(call ld-option, -X) ld-option = $(call try-run,\ - $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) + $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) # ar-option # Usage: KBUILD_ARFLAGS := $(call ar-option,D)