]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kbuild: fix ld-option function
authorAntony Pavlov <antonynpavlov@gmail.com>
Wed, 3 Apr 2013 14:42:33 +0000 (18:42 +0400)
committerMichal Marek <mmarek@suse.cz>
Mon, 8 Apr 2013 09:47:41 +0000 (11:47 +0200)
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 <antonynpavlov@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Documentation/kbuild/makefiles.txt
scripts/Kbuild.include

index 5198b742fde1608330b799015573ecf97277531e..5836294fdbf700192842d661c5d447f1114a483c 100644 (file)
@@ -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
index 978416dd31ca0efeacfd938e961b241aca7633af..547e15daf03dc86dbfa72818122bc4c61929edb0 100644 (file)
@@ -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)