Hi Guenter,

On Thu, 20 Dec 2012 08:39:45 -0800, Guenter Roeck wrote:
> I found the problem. -li2c must be specified after the .o files.
> 
> Patch:
> 
> diff --git a/tools/Module.mk b/tools/Module.mk
> index 1979248..bfd3250 100644
> --- a/tools/Module.mk
> +++ b/tools/Module.mk
> @@ -21,16 +21,16 @@ TOOLS_TARGETS     := i2cdetect i2cdump i2cset i2cget
>  #
>  
>  $(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o
> -     $(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +     $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
>  
>  $(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o 
> $(TOOLS_DIR)/util.o
> -     $(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +     $(CC) $(LDFLAGS) -o $@ $^  $(TOOLS_LDFLAGS)
>  
>  $(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o 
> $(TOOLS_DIR)/util.o
> -     $(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +     $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
>  
>  $(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o 
> $(TOOLS_DIR)/util.o
> -     $(CC) $(LDFLAGS) $(TOOLS_LDFLAGS) -o $@ $^
> +     $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
>  
>  #
>  # Objects

Hmm, OK. The gcc manual page is somewhat confusing on this topic but as
I understand it, when processing a library, it only considers symbols
which were already referenced but not defined, and discards the rest.
So object files must indeed come first on the command line.

Why it has always worked for me the other way around is a mystery.

You have write permissions to the repository, so please just commit
this fix, thanks.

-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to