public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16470] New: violation of `-ffreestanding' rules
@ 2004-07-10 21:32 pluto at pld-linux dot org
  2004-07-11  6:55 ` [Bug c/16470] " ebotcazou at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pluto at pld-linux dot org @ 2004-07-10 21:32 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2600 bytes --]

 -ffreestanding 
 
   Assert that compilation takes place in a freestanding environment. 
   This implies -fno-builtin.  A freestanding environment is one in 
   which the standard library may not exist, and program startup may 
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
   not necessarily be at "main".  The most obvious example is an OS 
   kernel.  This is equivalent to -fno-hosted. 
 
$ cat switch64.c 
 
#include "/usr/src/linux/include/linux/types.h" 
__u64 test(__u64 val) 
{ 
    switch (val) 
    { 
        case 0: 
            return 0; 
            break; 
        case 1: 
            return 1; 
            break; 
        default: 
            return -1; 
    } 
} 
 
$ gcc switch64.c -c -ffreestanding 
$ objdump -t switch64.o 
 
switch64.o:     file format elf32-sparc 
 
SYMBOL TABLE: 
00000000 l    df *ABS*  00000000 switch64.c 
00000000 l    d  .text  00000000 
00000000 l    d  .data  00000000 
00000000 l    d  .bss   00000000 
00000000 l    d  .note.GNU-stack        00000000 
00000000 l    d  .comment       00000000 
00000000         *UND*  00000000 __ucmpdi2 
                                 ^^^^^^^^^ 
00000000 g     F .text  0000009c test 
 
$ objdump -T /lib/libgcc_s.so|grep __uc 
0000181c g    DF .text  00000038  GCC_3.0     __ucmpdi2 
 
$ ldd /lib/libgcc_s.so 
        libc.so.6 => /lib/libc.so.6 (0x70028000) 
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x08000000) 
 
In the kernel sources such situations happen very often. 
In the case of __ucmpdi2, it appears to be a combination of kernel 
and compiler stupidity - there's no reason why __ucmpdi2 should 
not be done inline by the compiler, but at the same time there 
is probably also little reason to use a slow "long long" comparison 
in the kernel. Of course I can force a static linking with libgcc.a 
but in the above case gcc should report an error or do inline and warn user.

-- 
           Summary: violation of `-ffreestanding' rules
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at pld-linux dot org
                CC: gcc-bugs at gcc dot gnu dot org,qboosh at pld-linux dot
                    org
 GCC build triplet: sparc-pld-linux
  GCC host triplet: sparc-pld-linux
GCC target triplet: sparc-pld-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16470


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

* [Bug c/16470] violation of `-ffreestanding' rules
  2004-07-10 21:32 [Bug c/16470] New: violation of `-ffreestanding' rules pluto at pld-linux dot org
@ 2004-07-11  6:55 ` ebotcazou at gcc dot gnu dot org
  2004-07-11 20:22 ` [Bug c/16470] violation of `-ffreestanding' rules? ebotcazou at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-07-11  6:55 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16470


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

* [Bug c/16470] violation of `-ffreestanding' rules?
  2004-07-10 21:32 [Bug c/16470] New: violation of `-ffreestanding' rules pluto at pld-linux dot org
  2004-07-11  6:55 ` [Bug c/16470] " ebotcazou at gcc dot gnu dot org
@ 2004-07-11 20:22 ` ebotcazou at gcc dot gnu dot org
  2004-07-11 20:51 ` pluto at pld-linux dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-07-11 20:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2004-07-11 20:22 -------
While I confirm that the undefined symbol __ucmpdi2 is emitted by the compiler,
I'm a bit skeptical about your interpretation of '-ffreestanding': __ucmpdi2 is
provided by libgcc.a, not by the standard library.  So it is possible to build a
standalone executable containing the chunk of code with the compiler only.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.3.4 3.3.5 3.4.1 3.4.2
                   |                            |3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-11 20:22:25
               date|                            |
            Summary|violation of `-             |violation of `-
                   |ffreestanding' rules        |ffreestanding' rules?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16470


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

* [Bug c/16470] violation of `-ffreestanding' rules?
  2004-07-10 21:32 [Bug c/16470] New: violation of `-ffreestanding' rules pluto at pld-linux dot org
  2004-07-11  6:55 ` [Bug c/16470] " ebotcazou at gcc dot gnu dot org
  2004-07-11 20:22 ` [Bug c/16470] violation of `-ffreestanding' rules? ebotcazou at gcc dot gnu dot org
@ 2004-07-11 20:51 ` pluto at pld-linux dot org
  2004-07-11 22:41 ` schwab at suse dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pluto at pld-linux dot org @ 2004-07-11 20:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pluto at pld-linux dot org  2004-07-11 20:51 -------
(In reply to comment #1) 
> While I confirm that the undefined symbol __ucmpdi2 is emitted by the 
compiler, 
> I'm a bit skeptical about your interpretation of '-ffreestanding': __ucmpdi2 
is 
> provided by libgcc.a, not by the standard library. 
 
by libgcc_s.so (which is linked with standard library) too. 
 
> So it is possible to build a standalone executable (...) 
 
with libgcc.a - yes. 
with libgcc_s.so - no. 
 
 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16470


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

* [Bug c/16470] violation of `-ffreestanding' rules?
  2004-07-10 21:32 [Bug c/16470] New: violation of `-ffreestanding' rules pluto at pld-linux dot org
                   ` (2 preceding siblings ...)
  2004-07-11 20:51 ` pluto at pld-linux dot org
@ 2004-07-11 22:41 ` schwab at suse dot de
  2004-07-12  4:12 ` pinskia at gcc dot gnu dot org
  2004-07-12  4:13 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: schwab at suse dot de @ 2004-07-11 22:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schwab at suse dot de  2004-07-11 22:41 -------
A freestanding implementation won't have a shared libgcc.  Mind you that 
GNU/Linux is _not_ a freestanding implementation. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16470


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

* [Bug c/16470] violation of `-ffreestanding' rules?
  2004-07-10 21:32 [Bug c/16470] New: violation of `-ffreestanding' rules pluto at pld-linux dot org
                   ` (3 preceding siblings ...)
  2004-07-11 22:41 ` schwab at suse dot de
@ 2004-07-12  4:12 ` pinskia at gcc dot gnu dot org
  2004-07-12  4:13 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-12  4:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-12 04:12 -------
Sorry but no these are not a violation of `-ffreestanding' at all, since otherwise there is no way to 
support 64bit in 32bit targets at all or some other builtins which are done like __builtin_ctlz and such.
So this is invalid.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16470


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

* [Bug c/16470] violation of `-ffreestanding' rules?
  2004-07-10 21:32 [Bug c/16470] New: violation of `-ffreestanding' rules pluto at pld-linux dot org
                   ` (4 preceding siblings ...)
  2004-07-12  4:12 ` pinskia at gcc dot gnu dot org
@ 2004-07-12  4:13 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-12  4:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-12 04:13 -------
Note you can use -static-libgcc to get the static libgcc.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16470


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

end of thread, other threads:[~2004-07-12  4:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-10 21:32 [Bug c/16470] New: violation of `-ffreestanding' rules pluto at pld-linux dot org
2004-07-11  6:55 ` [Bug c/16470] " ebotcazou at gcc dot gnu dot org
2004-07-11 20:22 ` [Bug c/16470] violation of `-ffreestanding' rules? ebotcazou at gcc dot gnu dot org
2004-07-11 20:51 ` pluto at pld-linux dot org
2004-07-11 22:41 ` schwab at suse dot de
2004-07-12  4:12 ` pinskia at gcc dot gnu dot org
2004-07-12  4:13 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).