public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
@ 2015-01-27 12:13 ` ramana at gcc dot gnu.org
  2015-01-27 12:27 ` jakub at gcc dot gnu.org
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-01-27 12:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

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

--- Comment #1 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
My first line of attack would be checking that while building up the jit, the
jit configury and build system is not using the --with-float=hard and
--with-fpu=vfpv3-d16 configure time option in some manner.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
  2015-01-27 12:13 ` [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not") ramana at gcc dot gnu.org
@ 2015-01-27 12:27 ` jakub at gcc dot gnu.org
  2015-01-27 14:28 ` dmalcolm at gcc dot gnu.org
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-27 12:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Both the compiler and libgccjit were configured with:
--with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard
--with-fpu=vfpv3-d16 --with-abi=aapcs-linux
on the configure command line.  Perhaps some of these options are set for
driver only (libgccjit presumably doesn't use any driver) and need to be passed
explicitly to the compiler?


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
  2015-01-27 12:13 ` [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not") ramana at gcc dot gnu.org
  2015-01-27 12:27 ` jakub at gcc dot gnu.org
@ 2015-01-27 14:28 ` dmalcolm at gcc dot gnu.org
  2015-01-27 15:47 ` ramana.radhakrishnan at arm dot com
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-27 14:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Both the compiler and libgccjit were configured with:
> --with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard
> --with-fpu=vfpv3-d16 --with-abi=aapcs-linux
> on the configure command line.  Perhaps some of these options are set for
> driver only (libgccjit presumably doesn't use any driver) and need to be
> passed explicitly to the compiler?

libgccjit *does* use the driver; the library runs toplev.c to generate a .s
file, then invokes the driver to turn it into a .so file.  It looks like
there's some kind of mismatch between these two things.

It looks like I'm going to need to get onto armvhl hw (or qemu) to investigate
further.

Jakub: BTW, the jit testsuite does extra-verbose logging, beyond jit.log; in
particular the arguments for both of the invocations above are logged to:
  gcc/testsuite/jit/*.log.txt
so if it's easy to hack up the specfile to stick these in the uuencoded logs,
that might be beneficial.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-01-27 14:28 ` dmalcolm at gcc dot gnu.org
@ 2015-01-27 15:47 ` ramana.radhakrishnan at arm dot com
  2015-01-27 18:48 ` dmalcolm at gcc dot gnu.org
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: ramana.radhakrishnan at arm dot com @ 2015-01-27 15:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #4 from ramana.radhakrishnan at arm dot com <ramana.radhakrishnan at arm dot com> ---
On 27/01/15 12:27, jakub at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810
>
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |jakub at gcc dot gnu.org
>
> --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> Both the compiler and libgccjit were configured with:
> --with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard
> --with-fpu=vfpv3-d16 --with-abi=aapcs-linux


The --with-abi=aapcs-linux in addition to the --with-float=hard argument 
is just wrong. In fact it allows for a case where if the order of 
command line arguments passed to the compiler if in some way is wrong, 
the code generated will force the compiler into passing floating point 
parameters through the integer registers rather than fp registers which 
is what the --with-float=hard configure time option is doing.

Really Fedora should remove this from the configure line as it only 
confuses people.

For the compiler built can you please post back the output is for a 
simple function that adds 2 float values and pushes it back up.

Ramana


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2015-01-27 15:47 ` ramana.radhakrishnan at arm dot com
@ 2015-01-27 18:48 ` dmalcolm at gcc dot gnu.org
  2015-01-27 19:40 ` dmalcolm at gcc dot gnu.org
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-27 18:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-01-27
     Ever confirmed|0                           |1

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
FWIW I'm on an arm box now, and am able to reproduce this with:
 --enable-host-shared --enable-languages=jit,c++ --disable-bootstrap
--enable-checking=release --with-float=hard

Am investigating.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2015-01-27 18:48 ` dmalcolm at gcc dot gnu.org
@ 2015-01-27 19:40 ` dmalcolm at gcc dot gnu.org
  2015-01-27 20:00 ` dmalcolm at gcc dot gnu.org
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-27 19:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I tried to configure the jit with just:
  --enable-host-shared --enable-languages=jit,c++ --disable-bootstrap
--enable-checking=release

but I ran into this error compiling libgcc:
  /usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or
directory

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62099#c5
said:
     "You need to use -with-float=hard when configuring GCC."
hence I added --with-float=hard to the above when configuring.

Was this correct?

Doing so enabled the build to complete, and I was able to run "make check-jit",
which showed the symptoms seen in comment #0.

Specifically, if I hack up gcc/testsuite/jit.dg/harness.h to add:
  gcc_jit_context_set_bool_option (
    ctxt,
    GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES,
    1);
and run e.g.
  make check-jit RUNTESTFLAGS="jit.exp=test-hello-world.c"
then gcc/testsuite/jit/test-hello-world.c.exe.log.txt shows that toplev is
invoked thusly:
JIT:    entering: toplev::main
JIT:     argv[0]: ./test-hello-world.c.exe
JIT:     argv[1]: /tmp/libgccjit-KmhzbL/fake.c
JIT:     argv[2]: -fPIC
JIT:     argv[3]: -O3
JIT:     argv[4]: -g
JIT:     argv[5]: -quiet
JIT:     argv[6]: --param
JIT:     argv[7]: ggc-min-expand=0
JIT:     argv[8]: --param
JIT:     argv[9]: ggc-min-heapsize=0

and then the driver is invoked thus on the resulting .s file:
JIT:      entering: void gcc::jit::playback::context::invoke_driver(const
char*, const char*, const char*, timevar_id_t, bool, bool)
JIT:       argv[0]: armv7l-unknown-linux-gnueabihf-gcc-5.0.0
JIT:       argv[1]: -shared
JIT:       argv[2]: /tmp/libgccjit-KmhzbL/fake.s
JIT:       argv[3]: -o
JIT:       argv[4]: /tmp/libgccjit-KmhzbL/fake.so
JIT:       argv[5]: -fno-use-linker-plugin
JIT:       argv[6]: (null)

(and the intermediates stay around due to the bool option above).

Invoking the driver by hand with those args replicates the issue:

$ LIBRARY_PATH=. ./armv7l-unknown-linux-gnueabihf-gcc-5.0.0 -shared
/tmp/libgccjit-KmhzbL/fake.s -o /tmp/libgccjit-KmhzbL/fake.so
-fno-use-linker-plugin
ld: error: /tmp/libgccjit-KmhzbL/fake.so uses VFP register arguments,
/tmp/ccCFmkbn.o does not
ld: failed to merge target specific data of file /tmp/ccCFmkbn.o

Invoking the driver with "-v" shows the commands it's running:
  as -v -mfloat-abi=hard -meabi=5 -o /tmp/ccBPOxW0.o
/tmp/libgccjit-KmhzbL/fake.s
GNU assembler version 2.24 (armv7hl-redhat-linux-gnueabi) using BFD version
version 2.24

  ld --eh-frame-hdr -shared -dynamic-linker /lib/ld-linux-armhf.so.3 -X -m
armelf_linux_eabi -o /tmp/libgccjit-KmhzbL/fake.so /lib/crti.o ./crtbeginS.o
-L. /tmp/ccBPOxW0.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed ./crtendS.o /lib/crtn.o

/usr/bin/ld: error: /tmp/libgccjit-KmhzbL/fake.so uses VFP register arguments,
/tmp/ccT3rLos.o does not
/usr/bin/ld: failed to merge target specific data of file /tmp/ccT3rLos.o

FWIW, eu-readelf on the .o file shows:

Object attributes section [16] '.ARM.attributes' of 47 bytes at offset 0x35b:
  Owner          Size
  aeabi            46
    File:          36
      CPU_name: ARM10TDMI
      CPU_arch: v5T
      ARM_ISA_use: Yes
      THUMB_ISA_use: Thumb-1
      ABI_FP_denormal: Needed
      ABI_FP_exceptions: Needed
      ABI_FP_number_model: IEEE 754
      ABI_align8_needed: Yes
      ABI_align8_preserved: Yes, except leaf SP
      ABI_enum_size: int
      ABI_optimization_goals: Aggressive Speed


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2015-01-27 19:40 ` dmalcolm at gcc dot gnu.org
@ 2015-01-27 20:00 ` dmalcolm at gcc dot gnu.org
  2015-01-28  9:36 ` ramana.radhakrishnan at arm dot com
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-27 20:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to ramana.radhakrishnan@arm.com from comment #4)
> On 27/01/15 12:27, jakub at gcc dot gnu.org wrote:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810
> >
> > Jakub Jelinek <jakub at gcc dot gnu.org> changed:
> >
> >             What    |Removed                     |Added
> > ----------------------------------------------------------------------------
> >                   CC|                            |jakub at gcc dot gnu.org
> >
> > --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> > Both the compiler and libgccjit were configured with:
> > --with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard
> > --with-fpu=vfpv3-d16 --with-abi=aapcs-linux
> 
> 
> The --with-abi=aapcs-linux in addition to the --with-float=hard argument 
> is just wrong. In fact it allows for a case where if the order of 
> command line arguments passed to the compiler if in some way is wrong, 
> the code generated will force the compiler into passing floating point 
> parameters through the integer registers rather than fp registers which 
> is what the --with-float=hard configure time option is doing.
> 
> Really Fedora should remove this from the configure line as it only 
> confuses people.

Ramana: I'm sorry, I had trouble parsing your comment (e.g. which option were
you referring to by "this" in the final sentence above).

What should I configure with when debugging this?
e.g. should I keep the --with-abi=aapcs-linux and lose the --with-float=hard? 
should I be testing with the other options Jakub mentioned?  etc.

(Sorry about my ignorance here; I'm not particularly familiar with arm, and my
test machine is slow which makes it difficult to exhaustively try every
possibility).


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2015-01-27 20:00 ` dmalcolm at gcc dot gnu.org
@ 2015-01-28  9:36 ` ramana.radhakrishnan at arm dot com
  2015-01-28 17:59 ` dmalcolm at gcc dot gnu.org
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: ramana.radhakrishnan at arm dot com @ 2015-01-28  9:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #8 from ramana.radhakrishnan at arm dot com <ramana.radhakrishnan at arm dot com> ---
On 27/01/15 20:00, dmalcolm at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810
>
> --- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
> (In reply to ramana.radhakrishnan@arm.com from comment #4)
>> On 27/01/15 12:27, jakub at gcc dot gnu.org wrote:
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810
>>>
>>> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
>>>
>>>              What    |Removed                     |Added
>>> ----------------------------------------------------------------------------
>>>                    CC|                            |jakub at gcc dot gnu.org
>>>
>>> --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
>>> Both the compiler and libgccjit were configured with:
>>> --with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard
>>> --with-fpu=vfpv3-d16 --with-abi=aapcs-linux
>>
>>
>> The --with-abi=aapcs-linux in addition to the --with-float=hard argument
>> is just wrong. In fact it allows for a case where if the order of
>> command line arguments passed to the compiler if in some way is wrong,
>> the code generated will force the compiler into passing floating point
>> parameters through the integer registers rather than fp registers which
>> is what the --with-float=hard configure time option is doing.
>>
>> Really Fedora should remove this from the configure line as it only
>> confuses people.
>
> Ramana: I'm sorry, I had trouble parsing your comment (e.g. which option were
> you referring to by "this" in the final sentence above).


By "this" in the final sentence, I referred to the 
--with-abi=aapcs-linux option.


>
> What should I configure with when debugging this?
> e.g. should I keep the --with-abi=aapcs-linux and lose the --with-float=hard?
> should I be testing with the other options Jakub mentioned?  etc.

The architecture specific options that are commonly used for 
bootstrapping on ARM hard float are the following.

--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16


>
> (Sorry about my ignorance here; I'm not particularly familiar with arm, and my
> test machine is slow which makes it difficult to exhaustively try every
> possibility).

No problem it's not an issue - there are quite a few options available 
so it's not easy to get the correct options sorted in the first instance.


Ramana
>


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2015-01-28  9:36 ` ramana.radhakrishnan at arm dot com
@ 2015-01-28 17:59 ` dmalcolm at gcc dot gnu.org
  2015-01-28 18:21 ` dmalcolm at gcc dot gnu.org
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-28 17:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #9 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks Ramana.

I attempted a build of the jit with the configuration you suggested,
specifically:

  $ ../src/configure \
      --enable-host-shared \
      --enable-languages=jit,c++ \
      --disable-bootstrap \
      --enable-checking=release \
      --prefix=/home/dmalcolm/gcc-git-jit/install-jit \
      --with-arch=armv7-a \
      --with-float=hard \
      --with-fpu=vfpv3-d16

Unfortunately, I see the same failures.

Hacking in a "-v" into the driver invocation in jit-playback.c...

diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
index d2549a0..5f570a7 100644
--- a/gcc/jit/jit-playback.c
+++ b/gcc/jit/jit-playback.c
@@ -2271,6 +2271,8 @@ invoke_driver (const char *ctxt_progname,
      time.  */
   ADD_ARG ("-fno-use-linker-plugin");

+  ADD_ARG ("-v");
+
   /* pex argv arrays are NULL-terminated.  */
   ADD_ARG (NULL);

...I see that libgccjit attempts to invoke the driver to convert the .s
to a .so, but it fails like so:

Target: armv7l-unknown-linux-gnueabihf
Configured with: ../src/configure --enable-host-shared
--enable-languages=jit,c++ --disable-bootstrap --enable-checking=release
--prefix=/home/dmalcolm/gcc-git-jit/install-jit --with-arch=armv7-a
--with-float=hard --with-fpu=vfpv3-d16
Thread model: posix
gcc version 5.0.0 20150126 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-shared' '-o' '/tmp/libgccjit-VxeXM1/fake.so'
'-fno-use-linker-plugin' '-v' '-march=armv7-a' '-mfloat-abi=hard'
'-mfpu=vfpv3-d16' '-mtls-dialect=gnu'
 as -v -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -meabi=5 -o
/tmp/ccCY7c5L.o /tmp/libgccjit-VxeXM1/fake.s
GNU assembler version 2.24 (armv7hl-redhat-linux-gnueabi) using BFD version
version 2.24
COMPILER_PATH=
LIBRARY_PATH=/home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-shared' '-o' '/tmp/libgccjit-VxeXM1/fake.so'
'-fno-use-linker-plugin' '-v' '-march=armv7-a' '-mfloat-abi=hard'
'-mfpu=vfpv3-d16' '-mtls-dialect=gnu'
 ld --eh-frame-hdr -shared -dynamic-linker /lib/ld-linux-armhf.so.3 -X -m
armelf_linux_eabi -o /tmp/libgccjit-VxeXM1/fake.so /lib/crti.o
/home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc/crtbeginS.o
-L/home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc /tmp/ccCY7c5L.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc/crtendS.o /lib/crtn.o
ld: error: /tmp/libgccjit-VxeXM1/fake.so uses VFP register arguments,
/tmp/ccCY7c5L.o does not
ld: failed to merge target specific data of file /tmp/ccCY7c5L.o

That said, with the "test-empty.c" testcase, the generated
"fake.s" looks like this:

        .cpu arm10tdmi
        .fpu softvfp
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 2
        .eabi_attribute 30, 2
        .eabi_attribute 34, 0
        .arm
        .syntax divided
        .file   "fake.c"
        .text
.Ltext0:
        .cfi_sections   .debug_frame
.Letext0:
        .section        .debug_line,"",%progbits
.Ldebug_line0:
        .section        .debug_str,"MS",%progbits,1
.LASF0:
        .ascii  "/tmp/libgccjit-La3Yzk/fake.c\000"
.LASF1:
        .ascii  "libgccjit 5.0.0 20150126 (experimental) -fPIC -O3 -"
        .ascii  "g --param ggc-min-expand=0 --param ggc-min-heapsize"
        .ascii  "=0\000"
        .ident  "GCC: (GNU) 5.0.0 20150126 (experimental)"
        .section        .note.GNU-stack,"",%progbits

In particular, I'm guessing that the line:
        .fpu softvfp
is at fault here.

This appears to come from arm.c:arm_file_start:
25689         if (TARGET_SOFT_FLOAT)
25690           {
25691             fpu_name = "softvfp";
25692           }
25693         else
and on debugging:
(gdb) p global_options.x_arm_float_abi
$1 = ARM_FLOAT_ABI_SOFT

Is this value bogus, given the configure-time options?

(if so, I'm guessing this is a jit-specific state-management issue)


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2015-01-28 17:59 ` dmalcolm at gcc dot gnu.org
@ 2015-01-28 18:21 ` dmalcolm at gcc dot gnu.org
  2015-01-28 20:59 ` dmalcolm at gcc dot gnu.org
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-28 18:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #10 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Trying a hw watchpoint:
  (gdb) watch global_options.x_arm_float_abi
shows this is never touched within test-empty.c.exe

Invoking ./xgcc verbosely on an empty C file:

  $ ./xgcc -c -xc -v -B. -save-temps /dev/null

I note that ./cc1 and ./as are being invoked with various pertinent "-m"
options:

./cc1 -fpreprocessed null.i -quiet -dumpbase null -march=armv7-a
-mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -auxbase null -version -o
null.s


./as -v -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -meabi=5 -o null.o
null.s


(e.g. -mfloat-abi=hard etc)

null.s looks like this:
        .arch armv7-a
        .eabi_attribute 28, 1
        .fpu vfpv3-d16
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 2
        .eabi_attribute 30, 6
        .eabi_attribute 34, 1
        .eabi_attribute 18, 4
        .arm
        .syntax divided
        .file   "null"
        .ident  "GCC: (GNU) 5.0.0 20150126 (experimental)"
        .section        .note.GNU-stack,"",%progbits

Under non-jit operation the driver seems to invoking cc1 with -m options based
on configure-time settings, whereas within the jit, jit-playback.c builds an
argv for toplev::main analogous to invoking cc1, but doesn't attempt to inject
these additional -m options, hence we get a bogus .fpu attribute, and indeed,
the other settings are likely to be bogus also.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2015-01-28 18:21 ` dmalcolm at gcc dot gnu.org
@ 2015-01-28 20:59 ` dmalcolm at gcc dot gnu.org
  2015-01-28 21:30 ` dmalcolm at gcc dot gnu.org
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-28 20:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #11 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
A breakpoint on "do_option_spec" in the driver shows that the options come from
configure_default_options and option_default_specs.

configure_default_options comes from configargs.h, written out by
gcc/configure(.ac) which seems to get configure_default_options from config.gcc
(from ${t})

This would be easy to use, if only we could guarantee it was "-mKEY=VALUE", but
it isn't; doing it naively the "obvious" way:

--- a/gcc/jit/jit-playback.c
+++ b/gcc/jit/jit-playback.c
@@ -63,6 +63,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "context.h"
 #include "fold-const.h"
 #include "debug.h"
+#include "configargs.h"

 #include "jit-common.h"
 #include "jit-logging.h"
@@ -2118,6 +2119,19 @@ make_fake_args (vec <char *> *argvec,
       }
   }

+  {
+    for (unsigned i = 0; i < ARRAY_SIZE (configure_default_options); i++)
+      {
+       char *arg = concat ("-m",
+                           configure_default_options[i].name,
+                           "=",
+                           configure_default_options[i].value,
+                           NULL);
+       ADD_ARG_TAKE_OWNERSHIP (arg);
+      }
+  }
+
 #undef ADD_ARG
 #undef ADD_ARG_TAKE_OWNERSHIP
 }

fails in toplev::main:
  test-empty.c.exe: error: unrecognized command line option '-mfloat=hard'
  test-empty.c.exe: error: unrecognized command line option '-mtls=gnu'

(these ought to be -mfloat-abi and -mtls-dialect respectively).

option_default_specs comes from OPTION_DEFAULT_SPECS.

OPTION_DEFAULT_SPECS can be defined by the config, and is for 20 targets,
including arm (arm.h):
/* Support for a compile-time default CPU, et cetera.  The rules are:
   --with-arch is ignored if -march or -mcpu are specified.
   --with-cpu is ignored if -march or -mcpu are specified, and is overridden
    by --with-arch.
   --with-tune is ignored if -mtune or -mcpu are specified (but not affected
     by -march).
   --with-float is ignored if -mfloat-abi is specified.
   --with-fpu is ignored if -mfpu is specified.
   --with-abi is ignored if -mabi is specified.
   --with-tls is ignored if -mtls-dialect is specified. */
#define OPTION_DEFAULT_SPECS \
  {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \
  {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
  {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \
  {"float", "%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}" }, \
  {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \
  {"abi", "%{!mabi=*:-mabi=%(VALUE)}"}, \
  {"mode", "%{!marm:%{!mthumb:-m%(VALUE)}}"}, \
  {"tls", "%{!mtls-dialect=*:-mtls-dialect=%(VALUE)}"},

So it looks like the jit has to support whatever OPTION_DEFAULT_SPECS is set
for the target.

I'm working on a patch that expands these spec values so that they can be
injected by libgccjit into toplev::main (and maybe into its own invocation of
the driver?).

Unfortunately, this requires running the driver at build time, which would
require build==host.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2015-01-28 20:59 ` dmalcolm at gcc dot gnu.org
@ 2015-01-28 21:30 ` dmalcolm at gcc dot gnu.org
  2015-01-28 21:36 ` dmalcolm at gcc dot gnu.org
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-28 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #12 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Created attachment 34612
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34612&action=edit
WIP patch to inject configure-time options into jit's toplev::main (no
ChangeLog yet)


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2015-01-28 21:30 ` dmalcolm at gcc dot gnu.org
@ 2015-01-28 21:36 ` dmalcolm at gcc dot gnu.org
  2015-01-28 21:41 ` jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-28 21:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #13 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #12)
> Created attachment 34612 [details]
> WIP patch to inject configure-time options into jit's toplev::main (no
> ChangeLog yet)

With this patch, the 1st iteration of each test case works, with toplev::main
containing e.g.:
JIT:    entering: toplev::main
JIT:     argv[0]: ./test-hello-world.c.exe
JIT:     argv[1]: /tmp/libgccjit-E39s8G/fake.c
JIT:     argv[2]: -fPIC
JIT:     argv[3]: -O3
JIT:     argv[4]: -g
JIT:     argv[5]: -quiet
JIT:     argv[6]: --param
JIT:     argv[7]: ggc-min-expand=0
JIT:     argv[8]: --param
JIT:     argv[9]: ggc-min-heapsize=0
JIT:     argv[10]: -fdump-tree-all
JIT:     argv[11]: -fdump-rtl-all
JIT:     argv[12]: -fdump-ipa-all
JIT:     argv[13]: -march=armv7-a
JIT:     argv[14]: -mfloat-abi=hard
JIT:     argv[15]: -mfpu=vfpv3-d16
JIT:     argv[16]: -mtls-dialect=gnu

(note the presence of e.g. "-mfloat-abi=hard")

However, it fails on the 2nd in-process iteration of each test case, with e.g.:
GNU assembler version 2.24 (armv7hl-redhat-linux-gnueabi) using BFD version
version 2.24
/tmp/libgccjit-E39s8G/fake.s: Assembler messages:
/tmp/libgccjit-E39s8G/fake.s:1: Error: unknown cpu `armv7-a'
./test-hello-world.c.exe: error: error invoking gcc driver: exit_status: 256
err: 0

The 1st iteration's .s file begins:

        .arch armv7-a
        .eabi_attribute 28, 1
        .fpu vfpv3-d16
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 2
        .eabi_attribute 30, 2
        .eabi_attribute 34, 1
        .arm
        .syntax divided
        .file   "fake.c"
        .text

2nd iteration's .s file begins:
        .cpu armv7-a
        .eabi_attribute 28, 1
        .fpu vfpv3-d16
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 2
        .eabi_attribute 30, 2
        .eabi_attribute 34, 1
        .arm
        .syntax divided
        .file   "fake.c"
        .text

Note the changing first line, from:
        .arch armv7-a
to:
        .cpu armv7-a

Am investigating.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2015-01-28 21:36 ` dmalcolm at gcc dot gnu.org
@ 2015-01-28 21:41 ` jakub at gcc dot gnu.org
  2015-01-28 22:07 ` dmalcolm at gcc dot gnu.org
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-28 21:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Wouldn't it be better to move the minimal spec parsing stuff from gcc.c to a
separate source file that you could link into libgccjit.so?
Adding another native build only restriction is undesirable.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2015-01-28 21:41 ` jakub at gcc dot gnu.org
@ 2015-01-28 22:07 ` dmalcolm at gcc dot gnu.org
  2015-01-28 22:10 ` dmalcolm at gcc dot gnu.org
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-28 22:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #15 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #13)
> Am investigating.

What appears to be happening is the 1st time through arm_option_override,
arm_selected_cpu is NULL, but is set to non-NULL at:
  arm_selected_cpu = arm_selected_arch;
The 2nd time through, arm_selected_cpu hasn't been reset, and so the condition:

  if (arm_selected_arch)
    {
      if (arm_selected_cpu)
    {
      /* Check for conflict between mcpu and march.  */

fires, and this clause fires:

        /* -mcpu wins.  */
        arm_selected_arch = NULL;

so we have a NULL arm_selected_arch and a non-NULL arm_selected_cpu.

Fix appears to be to simply set each of these to NULL at the top of
arm_option_override, to prevent state from previous in-process runs from
affecting things:

--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -2627,6 +2627,10 @@ arm_gimplify_va_arg_expr (tree valist, tree type,
gimple_seq *pre_p,
 static void
 arm_option_override (void)
 {
+  arm_selected_arch = NULL;
+  arm_selected_cpu = NULL;
+  arm_selected_tune = NULL;
+  
   if (global_options_set.x_arm_arch_option)
     arm_selected_arch = &all_architectures[arm_arch_option];

With this, and the previous patch, most of the jit testsuite passes.

I still see another failure in:
FAIL: test-expressions.c.exe killed: 12479 exp8 0 0 CHILDKILLED SIGSEGV
{segmentation violation}
which appears to be (yet) another issue.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2015-01-28 22:07 ` dmalcolm at gcc dot gnu.org
@ 2015-01-28 22:10 ` dmalcolm at gcc dot gnu.org
  2015-01-29  2:56 ` dmalcolm at gcc dot gnu.org
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-28 22:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #16 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #14)
> Wouldn't it be better to move the minimal spec parsing stuff from gcc.c to a
> separate source file that you could link into libgccjit.so?
> Adding another native build only restriction is undesirable.

Agreed; I'll see if I can come up with a way of doing this that isn't invasive.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (15 preceding siblings ...)
  2015-01-28 22:10 ` dmalcolm at gcc dot gnu.org
@ 2015-01-29  2:56 ` dmalcolm at gcc dot gnu.org
  2015-01-29  9:20 ` ramana.radhakrishnan at arm dot com
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-29  2:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #17 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #15)
[...snip..]
> I still see another failure in:
> FAIL: test-expressions.c.exe killed: 12479 exp8 0 0 CHILDKILLED SIGSEGV
> {segmentation violation}
> which appears to be (yet) another issue.

This turned out to be due to not handling DImode on arm in
jit_langhook_type_for_mode, can be fixed with:

--- a/gcc/jit/dummy-frontend.c
+++ b/gcc/jit/dummy-frontend.c
@@ -167,6 +167,9 @@ jit_langhook_type_for_mode (enum machine_mode mode, int
unsignedp)
   if (mode == TYPE_MODE (long_integer_type_node))
     return unsignedp ? long_unsigned_type_node : long_integer_type_node;

+  if (mode == TYPE_MODE (long_long_integer_type_node))
+    return unsignedp ? long_long_unsigned_type_node :
long_long_integer_type_node;
+


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (16 preceding siblings ...)
  2015-01-29  2:56 ` dmalcolm at gcc dot gnu.org
@ 2015-01-29  9:20 ` ramana.radhakrishnan at arm dot com
  2015-01-29 15:56 ` dmalcolm at gcc dot gnu.org
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: ramana.radhakrishnan at arm dot com @ 2015-01-29  9:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #18 from ramana.radhakrishnan at arm dot com <ramana.radhakrishnan at arm dot com> ---
On 28/01/15 17:58, dmalcolm at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810
>
> --- Comment #9 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
> Thanks Ramana.
>
> I attempted a build of the jit with the configuration you suggested,
> specifically:
>
>    $ ../src/configure \
>        --enable-host-shared \
>        --enable-languages=jit,c++ \
>        --disable-bootstrap \
>        --enable-checking=release \
>        --prefix=/home/dmalcolm/gcc-git-jit/install-jit \
>        --with-arch=armv7-a \
>        --with-float=hard \
>        --with-fpu=vfpv3-d16
>
> Unfortunately, I see the same failures.
>
> Hacking in a "-v" into the driver invocation in jit-playback.c...
>
> diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
> index d2549a0..5f570a7 100644
> --- a/gcc/jit/jit-playback.c
> +++ b/gcc/jit/jit-playback.c
> @@ -2271,6 +2271,8 @@ invoke_driver (const char *ctxt_progname,
>        time.  */
>     ADD_ARG ("-fno-use-linker-plugin");
>
> +  ADD_ARG ("-v");
> +
>     /* pex argv arrays are NULL-terminated.  */
>     ADD_ARG (NULL);
>
> ...I see that libgccjit attempts to invoke the driver to convert the .s
> to a .so, but it fails like so:
>
> Target: armv7l-unknown-linux-gnueabihf
> Configured with: ../src/configure --enable-host-shared
> --enable-languages=jit,c++ --disable-bootstrap --enable-checking=release
> --prefix=/home/dmalcolm/gcc-git-jit/install-jit --with-arch=armv7-a
> --with-float=hard --with-fpu=vfpv3-d16
> Thread model: posix
> gcc version 5.0.0 20150126 (experimental) (GCC)
> COLLECT_GCC_OPTIONS='-shared' '-o' '/tmp/libgccjit-VxeXM1/fake.so'
> '-fno-use-linker-plugin' '-v' '-march=armv7-a' '-mfloat-abi=hard'
> '-mfpu=vfpv3-d16' '-mtls-dialect=gnu'
>   as -v -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -meabi=5 -o
> /tmp/ccCY7c5L.o /tmp/libgccjit-VxeXM1/fake.s
> GNU assembler version 2.24 (armv7hl-redhat-linux-gnueabi) using BFD version
> version 2.24
> COMPILER_PATH=
> LIBRARY_PATH=/home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc/:/lib/:/usr/lib/
> COLLECT_GCC_OPTIONS='-shared' '-o' '/tmp/libgccjit-VxeXM1/fake.so'
> '-fno-use-linker-plugin' '-v' '-march=armv7-a' '-mfloat-abi=hard'
> '-mfpu=vfpv3-d16' '-mtls-dialect=gnu'
>   ld --eh-frame-hdr -shared -dynamic-linker /lib/ld-linux-armhf.so.3 -X -m
> armelf_linux_eabi -o /tmp/libgccjit-VxeXM1/fake.so /lib/crti.o
> /home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc/crtbeginS.o
> -L/home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc /tmp/ccCY7c5L.o -lgcc
> --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
> /home/dmalcolm/gcc-git-jit/build-jit-comment8/gcc/crtendS.o /lib/crtn.o
> ld: error: /tmp/libgccjit-VxeXM1/fake.so uses VFP register arguments,
> /tmp/ccCY7c5L.o does not
> ld: failed to merge target specific data of file /tmp/ccCY7c5L.o
>
> That said, with the "test-empty.c" testcase, the generated
> "fake.s" looks like this:
>
>          .cpu arm10tdmi
>          .fpu softvfp
>          .eabi_attribute 20, 1
>          .eabi_attribute 21, 1
>          .eabi_attribute 23, 3
>          .eabi_attribute 24, 1
>          .eabi_attribute 25, 1
>          .eabi_attribute 26, 2
>          .eabi_attribute 30, 2
>          .eabi_attribute 34, 0
>          .arm
>          .syntax divided
>          .file   "fake.c"
>          .text
> .Ltext0:
>          .cfi_sections   .debug_frame
> .Letext0:
>          .section        .debug_line,"",%progbits
> .Ldebug_line0:
>          .section        .debug_str,"MS",%progbits,1
> .LASF0:
>          .ascii  "/tmp/libgccjit-La3Yzk/fake.c\000"
> .LASF1:
>          .ascii  "libgccjit 5.0.0 20150126 (experimental) -fPIC -O3 -"
>          .ascii  "g --param ggc-min-expand=0 --param ggc-min-heapsize"
>          .ascii  "=0\000"
>          .ident  "GCC: (GNU) 5.0.0 20150126 (experimental)"
>          .section        .note.GNU-stack,"",%progbits
>
> In particular, I'm guessing that the line:
>          .fpu softvfp


> is at fault here.
>
> This appears to come from arm.c:arm_file_start:
> 25689         if (TARGET_SOFT_FLOAT)
> 25690           {
> 25691             fpu_name = "softvfp";
> 25692           }
> 25693         else
> and on debugging:
> (gdb) p global_options.x_arm_float_abi
> $1 = ARM_FLOAT_ABI_SOFT
>
> Is this value bogus, given the configure-time options?

Sorry about the slow response, I was unable to check email last evening.

Yes this value is bogus as are the other .cpu values - the assembler 
output suggests to me that the configure time options aren't being 
passed at all from the driver down when used as a jit. Given the 
configure options I would expect

.arch armv7-a
.fpu vfpv3-d16

and an EABI attribute tag to indicate the PCS.

I think you've worked this out reading down-thread.

Ramana
>
> (if so, I'm guessing this is a jit-specific state-management issue)
>


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (17 preceding siblings ...)
  2015-01-29  9:20 ` ramana.radhakrishnan at arm dot com
@ 2015-01-29 15:56 ` dmalcolm at gcc dot gnu.org
  2015-01-30 11:03 ` dmalcolm at gcc dot gnu.org
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-29 15:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #19 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to ramana.radhakrishnan@arm.com from comment #18)
[...snip...]
> Yes this value is bogus as are the other .cpu values - the assembler 
> output suggests to me that the configure time options aren't being 
> passed at all from the driver down when used as a jit. Given the 
> configure options I would expect
> 
> .arch armv7-a
> .fpu vfpv3-d16
> 
> and an EABI attribute tag to indicate the PCS.
> 
> I think you've worked this out reading down-thread.

Thanks for the confirmation.  I'm testing a patch for this now.


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (18 preceding siblings ...)
  2015-01-29 15:56 ` dmalcolm at gcc dot gnu.org
@ 2015-01-30 11:03 ` dmalcolm at gcc dot gnu.org
  2015-01-30 18:23 ` dmalcolm at gcc dot gnu.org
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-30 11:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #20 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Patches posted for review as:
  https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02704.html


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (19 preceding siblings ...)
  2015-01-30 11:03 ` dmalcolm at gcc dot gnu.org
@ 2015-01-30 18:23 ` dmalcolm at gcc dot gnu.org
  2015-02-02 15:21 ` dmalcolm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-30 18:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #21 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
*** Bug 64873 has been marked as a duplicate of this bug. ***


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (20 preceding siblings ...)
  2015-01-30 18:23 ` dmalcolm at gcc dot gnu.org
@ 2015-02-02 15:21 ` dmalcolm at gcc dot gnu.org
  2015-02-02 16:11 ` dmalcolm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-02-02 15:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #22 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Mon Feb  2 15:21:16 2015
New Revision: 220347

URL: https://gcc.gnu.org/viewcvs?rev=220347&root=gcc&view=rev
Log:
PR jit/64810: support DImode on arm

gcc/jit/ChangeLog:
    PR jit/64810
    * dummy-frontend.c (jit_langhook_type_for_mode): Support
    TYPE_MODE (long_long_integer_type_node).


Modified:
    trunk/gcc/jit/ChangeLog
    trunk/gcc/jit/dummy-frontend.c


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (21 preceding siblings ...)
  2015-02-02 15:21 ` dmalcolm at gcc dot gnu.org
@ 2015-02-02 16:11 ` dmalcolm at gcc dot gnu.org
  2015-02-03 17:20 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-02-02 16:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #23 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Mon Feb  2 16:11:15 2015
New Revision: 220351

URL: https://gcc.gnu.org/viewcvs?rev=220351&root=gcc&view=rev
Log:
PR jit/64810: fix for arm_option_override

gcc/ChangeLog:
    PR jit/64810
    * config/arm/arm.c (arm_option_override): Set
    arm_selected_arch/cpu/tune to NULL on entry.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (22 preceding siblings ...)
  2015-02-02 16:11 ` dmalcolm at gcc dot gnu.org
@ 2015-02-03 17:20 ` dmalcolm at gcc dot gnu.org
  2015-03-13  9:09 ` ramana at gcc dot gnu.org
  2015-03-13 14:17 ` dmalcolm at gcc dot gnu.org
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-02-03 17:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #24 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Tue Feb  3 17:19:58 2015
New Revision: 220373

URL: https://gcc.gnu.org/viewcvs?rev=220373&root=gcc&view=rev
Log:
PR jit/64810: driver, arm, jit: configure-time default options

gcc/ChangeLog:
    PR jit/64810
    * Makefile.in (GCC_OBJS): Add gcc-main.o.
    * gcc-main.c: New file, containing "main" taken from gcc.c.
    * gcc.c (do_self_spec): Free decoded_options.
    (class driver): Move declaration to gcc.h.
    (main): Move declaration and implementation to new file
    gcc-main.c.
    (driver_get_configure_time_options): New function.
    * gcc.h (class driver): Move this declaration here, from
    gcc.c.
    (driver_get_configure_time_options): New declaration.

gcc/jit/ChangeLog:
    PR jit/64810
    * Make-lang.in (jit_OBJS): Add jit/jit-spec.o and gcc.o.
    (LIBGCCJIT_FILENAME): Add EXTRA_GCC_OBJS.
    * jit-playback.c: Include gcc.h.
    (gcc::jit::playback::context::compile): Move mutex acquisition
    to before the call to make_fake_args.
    (append_arg_from_driver): New function.
    (gcc::jit::playback::context::make_fake_args): On the first call,
    call into driver_get_configure_time_options to get configure-time
    default options and cache them.  Add them to the args for
    toplev::main.
    * jit-spec.c: New source file.
    * docs/internals/test-hello-world.exe.log.txt: Update to reflect
    above changes.


Added:
    trunk/gcc/gcc-main.c
    trunk/gcc/jit/jit-spec.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/gcc.c
    trunk/gcc/gcc.h
    trunk/gcc/jit/ChangeLog
    trunk/gcc/jit/Make-lang.in
    trunk/gcc/jit/docs/_build/texinfo/libgccjit.texi
    trunk/gcc/jit/docs/internals/test-hello-world.exe.log.txt
    trunk/gcc/jit/jit-playback.c


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (23 preceding siblings ...)
  2015-02-03 17:20 ` dmalcolm at gcc dot gnu.org
@ 2015-03-13  9:09 ` ramana at gcc dot gnu.org
  2015-03-13 14:17 ` dmalcolm at gcc dot gnu.org
  25 siblings, 0 replies; 26+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-03-13  9:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #25 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Fixed presumably ?


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

* [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not")
       [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
                   ` (24 preceding siblings ...)
  2015-03-13  9:09 ` ramana at gcc dot gnu.org
@ 2015-03-13 14:17 ` dmalcolm at gcc dot gnu.org
  25 siblings, 0 replies; 26+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-03-13 14:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64810

--- Comment #26 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Ramana Radhakrishnan from comment #25)
> Fixed presumably ?

Mostly.  The remaining issue with configure-time options reaching the jit is
when gcc is configured with:
  --with-arch=native
I attempted to fix that, but it appeared to be non-trivial, so I think I'll
open that as a separate (non-arm) bug (sorry, have been on vacation in the
meantime, and need to page it all back in to my brain...)


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

end of thread, other threads:[~2015-03-13 14:17 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-64810-4@http.gcc.gnu.org/bugzilla/>
2015-01-27 12:13 ` [Bug jit/64810] jit not working on armv7hl ("ld: error: /tmp/libgccjit-ZGemdr/fake.so uses VFP register arguments, /tmp/ccJFCBsE.o does not") ramana at gcc dot gnu.org
2015-01-27 12:27 ` jakub at gcc dot gnu.org
2015-01-27 14:28 ` dmalcolm at gcc dot gnu.org
2015-01-27 15:47 ` ramana.radhakrishnan at arm dot com
2015-01-27 18:48 ` dmalcolm at gcc dot gnu.org
2015-01-27 19:40 ` dmalcolm at gcc dot gnu.org
2015-01-27 20:00 ` dmalcolm at gcc dot gnu.org
2015-01-28  9:36 ` ramana.radhakrishnan at arm dot com
2015-01-28 17:59 ` dmalcolm at gcc dot gnu.org
2015-01-28 18:21 ` dmalcolm at gcc dot gnu.org
2015-01-28 20:59 ` dmalcolm at gcc dot gnu.org
2015-01-28 21:30 ` dmalcolm at gcc dot gnu.org
2015-01-28 21:36 ` dmalcolm at gcc dot gnu.org
2015-01-28 21:41 ` jakub at gcc dot gnu.org
2015-01-28 22:07 ` dmalcolm at gcc dot gnu.org
2015-01-28 22:10 ` dmalcolm at gcc dot gnu.org
2015-01-29  2:56 ` dmalcolm at gcc dot gnu.org
2015-01-29  9:20 ` ramana.radhakrishnan at arm dot com
2015-01-29 15:56 ` dmalcolm at gcc dot gnu.org
2015-01-30 11:03 ` dmalcolm at gcc dot gnu.org
2015-01-30 18:23 ` dmalcolm at gcc dot gnu.org
2015-02-02 15:21 ` dmalcolm at gcc dot gnu.org
2015-02-02 16:11 ` dmalcolm at gcc dot gnu.org
2015-02-03 17:20 ` dmalcolm at gcc dot gnu.org
2015-03-13  9:09 ` ramana at gcc dot gnu.org
2015-03-13 14:17 ` dmalcolm at gcc dot gnu.org

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