public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/24585]  New: spurious section conflict error while building linux kernel
@ 2005-10-30 15:55 ak at muc dot de
  2005-10-30 15:56 ` [Bug target/24585] " ak at muc dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ak at muc dot de @ 2005-10-30 15:55 UTC (permalink / raw)
  To: gcc-bugs

Seems to happen with 3.3,3.4,

Short test case courtesy of A.Pinski:

static void __attribute__ ((__section__ (".init.text"))) pci_fixup_i450nx(void)
{  }
static int __attribute__ ((__section__ (".init.text"))) 
toshiba_ohci1394_dmi_table[] = {  };

causes with gcc (without -O2);
t.c:4: error: toshiba_ohci1394_dmi_table causes a section type conflict

(the longer test case which I attach shows it with optimization
too)



On the big file the actual function (it has a lot of these) depends
on optimization level and compiler version


-- 
           Summary: spurious section conflict error while building linux
                    kernel
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ak at muc dot de
  GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux


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


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

* [Bug target/24585] spurious section conflict error while building linux kernel
  2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
@ 2005-10-30 15:56 ` ak at muc dot de
  2005-10-30 16:12 ` pluto at agmk dot net
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ak at muc dot de @ 2005-10-30 15:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ak at muc dot de  2005-10-30 15:56 -------
Created an attachment (id=10081)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10081&action=view)
Long test case directly from Linux kernel, shows the error in more
circumstances


-- 


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


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

* [Bug target/24585] spurious section conflict error while building linux kernel
  2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
  2005-10-30 15:56 ` [Bug target/24585] " ak at muc dot de
@ 2005-10-30 16:12 ` pluto at agmk dot net
  2005-10-30 16:13 ` [Bug middle-end/24585] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pluto at agmk dot net @ 2005-10-30 16:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pluto at agmk dot net  2005-10-30 16:12 -------
(In reply to comment #0)
> Seems to happen with 3.3,3.4,
> 
> Short test case courtesy of A.Pinski:
> 
> static void __attribute__ ((__section__ (".init.text"))) pci_fixup_i450nx(void)
> {  }
> static int __attribute__ ((__section__ (".init.text"))) 
> toshiba_ohci1394_dmi_table[] = {  };
> 
> causes with gcc (without -O2);
> t.c:4: error: toshiba_ohci1394_dmi_table causes a section type conflict

without `static` it also fails on 4.1/powerpc.


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


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

* [Bug middle-end/24585] [3.4/4.0/4.1 Regression] spurious section conflict error while building linux kernel
  2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
  2005-10-30 15:56 ` [Bug target/24585] " ak at muc dot de
  2005-10-30 16:12 ` pluto at agmk dot net
@ 2005-10-30 16:13 ` pinskia at gcc dot gnu dot org
  2005-10-30 16:18 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-30 16:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-10-30 16:13 -------
Confirmed for the short testcase at -O0.  Finding one for the -O2 issue.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal
             Status|UNCONFIRMED                 |NEW
          Component|target                      |middle-end
     Ever Confirmed|0                           |1
   GCC host triplet|x86_64-linux                |
 GCC target triplet|x86_64-linux                |
           Keywords|                            |rejects-valid
      Known to fail|                            |3.2.3 3.3.3 3.4.0 4.1.0
      Known to work|                            |2.95.3 3.0.4
   Last reconfirmed|0000-00-00 00:00:00         |2005-10-30 16:13:35
               date|                            |
            Summary|spurious section conflict   |[3.4/4.0/4.1 Regression]
                   |error while building linux  |spurious section conflict
                   |kernel                      |error while building linux
                   |                            |kernel
   Target Milestone|---                         |4.0.3


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


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

* [Bug middle-end/24585] [3.4/4.0/4.1 Regression] spurious section conflict error while building linux kernel
  2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
                   ` (2 preceding siblings ...)
  2005-10-30 16:13 ` [Bug middle-end/24585] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-10-30 16:18 ` pinskia at gcc dot gnu dot org
  2005-10-31  6:45 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-30 16:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-10-30 16:18 -------
I wonder if this is really a regression at all here is the testcase for -O2:
struct pci_fixup {
void (*hook)(void);
};
static void __attribute__ ((__section__ (".init.text")))
pci_fixup_ide_bases(void) {}
static const struct pci_fixup
__pci_fixup_PCI_ANY_IDPCI_ANY_IDpci_fixup_ide_bases
__attribute__((__used__)) __attribute__((__section__(".pci_fixup_header"))) = {
 pci_fixup_ide_bases };
static int __attribute__ ((__section__ (".init.text")))
toshiba_ohci1394_dmi_table[] = {};
static void __attribute__ ((__section__ (".init.text")))
pci_pre_fixup_toshiba_ohci1394(void) {
  dmi_check_system(toshiba_ohci1394_dmi_table);
}
static const struct pci_fixup
__pci_fixup_PCI_VENDOR_ID_TI0x8032pci_pre_fixup_toshiba_ohci1394
__attribute__((__used__)) __attribute__((__section__(".pci_fixup_header"))) =
{pci_pre_fixup_toshiba_ohci1394 };


----
This fails with 2.95.3 3.0.4 3.3.3 3.4.0, 4.0.0 and 4.1.0.


-- 


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


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

* [Bug middle-end/24585] [3.4/4.0/4.1 Regression] spurious section conflict error while building linux kernel
  2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
                   ` (3 preceding siblings ...)
  2005-10-30 16:18 ` pinskia at gcc dot gnu dot org
@ 2005-10-31  6:45 ` mmitchel at gcc dot gnu dot org
  2005-11-01  6:38 ` wilson at gcc dot gnu dot org
  2005-11-01 14:55 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  6:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2005-10-31 06:45 -------
This is a showstopper, unless we can convince ourselves that this is not a bug,
or, at least, not a regression.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1


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


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

* [Bug middle-end/24585] [3.4/4.0/4.1 Regression] spurious section conflict error while building linux kernel
  2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
                   ` (4 preceding siblings ...)
  2005-10-31  6:45 ` mmitchel at gcc dot gnu dot org
@ 2005-11-01  6:38 ` wilson at gcc dot gnu dot org
  2005-11-01 14:55 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: wilson at gcc dot gnu dot org @ 2005-11-01  6:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from wilson at gcc dot gnu dot org  2005-11-01 06:38 -------
Short story...
Your kernel code is broken.  init functions go in .init.text, but init data
goes in .init.data, not .init.text.  See the
Documentation/Docbook/kernel-hacking.tmpl file in any recent kernel.

Long story...
The more we use ELF, the more important it is to get the details right.  One of
the details we did not get right in the beginning is section type info.  Given
something like
int __attribute__ ((section ("foo"))) bar () { }
int __attribute__ ((section ("foo"))) baz = 1;
An old compiler like gcc-2.95 will emit
        .section        bar,"ax",@progbits
but this is clearly wrong, because we have both code and writable data in the
same section, and that section is not marked writable.

Newer compiler versions check for this, and correctly emit an error when they
see section type conflicts like this, as we can't emit both writable data and
code into the same section.  So the error you are getting here is expected, and
correct.

This bug happens not to affect the kernel's use of section in this specific
case, so it worked by accident with older compiler versions.  It will not and
should not work with current compiler versions, and hence the current kernel
has support for separate init text and init data sections.

It might be useful if the attribute section syntax was extended so that people
can specify what kind of section they want, but I don't see any real advantage
to doing that.  You shouldn't be mixing data and code in the same section
anyways.

Ideally, you should be using a comdat group here, but we have no syntax for
that either.  I think that would be a more useful attribute section syntax
extension.
There is no need for it to solve this particular problem though.  You just need
to use the right sections in your code.


-- 


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


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

* [Bug middle-end/24585] [3.4/4.0/4.1 Regression] spurious section conflict error while building linux kernel
  2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
                   ` (5 preceding siblings ...)
  2005-11-01  6:38 ` wilson at gcc dot gnu dot org
@ 2005-11-01 14:55 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-01 14:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2005-11-01 14:55 -------
So this is invalid after all.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2005-11-01 14:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-30 15:55 [Bug target/24585] New: spurious section conflict error while building linux kernel ak at muc dot de
2005-10-30 15:56 ` [Bug target/24585] " ak at muc dot de
2005-10-30 16:12 ` pluto at agmk dot net
2005-10-30 16:13 ` [Bug middle-end/24585] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-10-30 16:18 ` pinskia at gcc dot gnu dot org
2005-10-31  6:45 ` mmitchel at gcc dot gnu dot org
2005-11-01  6:38 ` wilson at gcc dot gnu dot org
2005-11-01 14:55 ` 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).