bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/3298] -mrelax broken for sh-elf


From: olegendo at gcc dot gnu.org
Subject: [Bug binutils/3298] -mrelax broken for sh-elf
Date: Fri, 23 Jan 2015 17:27:47 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=3298

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |olegendo at gcc dot gnu.org

--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Created attachment 8080
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8080&action=edit
GCC patch to enable -mrelax by default

This is another patch to turn the -mrelax option in GCC by default.

Since PR 10378 and PR 10373 have been fixed, I've tried building GCC with
-mrelaxed enabled by default.  The build would stop in
libgcc/config/sh/lib1funcs.S, where GAS would complain that a mova insn is
referring to an unaligned offset.
After applying the following:

Index: libgcc/config/sh/lib1funcs.S
===================================================================
--- libgcc/config/sh/lib1funcs.S    (revision 220017)
+++ libgcc/config/sh/lib1funcs.S    (working copy)
@@ -116,7 +116,7 @@
     HIDDEN_FUNC(GLOBAL(ashiftrt_r4_31))
     HIDDEN_FUNC(GLOBAL(ashiftrt_r4_32))

-    .align    1
+    .align    4
 GLOBAL(ashiftrt_r4_32):
 GLOBAL(ashiftrt_r4_31):
     rotcl    r4
@@ -765,6 +765,7 @@
     bt    GLOBAL(movmemSI52)
 ! done all the large groups, do the remainder
 ! jump to movmem+
+    .balign 4
     mova    GLOBAL(movmemSI4)+4,r0
     add    r6,r0
     jmp    @r0

GCC (sh-elf C,C++, newlib 2.2.0) can be built successfully.
When compiling a simple C++ program with the resulting toolchain:

#include <iostream>

int main (void)
{
  std::cout << "hello world" << std::endl;
  return 0;
}

There are a lot of warnings from LD like:

/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/bin/ld:
/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/lib/ml/m4/libstdc++.a(locale_init.o):
0x18: warning: symbol in unexpected section
/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/bin/ld:
/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/lib/ml/m4/libstdc++.a(locale_init.o):
0x6c: warning: symbol in unexpected section
/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/bin/ld:
/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/lib/ml/m4/libstdc++.a(locale_init.o):
0x70: warning: symbol in unexpected section
/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/bin/ld:
/usr/local/lib/gcc/sh-elf/5.0.0/../../../../sh-elf/lib/ml/m4/libstdc++.a(locale_init.o):
0x3c: warning: symbol in unexpected section

But linking somehow succeeds.  However, the resulting program does not work.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]