public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/15486] New: -fdata-sections moves COMMON vars to .bss
@ 2004-05-17 19:32 jifl-bugzilla at jifvik dot org
  2004-05-17 21:59 ` [Bug middle-end/15486] " pinskia at gcc dot gnu dot org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: jifl-bugzilla at jifvik dot org @ 2004-05-17 19:32 UTC (permalink / raw)
  To: gcc-bugs

This is a regression from GCC 3.2.1 (at least).

If I create a file foo.c containing simply:
  int x;
and compile it with:
  arm-elf-gcc -c foo.c
then I can get the following with 'arm-elf-nm foo.o'
00000004 C x

However if I compile with
  arm-elf-gcc -c -fdata-sections foo.c
then with arm-elf-nm I get:
00000000 B x

i.e. x is in the BSS. This results in breaking the long-standing behaviour of
common variables being merged. If you typed the following:
cat >foo2.c
int x=0;
int main(){
  return x;
}
arm-elf-gcc -c -fdata-sections foo.c
arm-elf-gcc -c -fdata-sections foo2.c
arm-elf-gcc -o foo foo.o foo2.o
then you get:
foo2.o(.data.x+0x0): multiple definition of `x'
foo.o(.bss.x+0x0): first defined here

I can see how this behaviour would be beneficial if "-fno-common" was passed to
gcc and if not using "legacy" code (actually the real code I'm having trouble
with is derived from a BSD kernel of about 4 years ago, so not that old), but in
the absence of -fno-common, -fdata-sections should not operate on uninitialised
data. Perhaps the default should be -fno-common, and I should be required to
pass -fcommon to get the old behaviour, I'm not bothered. Or alternatively
perhaps this treatment of uninitialised data should only happen with a separate
-fbss-sections option (for symmetry with -ffunction-sections and -fdata-sections).

-- 
           Summary: -fdata-sections moves COMMON vars to .bss
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jifl-bugzilla at jifvik dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linuxgnulibc2.2
  GCC host triplet: i686-pc-linuxgnulibc2.2
GCC target triplet: arm-elf


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


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

end of thread, other threads:[~2004-12-18 21:56 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-17 19:32 [Bug target/15486] New: -fdata-sections moves COMMON vars to .bss jifl-bugzilla at jifvik dot org
2004-05-17 21:59 ` [Bug middle-end/15486] " pinskia at gcc dot gnu dot org
2004-05-17 22:03 ` jifl-bugzilla at jifvik dot org
2004-05-17 22:04 ` ebotcazou at gcc dot gnu dot org
2004-05-17 22:05 ` [Bug middle-end/15486] [3.3/3.4/3.5] -fdata-sections moves common " ebotcazou at gcc dot gnu dot org
2004-05-18 14:17 ` jifl-bugzilla at jifvik dot org
2004-06-06  3:58 ` giovannibajo at libero dot it
2004-06-19 17:46 ` mmitchel at gcc dot gnu dot org
2004-06-22 10:26 ` rearnsha at gcc dot gnu dot org
2004-06-22 11:12 ` jifl-bugzilla at jifvik dot org
2004-06-22 11:33 ` rearnsha at gcc dot gnu dot org
2004-06-22 19:37 ` jifl-bugzilla at jifvik dot org
2004-06-22 22:13 ` jifl-bugzilla at jifvik dot org
2004-08-17 23:17 ` pinskia at gcc dot gnu dot org
2004-08-18  1:39 ` jifl-bugzilla at jifvik dot org
2004-08-18  2:22 ` pinskia at gcc dot gnu dot org
2004-08-18  4:42 ` jifl-bugzilla at jifvik dot org
2004-08-19 21:18 ` mmitchel at gcc dot gnu dot org
2004-08-20 21:09 ` jason at redhat dot com
2004-08-29 19:09 ` mmitchel at gcc dot gnu dot org
2004-10-13 13:42 ` [Bug middle-end/15486] [3.3/3.4/4.0 regression] " pinskia at gcc dot gnu dot org
2004-10-31  2:07 ` mmitchel at gcc dot gnu dot org
2004-12-09 13:16 ` ebotcazou at gcc dot gnu dot org
2004-12-14  8:22 ` ebotcazou at gcc dot gnu dot org
2004-12-18 21:50 ` cvs-commit at gcc dot gnu dot org
2004-12-18 21:56 ` ebotcazou 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).