Skip to content

Commit

Permalink
libgcc/
Browse files Browse the repository at this point in the history
	* config.host: Match little-endian powerpc-linux.
gcc/
	* config.gcc: Support little-endian powerpc-linux targets.
	* config/rs6000/linux.h (LINK_OS_LINUX_EMUL): Define.
	(LINK_OS_LINUX_SPEC): Define.
	* config/rs6000/linuxspe.h (TARGET_DEFAULT):
	Preserve MASK_LITTLE_ENDIAN.
	* config/rs6000/default64.h (TARGET_DEFAULT): Likewise.
	* config/rs6000/linuxaltivec.h (TARGET_DEFAULT): Likewise.
	* config/rs6000/linux64.h (OPTION_LITTLE_ENDIAN): Don't zero.
	(LINK_OS_LINUX_EMUL32, LINK_OS_LINUX_EMUL64): Define.
	(LINK_OS_LINUX_SPEC32, LINK_OS_LINUX_SPEC64): Use above.
	* config/rs6000/rs6000.c (output_toc): Don't use .tc for TARGET_ELF.
	Correct fp word order for little-endian.  Don't shift toc entries
	smaller than a word for little-endian.
	* config/rs6000/rs6000.md (bswaphi2, bswapsi2 split): Comment.
	(bswapdi2 splits): Correct low-part subreg for little-endian.
	Remove wrong BYTES_BIG_ENDIAN tests, and rename vars to remove
	low/high where such is correct only for be.
	* config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Allow
	little-endian for -mcall-aixdesc.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198273 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
amodra committed Apr 25, 2013
1 parent d04c855 commit d80dc92
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 88 deletions.
22 changes: 22 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
2013-04-25 Alan Modra <amodra@gmail.com>

* config.gcc: Support little-endian powerpc-linux targets.
* config/rs6000/linux.h (LINK_OS_LINUX_EMUL): Define.
(LINK_OS_LINUX_SPEC): Define.
* config/rs6000/linuxspe.h (TARGET_DEFAULT):
Preserve MASK_LITTLE_ENDIAN.
* config/rs6000/default64.h (TARGET_DEFAULT): Likewise.
* config/rs6000/linuxaltivec.h (TARGET_DEFAULT): Likewise.
* config/rs6000/linux64.h (OPTION_LITTLE_ENDIAN): Don't zero.
(LINK_OS_LINUX_EMUL32, LINK_OS_LINUX_EMUL64): Define.
(LINK_OS_LINUX_SPEC32, LINK_OS_LINUX_SPEC64): Use above.
* config/rs6000/rs6000.c (output_toc): Don't use .tc for TARGET_ELF.
Correct fp word order for little-endian. Don't shift toc entries
smaller than a word for little-endian.
* config/rs6000/rs6000.md (bswaphi2, bswapsi2 split): Comment.
(bswapdi2 splits): Correct low-part subreg for little-endian.
Remove wrong BYTES_BIG_ENDIAN tests, and rename vars to remove
low/high where such is correct only for be.
* config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Allow
little-endian for -mcall-aixdesc.

2013-04-25 Alan Modra <amodra@gmail.com>

* config/rs6000/rs6000.c (rs6000_secondary_reload_inner): Use
Expand Down
12 changes: 8 additions & 4 deletions gcc/config.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -2086,20 +2086,24 @@ powerpc-*-rtems*)
extra_options="${extra_options} rs6000/sysv4.opt"
tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm"
;;
powerpc-*-linux* | powerpc64-*-linux*)
powerpc*-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
extra_options="${extra_options} rs6000/sysv4.opt"
tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
case ${target} in
powerpc*le-*-*)
tm_file="${tm_file} rs6000/sysv4le.h" ;;
esac
maybe_biarch=yes
case ${target} in
powerpc64-*-linux*spe* | powerpc64-*-linux*paired*)
powerpc64*-*-linux*spe* | powerpc64*-*-linux*paired*)
echo "*** Configuration ${target} not supported" 1>&2
exit 1
;;
powerpc-*-linux*spe* | powerpc-*-linux*paired*)
powerpc*-*-linux*spe* | powerpc*-*-linux*paired*)
maybe_biarch=
;;
powerpc64-*-linux*)
powerpc64*-*-linux*)
test x$with_cpu != x || cpu_is_64bit=yes
maybe_biarch=always
;;
Expand Down
5 changes: 5 additions & 0 deletions gcc/config/rs6000/default64.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */

#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
#undef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_64BIT | MASK_LITTLE_ENDIAN)
#else
#undef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_64BIT)
#endif
11 changes: 11 additions & 0 deletions gcc/config/rs6000/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@
#undef LINK_OS_DEFAULT_SPEC
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"

#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
#define LINK_OS_LINUX_EMUL "%{!mbig: %{!mbig-endian: -m elf32lppclinux}}%{mbig|mbig-endian: -m elf32ppclinux}"
#else
#define LINK_OS_LINUX_EMUL "%{!mlittle: %{!mlittle-endian: -m elf32ppclinux}}%{mlittle|mlittle-endian: -m elf32lppclinux}"
#endif

#undef LINK_OS_LINUX_SPEC
#define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"

#define LINK_GCC_C_SEQUENCE_SPEC \
"%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"

Expand Down
15 changes: 9 additions & 6 deletions gcc/config/rs6000/linux64.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ extern int dot_symbols;

#ifndef RS6000_BI_ARCH

/* 64-bit PowerPC Linux is always big-endian. */
#undef OPTION_LITTLE_ENDIAN
#define OPTION_LITTLE_ENDIAN 0

/* 64-bit PowerPC Linux always has a TOC. */
#undef TARGET_TOC
#define TARGET_TOC 1
Expand Down Expand Up @@ -376,12 +372,19 @@ extern int dot_symbols;
#define GNU_USER_DYNAMIC_LINKER64 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)

#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
#define LINK_OS_LINUX_EMUL32 "%{!mbig: %{!mbig-endian: -m elf32lppclinux}}%{mbig|mbig-endian: -m elf32ppclinux}"
#define LINK_OS_LINUX_EMUL64 "%{!mbig: %{!mbig-endian: -m elf64lppc}}%{mbig|mbig-endian: -m elf64ppc}"
#else
#define LINK_OS_LINUX_EMUL32 "%{!mlittle: %{!mlittle-endian: -m elf32ppclinux}}%{mlittle|mlittle-endian: -m elf32lppclinux}"
#define LINK_OS_LINUX_EMUL64 "%{!mlittle: %{!mlittle-endian: -m elf64ppc}}%{mlittle|mlittle-endian: -m elf64lppc}"
#endif

#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"

#define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"

Expand Down
5 changes: 5 additions & 0 deletions gcc/config/rs6000/linuxaltivec.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
<http://www.gnu.org/licenses/>. */

/* Override rs6000.h and sysv4.h definition. */
#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
#undef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_ALTIVEC | MASK_LITTLE_ENDIAN)
#else
#undef TARGET_DEFAULT
#define TARGET_DEFAULT MASK_ALTIVEC
#endif

#undef SUBSUBTARGET_OVERRIDE_OPTIONS
#define SUBSUBTARGET_OVERRIDE_OPTIONS rs6000_altivec_abi = 1
5 changes: 5 additions & 0 deletions gcc/config/rs6000/linuxspe.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
<http://www.gnu.org/licenses/>. */

/* Override rs6000.h and sysv4.h definition. */
#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
#undef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_STRICT_ALIGN | MASK_LITTLE_ENDIAN)
#else
#undef TARGET_DEFAULT
#define TARGET_DEFAULT MASK_STRICT_ALIGN
#endif

#undef ASM_DEFAULT_SPEC
#define ASM_DEFAULT_SPEC "-mppc -mspe -me500"
36 changes: 19 additions & 17 deletions gcc/config/rs6000/rs6000.c
Original file line number Diff line number Diff line change
Expand Up @@ -22408,20 +22408,22 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)

if (TARGET_64BIT)
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs (DOUBLE_INT_ASM_OP, file);
else
fprintf (file, "\t.tc FT_%lx_%lx_%lx_%lx[TC],",
k[0] & 0xffffffff, k[1] & 0xffffffff,
k[2] & 0xffffffff, k[3] & 0xffffffff);
fprintf (file, "0x%lx%08lx,0x%lx%08lx\n",
k[0] & 0xffffffff, k[1] & 0xffffffff,
k[2] & 0xffffffff, k[3] & 0xffffffff);
k[WORDS_BIG_ENDIAN ? 0 : 1] & 0xffffffff,
k[WORDS_BIG_ENDIAN ? 1 : 0] & 0xffffffff,
k[WORDS_BIG_ENDIAN ? 2 : 3] & 0xffffffff,
k[WORDS_BIG_ENDIAN ? 3 : 2] & 0xffffffff);
return;
}
else
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs ("\t.long ", file);
else
fprintf (file, "\t.tc FT_%lx_%lx_%lx_%lx[TC],",
Expand All @@ -22448,18 +22450,19 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)

if (TARGET_64BIT)
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs (DOUBLE_INT_ASM_OP, file);
else
fprintf (file, "\t.tc FD_%lx_%lx[TC],",
k[0] & 0xffffffff, k[1] & 0xffffffff);
fprintf (file, "0x%lx%08lx\n",
k[0] & 0xffffffff, k[1] & 0xffffffff);
k[WORDS_BIG_ENDIAN ? 0 : 1] & 0xffffffff,
k[WORDS_BIG_ENDIAN ? 1 : 0] & 0xffffffff);
return;
}
else
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs ("\t.long ", file);
else
fprintf (file, "\t.tc FD_%lx_%lx[TC],",
Expand All @@ -22483,7 +22486,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)

if (TARGET_64BIT)
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs (DOUBLE_INT_ASM_OP, file);
else
fprintf (file, "\t.tc FS_%lx[TC],", l & 0xffffffff);
Expand All @@ -22492,7 +22495,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
}
else
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs ("\t.long ", file);
else
fprintf (file, "\t.tc FS_%lx[TC],", l & 0xffffffff);
Expand Down Expand Up @@ -22524,9 +22527,8 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
}
#endif

/* TOC entries are always Pmode-sized, but since this
is a bigendian machine then if we're putting smaller
integer constants in the TOC we have to pad them.
/* TOC entries are always Pmode-sized, so when big-endian
smaller integer constants in the TOC need to be padded.
(This is still a win over putting the constants in
a separate constant pool, because then we'd have
to have both a TOC entry _and_ the actual constant.)
Expand All @@ -22537,7 +22539,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
/* It would be easy to make this work, but it doesn't now. */
gcc_assert (!TARGET_64BIT || POINTER_SIZE >= GET_MODE_BITSIZE (mode));

if (POINTER_SIZE > GET_MODE_BITSIZE (mode))
if (WORDS_BIG_ENDIAN && POINTER_SIZE > GET_MODE_BITSIZE (mode))
{
#if HOST_BITS_PER_WIDE_INT == 32
lshift_double (low, high, POINTER_SIZE - GET_MODE_BITSIZE (mode),
Expand All @@ -22552,7 +22554,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)

if (TARGET_64BIT)
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs (DOUBLE_INT_ASM_OP, file);
else
fprintf (file, "\t.tc ID_%lx_%lx[TC],",
Expand All @@ -22565,7 +22567,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
{
if (POINTER_SIZE < GET_MODE_BITSIZE (mode))
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs ("\t.long ", file);
else
fprintf (file, "\t.tc ID_%lx_%lx[TC],",
Expand All @@ -22575,7 +22577,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
}
else
{
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs ("\t.long ", file);
else
fprintf (file, "\t.tc IS_%lx[TC],", (long) low & 0xffffffff);
Expand Down Expand Up @@ -22613,7 +22615,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
gcc_unreachable ();
}

if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs (TARGET_32BIT ? "\t.long " : DOUBLE_INT_ASM_OP, file);
else
{
Expand Down
Loading

0 comments on commit d80dc92

Please sign in to comment.