public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] kbuild: fix ld-option function
@ 2013-04-02 17:13 Antony Pavlov
  2013-04-03 11:50 ` Rob Landley
  0 siblings, 1 reply; 2+ messages in thread
From: Antony Pavlov @ 2013-04-02 17:13 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel, Antony Pavlov

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

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 scripts/Kbuild.include |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC] kbuild: fix ld-option function
  2013-04-02 17:13 [RFC] kbuild: fix ld-option function Antony Pavlov
@ 2013-04-03 11:50 ` Rob Landley
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Landley @ 2013-04-03 11:50 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: linux-kbuild, linux-kernel, Antony Pavlov

On 04/02/2013 12:13:42 PM, Antony Pavlov wrote:
> The kbuild's ld-option function is broken because
> the command
>   $(CC) /dev/null -c -o "$$TMPO"
> does not create object file!

Could you glue the doc fix to this one and submit then as one patch to  
the kbuild guys, please?

Thanks,

Rob

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-03 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 17:13 [RFC] kbuild: fix ld-option function Antony Pavlov
2013-04-03 11:50 ` Rob Landley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox