public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* A ARM target question
@ 2022-06-14  4:57 Gary Oblock
  2022-06-14 18:09 ` fedor_qd
  2022-06-15 17:31 ` Stefan Ring
  0 siblings, 2 replies; 7+ messages in thread
From: Gary Oblock @ 2022-06-14  4:57 UTC (permalink / raw)
  To: gcc-help

What is the target specification for a ARMv8.2A? I'm trying to build a cross compiler
that can emit Thumb2 instructions for this architectue.

Thanks,

Gary


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Ampere Computing or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. Any unauthorized review, copying, or distribution of this email (or any attachments thereto) is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.

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

* Re: A ARM target question
  2022-06-14  4:57 A ARM target question Gary Oblock
@ 2022-06-14 18:09 ` fedor_qd
  2022-06-15 17:31 ` Stefan Ring
  1 sibling, 0 replies; 7+ messages in thread
From: fedor_qd @ 2022-06-14 18:09 UTC (permalink / raw)
  To: Gary Oblock; +Cc: gcc-help


You wrote private email to public mail list.
--
Sent from Outlook Email App for Android аўторак, 14 чэрвеня 2022, 07:59AM +03:00 from Gary Oblock via Gcc-help  gcc-help@gcc.gnu.org :

>What is the target specification for a ARMv8.2A? I'm trying to build a cross compiler
>that can emit Thumb2 instructions for this architectue.
>
>Thanks,
>
>Gary
>
>
>CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Ampere Computing or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. Any unauthorized review, copying, or distribution of this email (or any attachments thereto) is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.

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

* Re: A ARM target question
  2022-06-14  4:57 A ARM target question Gary Oblock
  2022-06-14 18:09 ` fedor_qd
@ 2022-06-15 17:31 ` Stefan Ring
  2022-06-16  9:06   ` Richard Earnshaw
       [not found]   ` <BYAPR01MB54649B0092B3C6403A697BC6C6AC9@BYAPR01MB5464.prod.exchangelabs.com>
  1 sibling, 2 replies; 7+ messages in thread
From: Stefan Ring @ 2022-06-15 17:31 UTC (permalink / raw)
  To: gcc-help

On Tue, Jun 14, 2022 at 6:58 AM Gary Oblock via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> What is the target specification for a ARMv8.2A? I'm trying to build a cross compiler
> that can emit Thumb2 instructions for this architectue.

Are you talking about 32bit arm or aarch64? ARMv8.2A sounds like 64
bits, but Thumb2 sounds like 32 bits.

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

* Re: A ARM target question
  2022-06-15 17:31 ` Stefan Ring
@ 2022-06-16  9:06   ` Richard Earnshaw
       [not found]   ` <BYAPR01MB54649B0092B3C6403A697BC6C6AC9@BYAPR01MB5464.prod.exchangelabs.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Earnshaw @ 2022-06-16  9:06 UTC (permalink / raw)
  To: Stefan Ring, gcc-help

On 15/06/2022 18:31, Stefan Ring via Gcc-help wrote:
> On Tue, Jun 14, 2022 at 6:58 AM Gary Oblock via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
>>
>> What is the target specification for a ARMv8.2A? I'm trying to build a cross compiler
>> that can emit Thumb2 instructions for this architectue.
> 
> Are you talking about 32bit arm or aarch64? ARMv8.2A sounds like 64
> bits, but Thumb2 sounds like 32 bits.

Armv8 supports both AArch32 (32-bit) and AArch64 (64-bit) execution 
states.  To generate code for AArch32 you'll need the 'arm' 
configurations of GCC.  The 'aarch64' configuration can only generate 
code for 64-bit state.

R.

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

* Re: A ARM target question
       [not found]     ` <CAAxjCEzn+hm2eUShpaEmH9kLMo-rSTU71dNvMRmdqgt_wVvt2Q@mail.gmail.com>
@ 2022-06-17  5:33       ` Gary Oblock
  2022-06-17 11:59         ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Gary Oblock @ 2022-06-17  5:33 UTC (permalink / raw)
  To: Gary Oblock via Gcc-help

Stefan,

I'm not at all clear which of those many config parameters are meaningfull.

I borrowed  your --target and tried to build with this:

../sources/configure --prefix=$BASE/install --disable-bootstrap --enable-language=c --disable-multilib --target=arm-linux-gnueabihf

That failed like this:

echo | /home/gary/gcc_build_cross/objdir/./gcc/xgcc -B/home/gary/gcc_build_cross/objdir/./gcc/ -E -dM - | \
  sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \
-e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \
  sort -u > tmp-macro_list
cc1: error: no include path in which to search for stdc-predef.h

There was another error after this:

checking for arm-linux-gnueabihf-gcc... /home/gary/gcc_build_cross/objdir/./gcc/xgcc -B/home/gary/gcc_build_cross/objdir/./gcc/ -B/home/gary/gcc_build_cross/install/arm-linux-gnueabihf/bin/ -B/home/gary/gcc_build_cross/install/arm-linux-gnueabihf/lib/ -isystem /home/gary/gcc_build_cross/install/arm-linux-gnueabihf/include -isystem /home/gary/gcc_build_cross/install/arm-linux-gnueabihf/sys-include
checking for suffix of object files... configure: error: in `/home/gary/gcc_build_cross/objdir/arm-linux-gnueabihf/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details
make[1]: *** [Makefile:15371: configure-target-libgcc] Error 1

Any idea what went wrong? Note I looked at the config.log and there were lots of
errors there too (not that they were helpful to me.)

Many years ago I set up a simple GCC cross compiler for mips
as the starting point for the person creating a new target for a new chip.
It didn't seems so crazy hard as this is proving to be.

Thanks,

Gary



________________________________
From: Stefan Ring <stefanrin@gmail.com>
Sent: Thursday, June 16, 2022 12:45 AM
To: Gary Oblock <gary@amperecomputing.com>
Subject: Re: A ARM target question

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.]


On Thu, Jun 16, 2022 at 5:36 AM Gary Oblock <gary@amperecomputing.com> wrote:
>
> Stefan,
>
> Frankly, I don't know. But, honestly, I don't think it matters if it's 64 machine running
> in Thumb-2 mode for if it's 32-bit machine. I'm trying to pry this out of my FW group
> but like I said I'm pretty sure that it doesn't matter. What does matter is it has to
> use the GCC 12 code base because of the things GCC 12 is capable of doing.
> This is a big experiment to see what if and not a production quality effort.
>
> I'm not sure GCC 12 or the latest binutils support Thumb-2. Do you know if they do?
> If they do what would I used for "--target=*-*-*" ?

It would be preferable to respond to the mailing list. I just checked
in an Ubuntu impish chroot. It’s gcc 11.2, but I’m certain it will
still work with gcc 12. For arm it’s usually a good idea to follow
what Ubuntu does.

(impish32)sr@odroid:~$ cat h.c
#include <stdio.h>

int main()
{
    printf("Hello thumb!\n");
    return 0;
}
(impish32)sr@odroid:~$ gcc -c -O2 h.c
(impish32)sr@odroid:~$ objdump -d h.o

h.o:     file format elf32-littlearm


Disassembly of section .text.startup:

00000000 <main>:
   0:   4803            ldr     r0, [pc, #12]   ; (10 <main+0x10>)
   2:   b508            push    {r3, lr}
   4:   4478            add     r0, pc
   6:   f7ff fffe       bl      0 <puts>
   a:   2000            movs    r0, #0
   c:   bd08            pop     {r3, pc}
   e:   bf00            nop
  10:   00000008        .word   0x00000008

Sure looks like Thumb 2 to me.

AFAIK you don’t need to do anything to enable Thumb support, but if
it’s not the default by configuring with --with-mode=thumb, you can
always enable it with -mthumb.

(impish32)sr@odroid:~$ gcc h.o
(impish32)sr@odroid:~$ ./a.out
Hello thumb!
(impish32)sr@odroid:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/11/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.2.0-7ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2
--prefix=/usr --with-gcc-major-version-only --program-suffix=-11
--program-prefix=arm-linux-gnueabihf- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libitm --disable-libquadmath --disable-libquadmath-support
--enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions
--with-arch=armv7-a+fp --with-float=hard --with-mode=thumb
--disable-werror --enable-checking=release --build=arm-linux-gnueabihf
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Ubuntu 11.2.0-7ubuntu2)

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

* Re: A ARM target question
  2022-06-17  5:33       ` Gary Oblock
@ 2022-06-17 11:59         ` Jonathan Wakely
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Wakely @ 2022-06-17 11:59 UTC (permalink / raw)
  To: Gary Oblock; +Cc: Gary Oblock via Gcc-help

On Fri, 17 Jun 2022 at 06:34, Gary Oblock via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> Stefan,
>
> I'm not at all clear which of those many config parameters are meaningfull.
>
> I borrowed  your --target and tried to build with this:
>
> ../sources/configure --prefix=$BASE/install --disable-bootstrap --enable-language=c --disable-multilib --target=arm-linux-gnueabihf
>
> That failed like this:
>
> echo | /home/gary/gcc_build_cross/objdir/./gcc/xgcc -B/home/gary/gcc_build_cross/objdir/./gcc/ -E -dM - | \
>   sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \
> -e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \
>   sort -u > tmp-macro_list
> cc1: error: no include path in which to search for stdc-predef.h

Do you have a sysroot for the target?


> There was another error after this:
>
> checking for arm-linux-gnueabihf-gcc... /home/gary/gcc_build_cross/objdir/./gcc/xgcc -B/home/gary/gcc_build_cross/objdir/./gcc/ -B/home/gary/gcc_build_cross/install/arm-linux-gnueabihf/bin/ -B/home/gary/gcc_build_cross/install/arm-linux-gnueabihf/lib/ -isystem /home/gary/gcc_build_cross/install/arm-linux-gnueabihf/include -isystem /home/gary/gcc_build_cross/install/arm-linux-gnueabihf/sys-include
> checking for suffix of object files... configure: error: in `/home/gary/gcc_build_cross/objdir/arm-linux-gnueabihf/libgcc':
> configure: error: cannot compute suffix of object files: cannot compile
> See `config.log' for more details
> make[1]: *** [Makefile:15371: configure-target-libgcc] Error 1
>
> Any idea what went wrong? Note I looked at the config.log and there were lots of
> errors there too (not that they were helpful to me.)

You need to look in arm-linux-gnueabihf/libgcc/config.log not the
top-level config.log, and look for the "cannot compute suffix" error.

>
> Many years ago I set up a simple GCC cross compiler for mips
> as the starting point for the person creating a new target for a new chip.
> It didn't seems so crazy hard as this is proving to be.

It's not crazy hard, you just have to do the right steps in the right
order. It's not obvious, and not very well documented, but it's not
actually difficult. Just a few commands in the right order.

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

* Re: A ARM target question
@ 2022-06-22  2:54 Gary Oblock
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Oblock @ 2022-06-22  2:54 UTC (permalink / raw)
  Cc: Gary Oblock via Gcc-help

Well, regarding a sysroot I'm at a bit of a loss as to what to say.
Here is what the existing compiler (GCC 10 based) has for it's
config:

--build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi --prefix=/workdir/build/output/arm-zephyr-eabi --exec_prefix=/workdir/build/output/arm-zephyr-eabi --with-local-prefix=/workdir/build/output/arm-zephyr-eabi/arm-zephyr-eabi --with-headers=/workdir/build/output/arm-zephyr-eabi/arm-zephyr-eabi/include --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG 1.24.0.378_e011758' --enable-__cxa_atexit --disable-tm-clone-registry --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/workdir/build/build_arm/.build/arm-zephyr-eabi/buildtools --with-mpfr=/workdir/build/build_arm/.build/arm-zephyr-eabi/buildtools --with-mpc=/workdir/build/build_arm/.build/arm-zephyr-eabi/buildtools --with-isl=/workdir/build/build_arm/.build/arm-zephyr-eabi/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-target-optspace --disable-nls --enable-multiarch --with-multilib-list=rmprofile --enable-languages=c,c++ --with-gnu-ld --with-gnu-as --enable-initfini-array

I'm dealing with a zephyr customers SDK for everything and it's not like the paths i
in the parameters above correlate with anything I can find.

Note, the target above "arm-zephyr-eabi" is sane in that it works for a bit before things start to fail.

I tried

--prefix=$BASE/install --disable-bootstrap --enable-language=c --disable-multilib --target=arm-zephyr-eabi --with-sysroot=/home/garyzepher/zephyr/lib/libc

However, it seems that some of the include files (ac_nonexistent.h for instance) that it's looking for don't exist.

Thanks,

Gary

________________________________
From: Jonathan Wakely <jwakely.gcc@gmail.com>
Sent: Friday, June 17, 2022 4:59 AM
To: Gary Oblock <gary@amperecomputing.com>
Cc: Gary Oblock via Gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: A ARM target question

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.]


On Fri, 17 Jun 2022 at 06:34, Gary Oblock via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> Stefan,
>
> I'm not at all clear which of those many config parameters are meaningfull.
>
> I borrowed  your --target and tried to build with this:
>
> ../sources/configure --prefix=$BASE/install --disable-bootstrap --enable-language=c --disable-multilib --target=arm-linux-gnueabihf
>
> That failed like this:
>
> echo | /home/gary/gcc_build_cross/objdir/./gcc/xgcc -B/home/gary/gcc_build_cross/objdir/./gcc/ -E -dM - | \
>   sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \
> -e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \
>   sort -u > tmp-macro_list
> cc1: error: no include path in which to search for stdc-predef.h

Do you have a sysroot for the target?


> There was another error after this:
>
> checking for arm-linux-gnueabihf-gcc... /home/gary/gcc_build_cross/objdir/./gcc/xgcc -B/home/gary/gcc_build_cross/objdir/./gcc/ -B/home/gary/gcc_build_cross/install/arm-linux-gnueabihf/bin/ -B/home/gary/gcc_build_cross/install/arm-linux-gnueabihf/lib/ -isystem /home/gary/gcc_build_cross/install/arm-linux-gnueabihf/include -isystem /home/gary/gcc_build_cross/install/arm-linux-gnueabihf/sys-include
> checking for suffix of object files... configure: error: in `/home/gary/gcc_build_cross/objdir/arm-linux-gnueabihf/libgcc':
> configure: error: cannot compute suffix of object files: cannot compile
> See `config.log' for more details
> make[1]: *** [Makefile:15371: configure-target-libgcc] Error 1
>
> Any idea what went wrong? Note I looked at the config.log and there were lots of
> errors there too (not that they were helpful to me.)

You need to look in arm-linux-gnueabihf/libgcc/config.log not the
top-level config.log, and look for the "cannot compute suffix" error.

>
> Many years ago I set up a simple GCC cross compiler for mips
> as the starting point for the person creating a new target for a new chip.
> It didn't seems so crazy hard as this is proving to be.

It's not crazy hard, you just have to do the right steps in the right
order. It's not obvious, and not very well documented, but it's not
actually difficult. Just a few commands in the right order.

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

end of thread, other threads:[~2022-06-22  2:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14  4:57 A ARM target question Gary Oblock
2022-06-14 18:09 ` fedor_qd
2022-06-15 17:31 ` Stefan Ring
2022-06-16  9:06   ` Richard Earnshaw
     [not found]   ` <BYAPR01MB54649B0092B3C6403A697BC6C6AC9@BYAPR01MB5464.prod.exchangelabs.com>
     [not found]     ` <CAAxjCEzn+hm2eUShpaEmH9kLMo-rSTU71dNvMRmdqgt_wVvt2Q@mail.gmail.com>
2022-06-17  5:33       ` Gary Oblock
2022-06-17 11:59         ` Jonathan Wakely
2022-06-22  2:54 Gary Oblock

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).