Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 29413
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Ralf Baechle <ralf@linux-mips.org>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 29413 depends on: Show dependency tree
Show dependency graph
Bug 29413 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2006-10-12 07:29 Opened: 2006-10-10 14:13
$ mips-linux-gcc -EL -dM -E -C -x c /dev/null | grep MIPSE
#define MIPSEB 1
#define __MIPSEB__ 1
#define _MIPSEB 1
#define __MIPSEB 1
$ mipsel-linux-gcc -EB -dM -E -C -x c /dev/null | grep MIPSE
#define __MIPSEL__ 1
#define MIPSEL 1
#define _MIPSEL 1
#define __MIPSEL 1
$ mips64el-linux-gcc -EB -dM -E -C -x c /dev/null | grep MIPSE
#define __MIPSEL__ 1
#define MIPSEL 1
#define _MIPSEL 1
#define __MIPSEL 1
$ mips64-linux-gcc -EL -dM -E -C -x c /dev/null | grep MIPSE
#define MIPSEB 1
#define __MIPSEB__ 1
#define _MIPSEB 1
#define __MIPSEB 1
$

Tested with gcc 4.1.0 but given the (incomplete) hacks the Linux/MIPS kernel
has for this I would assume it is broken since a very, very long time.

------- Comment #1 From Andrew Pinski 2006-10-12 06:58 -------
      if (TARGET_BIG_ENDIAN)                                    \
        {                                                       \
          builtin_define_std ("MIPSEB");                        \
          builtin_define ("_MIPSEB");                           \
        }                                                       \
      else                                                      \
        {                                                       \
          builtin_define_std ("MIPSEL");                        \
          builtin_define ("_MIPSEL");                           \
        }     



%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \


meb
Target Report RejectNegative Mask(BIG_ENDIAN)
Use big-endian byte order

mel
Target Report RejectNegative InverseMask(BIG_ENDIAN, LITTLE_ENDIAN)
Use little-endian byte order

It looks to me this should work.

------- Comment #2 From Andrew Pinski 2006-10-12 07:05 -------
[pinskia@celery gcc]$ ./xgcc -B. -EL -dM -E -C -x c /dev/null | grep MIPSE
#define __MIPSEL__ 1
#define MIPSEL 1
#define _MIPSEL 1
#define __MIPSEL 1
[pinskia@celery gcc]$ ./xgcc -B. -EB -dM -E -C -x c /dev/null | grep MIPSE
#define MIPSEB 1
#define __MIPSEB__ 1
#define _MIPSEB 1
#define __MIPSEB 1
[pinskia@celery gcc]$ ./xgcc -B. -EB -dM -E -C -x c /dev/null -v
Using built-in specs.
Target: mipsisa32-elf
Configured with: ../configure --target=mipsisa32-elf : (reconfigured)
Thread model: single
gcc version 4.0.4 20061010 (prerelease)

Hmm, If this does not work then the order of config/linux.h and
config/mips/mips.h are wrong and config/linux.h is being included first which
defines CC1_SPEC and then config/mips/mips.h checks to see if CC1_SPEC is
defined.

------- Comment #3 From Andrew Pinski 2006-10-12 07:08 -------
Yep that is what is happening:
mips64*-*-linux*)
        tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h
mips/linux64.h"
        .....
        ;;
mips*-*-linux*)                         # Linux MIPS, either endian.
        tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
        ....
        esac
        ;;

------- Comment #4 From Andrew Pinski 2006-10-12 07:27 -------
Actually it was only caused recently for mips-linux (non64bit):
2002-08-02  Eric Christopher  <echristo@redhat.com>

        * config.gcc (mips*-*-linux*): Fix ordering of tm_file.
        * config/mips/mips.h (READONLY_DATA_SECTION_ASM_OP): Change
        #ifndef to #undef.
        (TARGET_MEM_FUNCTIONS): Define instead of define to 1.

mips64-linux-gnu was always wrong.

The correct order was in
http://gcc.gnu.org/ml/gcc-patches/2002-07/msg01743.html
But was wrong before that patch
And then was broken again with
http://gcc.gnu.org/ml/gcc-patches/2002-08/msg00204.html

The not having the define means we are also creating wrong code.

------- Comment #5 From Andrew Pinski 2006-10-12 07:33 -------
*** Bug 23824 has been marked as a duplicate of this bug. ***

------- Comment #6 From Ralf Baechle 2006-10-12 13:33 -------
> %{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \

Shouldn't the combination of both -EB and -EL be legal that is later options
override preceeding ones just like with other -ffoo / -fno-foo options?

------- Comment #7 From Andrew Pinski 2006-10-12 14:11 -------
(In reply to comment #6)
> > %{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
> 
> Shouldn't the combination of both -EB and -EL be legal that is later options
> override preceeding ones just like with other -ffoo / -fno-foo options?
That is not the problem, the problem is that CC1_SPEC does not contain the
above but instead the one that is in config/linux.h.

------- Comment #8 From rsandifo@gcc.gnu.org 2006-10-17 07:10 -------
Fixed in trunk.  Because the patch is simple and fairly obvious,
I used the leeway given target maintainers to fix the bug for 4.2,
even though it isn't a regression.  However, because it's not a
regression, I don't think it's appropriate for release branches.

Richard

------- Comment #9 From rsandifo@gcc.gnu.org 2006-10-19 15:45 -------
Subject: Bug 29413

Author: rsandifo
Date: Thu Oct 19 15:45:46 2006
New Revision: 117886

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117886
Log:
gcc/
        Backport from mainline:

        2006-10-17  Andrew Pinsiki  <pinskia@gmail.com>
                    Richard Sandiford  <richard@codesourcery.com>

        PR target/29413
        * config/mips/linux.h (SUBTARGET_CC1_SPEC): Override.
        * config/mips/mips.h (CC1_SPEC): Override any earlier definition.

Added:
    branches/csl/sourcerygxx-4_1/gcc/ChangeLog.csl
Modified:
    branches/csl/sourcerygxx-4_1/gcc/config/mips/linux.h
    branches/csl/sourcerygxx-4_1/gcc/config/mips/mips.h

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug