public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Thorsten Glaser <tg@mirbsd.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>,
	Greg Ungerer <gerg@uclinux.org>,
	linux-kernel@vger.kernel.org, linux-m68k@vger.kernel.org,
	target-devel@vger.kernel.org
Subject: Re: [m68k] in modpost: "strlen" [iscsi_target_mod.ko] undefined! (and others)
Date: Sun, 1 Jan 2012 18:10:14 -0600	[thread overview]
Message-ID: <20120102001014.GD25837@elie.hsd1.il.comcast.net> (raw)
In-Reply-To: <Pine.BSM.4.64L.1201012342490.20109@herc.mirbsd.org>

Thorsten Glaser wrote:

> I’d rather know why upstream doesn’t use -ffreestanding on
> _all_ architectures. A kernel is _not_ a hosted environment,
> and GCC is right to bring in problems like this.

It's to make optimizations that use the builtin functions (e.g.,
memcpy) work with less fuss.  If the kernel implements all the
relevant library functions, then it can be considered hosted as far as
GCC cares.

[...]
>                                (Nobody prevents GCC from using
> a memcpy builtin that uses, say, SSE instructions

Doesn't -mno-sse take care of that?

However, if you (this is the general "you", not just Thorsten) find
the following reasoning[1] compelling, feel free to propose a patch to
Makefile instead of arch/m68k/Makefile.  If others agree, some patches
for the x86 string functions to get the optimizations back could
follow, leaving everyone happy.

Ciao,
Jonathan

[1]
commit d6326c18
Author: Adrian Bunk <bunk@stusta.de>
Date:   Tue Jan 4 05:29:33 2005 -0800

    [PATCH] compile with -ffreestanding

    For the kernel, it would be logical to use -ffreestanding.  The kernel is
    not a hosted environment with a standard C library.

    The gcc option -ffreestanding is supported by both gcc 2.95 and 3.4, which
    covers the whole range of currently supported compilers.

    Regarding changes caused by this patch:

    Andi Kleen reported:
      Newer gcc rewrites sprintf(buf,"%s",str) to strcpy(buf,str) transparently.

    This is only true with unit-at-a-time (disabled on i386 but enabled on
    x86_64).  The Linux kernel doesn't offer a standard C library, and such
    transparent replacements of kernel functions with builtins are quite
    fragile.

    Even with -ffreestanding, it's still possilble to explicitely use a gcc
    builtin if desired.

  reply	other threads:[~2012-01-02  0:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20111116181424.14920.7730.reportbug@ara5.mirbsd.org>
     [not found] ` <Pine.BSM.4.64L.1111301751500.12725@herc.mirbsd.org>
     [not found]   ` <CAMuHMdW8t8Q7OqxJM602iLG4aSv1KMTY-fhiGS7hyy8xBReh1A@mail.gmail.com>
     [not found]     ` <Pine.BSM.4.64L.1112181741430.856@herc.mirbsd.org>
     [not found]       ` <Pine.BSM.4.64L.1112181929380.856@herc.mirbsd.org>
     [not found]         ` <Pine.BSM.4.64L.1201012310590.20109@herc.mirbsd.org>
2012-01-01 23:39           ` [m68k] in modpost: "strlen" [iscsi_target_mod.ko] undefined! (and others) Jonathan Nieder
2012-01-01 23:45             ` Thorsten Glaser
2012-01-02  0:10               ` Jonathan Nieder [this message]
2012-01-02  0:19                 ` Thorsten Glaser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120102001014.GD25837@elie.hsd1.il.comcast.net \
    --to=jrnieder@gmail.com \
    --cc=gerg@uclinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    --cc=tg@mirbsd.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox