[uClinux-dev] Latest GCC toolchain for m68k

Luis Alves ljalvs at gmail.com
Thu May 17 10:21:12 EDT 2012


Hi Greg,

Yes, that file exists in the sources gcc-<version>/gcc/config/m68k/uclinux.h
I've changed those flags and it works (at least in a small test with
the first pass gcc).

But take a look at the comments in my bug report:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53386

Someone says that it is related to the ABI change in gcc >= 4.3.x and
that I should use as target 'm68k-uclinuxoldabi' and
--with-cpu=m68000.

For now I've just changed the flags in the header file... maybe I'll
try building it with that weird target (m68k-uclinuxoldabi).


Regards,
Luis Alves



On Thu, May 17, 2012 at 2:59 PM, Greg Ungerer <gerg at snapgear.com> wrote:
> Hi Luis,
>
>
> On 05/17/2012 08:29 PM, Luis Alves wrote:
>>
>> A guy just posted a comment in my bug report. It happens that it is a
>> gcc configuration issue:
>>
>>> config/m68k/linux.h:
>>> /* for 68k machines this only needs to be TRUE for the 68000 */
>>>
>>> #undef STRICT_ALIGNMENT
>>> #define STRICT_ALIGNMENT 0
>>> #undef M68K_HONOR_TARGET_STRICT_ALIGNMENT
>>> #define M68K_HONOR_TARGET_STRICT_ALIGNMENT 0
>>
>>
>>
>> I don't know if this will affect the build for coldfire targets. If it
>> does then from now on the 68000 should be excluded from the coldfire
>> toolchains to avoid this issues.
>>
>> I'll build a nice toolchain for the 68000 and then make some more tests.
>
>
> Wow, that is interesting. I don't quite see why that should not
> always be set, otherwise how does specifying "-m68000" work at all.
>
> Is there a config/m68k/uclinux.h file?  I don't have the sources
> handly right now to check.
>
> Regards
> Greg
>
>
>
>> On Thu, May 17, 2012 at 7:45 AM, Greg Ungerer<gerg at snapgear.com>  wrote:
>>>
>>> Hi Luis,
>>>
>>>
>>> On 05/17/2012 12:58 PM, Luis Alves wrote:
>>>>
>>>>
>>>> I've built a new toolchain using the latest tools and gcc-4.6.4
>>>> (gcc-4.7.0 is giving me compiler internal errors!).
>>>> But unfortunately the results are the same (bad assembly code - It
>>>> look it is producing 68020 code, since when I use the -m68020 flag,
>>>> the resulting assembly code is equal!)
>>>
>>>
>>>
>>> That is bad...
>>>
>>>
>>>
>>>> I've downgraded gcc to 4.2.4 (the version I was using before this
>>>> toolchain quest) and it works (produces correct assembly code).
>>>> I don't know what is the latest working version for the 68000 targets.
>>>> Maybe I'll go one by one until I find the broken one...
>>>
>>>
>>>
>>> Ouch, doesn't sound like much fun.
>>>
>>>
>>>
>>>> I guess this is related to gcc so I've reported it as a bug it in the
>>>> gcc bugzilla (Bug 53386).
>>>>
>>>> Do you have any further suggestion?
>>>
>>>
>>>
>>> The gcc compile options looked good to me. If you have -m68000 set
>>> the you should be getting code that is good for 68000. I guess the
>>> code generation is at least only using the correct set of 68000
>>> instructions.
>>>
>>> Choosing a different optimization level may change the instruction/
>>> addressing modes used. But really that would just be a work around.
>>>
>>> Otherwise I would suggest sticking with 4.2.4 if that works.
>>>
>>> Regards
>>> Greg
>>>
>>>
>>>
>>>
>>>> On Wed, May 16, 2012 at 9:42 PM, Luis Alves<ljalvs at gmail.com>  Ã¡wrote:
>>>>>
>>>>>
>>>>> Hi Greg,
>>>>>
>>>>>
>>>>>> What are the compiler options supplied to gcc?
>>>>>> (If you make the kernel with V=1 then you get the full command
>>>>>> line trace)
>>>>>>
>>>>>
>>>>> Here is one:
>>>>>
>>>>> m68k-uclinux-gcc -Wp,-MD,net/sunrpc/.sysctl.o.d á-nostdinc -isystem
>>>>> /usr/local/lib/gcc/m68k-uclinux/4.5.1/include
>>>>> -I/root/m68k/20120401/uClinux-dist/linux-3.x/arch/m68k/include
>>>>> -Iarch/m68k/include/generated -Iinclude á-include
>>>>>
>>>>>
>>>>> /root/m68k/20120401/uClinux-dist/linux-3.x/include/linux/kconfig.h
>>>>> -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
>>>>> -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
>>>>> -Wno-format-security -fno-delete-null-pointer-checks -O2 -m68000 -pipe
>>>>> -DUTS_SYSNAME=\"uClinux\" -D__uClinux__ -Wframe-larger-than=1024
>>>>> -fno-stack-protector -fomit-frame-pointer
>>>>> -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow
>>>>> -fconserve-stack -DCC_HAVE_ASM_GOTO á á-D"KBUILD_STR(s)=#s"
>>>>>
>>>>>
>>>>> -D"KBUILD_BASENAME=KBUILD_STR(sysctl)"
>>>>> -D"KBUILD_MODNAME=KBUILD_STR(sunrpc)" -c -o net/sunrpc/sysctl.o
>>>>> net/sunrpc/sysctl.c
>>>>>
>>>>> I guess the -m68000 should be enough, but it isn't.
>>>>>
>>>>> I've compiled the same file with -m68020 and the output assembly is
>>>>> exactly the same.
>>>>>
>>>>>
>>>>>>
>>>>>>> When ever i have the time I'll try to build a toolchain (maybe using
>>>>>>> gcc 4.7) and check the generated code.
>>>>>>> Maybe I also could try the code sourcery one, but there is no
>>>>>>> reference for the 'legacy 68k' family on their download page (only
>>>>>>> coldfire).
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Any m68k targeted compiler should be able to generate code for any
>>>>>> family member with the right command line options. With the bundled
>>>>>> toolchains you may not have the libs generated for your specific
>>>>>> CPU member though.
>>>>>>
>>>>>
>>>>> I just confirmed and there is no support for non-coldfire cpu's in
>>>>> code sourcery toolchain...
>>>>>
>>>>>> Regards
>>>>>> Greg
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> Greg Ungerer á-- áPrincipal Engineer á á á
>>>>>> áEMAIL: á á
>>>>>> gerg at snapgear.com
>>>>>> SnapGear Group, McAfee á á á á á á á á
>>>>>> á á áPHONE: á á á
>>>>>> +61 7 3435 2888
>>>>>> 8 Gardner Close, á á á á á á á á á
>>>>>> á á á á áFAX: á á á
>>>>>> á +61 7 3891 3630
>>>>>> Milton, QLD, 4064, Australia á á á á á á á
>>>>>> áWEB:
>>>>>> http://www.SnapGear.com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Regards,
>>>>> Luis Alves
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> ------------------------------------------------------------------------
>>> Greg Ungerer á-- áPrincipal Engineer á á á áEMAIL: á á
>>> gerg at snapgear.com
>>> SnapGear Group, McAfee á á á á á á á á á á áPHONE: á á á
>>> +61 7 3435 2888
>>> 8 Gardner Close, á á á á á á á á á á á á á áFAX: á á á
>>> á +61 7 3891 3630
>>> Milton, QLD, 4064, Australia á á á á á á á áWEB:
>>> http://www.SnapGear.com
>>
>>
>>
>>
>
>
> --
> ------------------------------------------------------------------------
> Greg Ungerer  --  Principal Engineer        EMAIL:     gerg at snapgear.com
> SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
> 8 Gardner Close,                            FAX:         +61 7 3891 3630
> Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com



More information about the uClinux-dev mailing list