[PATCH] libertas link error due to gcc `smartness' - Kernel

This is a discussion on [PATCH] libertas link error due to gcc `smartness' - Kernel ; Some versions of gcc replace strstr() calls with a single-character `needle' parameter by strchr() behind our back. This causes a link error if strchr() is defined as an inline function in (e.g. on m68k): | drivers/built-in.o: In function `libertas_parse_chan': | ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [PATCH] libertas link error due to gcc `smartness'

  1. [PATCH] libertas link error due to gcc `smartness'

    Some versions of gcc replace strstr() calls with a single-character `needle'
    parameter by strchr() behind our back. This causes a link error if strchr() is
    defined as an inline function in (e.g. on m68k):

    | drivers/built-in.o: In function `libertas_parse_chan':
    | linux/drivers/net/wireless/libertas/debugfs.c:209: undefined reference to `strchr'
    | drivers/built-in.o: In function `libertas_parse_ssid':
    | linux/drivers/net/wireless/libertas/debugfs.c:260: undefined reference to `strchr'

    Avoid this by explicitly calling strchr() instead.

    Also include , because this file calls lots of str*() routines.

    Signed-off-by: Geert Uytterhoeven
    ---
    Due to the lack of hardware, I could not test the functionality of this change.
    I was just trying to compile a kernel with a much enabled as possible.

    drivers/net/wireless/libertas/debugfs.c | 5 +++--
    1 file changed, 3 insertions(+), 2 deletions(-)

    --- a/drivers/net/wireless/libertas/debugfs.c
    +++ b/drivers/net/wireless/libertas/debugfs.c
    @@ -3,6 +3,7 @@
    #include
    #include
    #include
    +#include
    #include

    #include "dev.h"
    @@ -205,7 +206,7 @@ static int libertas_parse_chan(char *buf
    if (!start)
    return -EINVAL;
    start += 5;
    - end = strstr(start, " ");
    + end = strchr(start, ' ');
    if (!end)
    end = buf + count;
    hold = kzalloc((end - start)+1, GFP_KERNEL);
    @@ -256,7 +257,7 @@ static void libertas_parse_ssid(char *bu
    if (!hold)
    return;
    hold += 5;
    - end = strstr(hold, " ");
    + end = strchr(hold, ' ');
    if (!end)
    end = buf + count - 1;


    Gr{oetje,eeting}s,

    Geert

    --
    Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

    In personal conversations with technical people, I call myself a hacker. But
    when I'm talking to journalists I just say "programmer" or something like that.
    -- Linus Torvalds
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [PATCH] libertas link error due to gcc `smartness'

    On Mon, 2007-10-08 at 09:43 +0200, Geert Uytterhoeven wrote:
    > Some versions of gcc replace strstr() calls with a single-character `needle'
    > parameter by strchr() behind our back. This causes a link error if strchr() is
    > defined as an inline function in (e.g. on m68k):
    >
    > | drivers/built-in.o: In function `libertas_parse_chan':
    > | linux/drivers/net/wireless/libertas/debugfs.c:209: undefined reference to `strchr'
    > | drivers/built-in.o: In function `libertas_parse_ssid':
    > | linux/drivers/net/wireless/libertas/debugfs.c:260: undefined reference to `strchr'
    >
    > Avoid this by explicitly calling strchr() instead.
    >
    > Also include , because this file calls lots of str*() routines.
    >
    > Signed-off-by: Geert Uytterhoeven


    Acked-by: Dan Williams

    > ---
    > Due to the lack of hardware, I could not test the functionality of this change.
    > I was just trying to compile a kernel with a much enabled as possible.
    >
    > drivers/net/wireless/libertas/debugfs.c | 5 +++--
    > 1 file changed, 3 insertions(+), 2 deletions(-)
    >
    > --- a/drivers/net/wireless/libertas/debugfs.c
    > +++ b/drivers/net/wireless/libertas/debugfs.c
    > @@ -3,6 +3,7 @@
    > #include
    > #include
    > #include
    > +#include
    > #include
    >
    > #include "dev.h"
    > @@ -205,7 +206,7 @@ static int libertas_parse_chan(char *buf
    > if (!start)
    > return -EINVAL;
    > start += 5;
    > - end = strstr(start, " ");
    > + end = strchr(start, ' ');
    > if (!end)
    > end = buf + count;
    > hold = kzalloc((end - start)+1, GFP_KERNEL);
    > @@ -256,7 +257,7 @@ static void libertas_parse_ssid(char *bu
    > if (!hold)
    > return;
    > hold += 5;
    > - end = strstr(hold, " ");
    > + end = strchr(hold, ' ');
    > if (!end)
    > end = buf + count - 1;
    >
    >
    > Gr{oetje,eeting}s,
    >
    > Geert
    >
    > --
    > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
    >
    > In personal conversations with technical people, I call myself a hacker. But
    > when I'm talking to journalists I just say "programmer" or something like that.
    > -- Linus Torvalds
    > -
    > To unsubscribe from this list: send the line "unsubscribe netdev" in
    > the body of a message to majordomo@vger.kernel.org
    > More majordomo info at http://vger.kernel.org/majordomo-info.html


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread