public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug sim/27705] New: Error cross-compiling binutils-gdb for windows
@ 2021-04-07  9:58 stepanstepan0000 at gmail dot com
  2021-04-13  1:42 ` [Bug sim/27705] " tromey at sourceware dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: stepanstepan0000 at gmail dot com @ 2021-04-07  9:58 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 27705
           Summary: Error cross-compiling binutils-gdb for windows
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: sim
          Assignee: unassigned at sourceware dot org
          Reporter: stepanstepan0000 at gmail dot com
                CC: vapier at gentoo dot org
  Target Milestone: ---

I cloned binutils-gdb repository from master branch on a linux machine (Ubuntu)
and I want to compile it for Windows (using x86_64_w64_mingw32 toolchain).

First, I ran ./configure with the following options to specify the
cross-compile toolchain.

./configure --prefix=/usr/x86_64-w64-mingw32 --target=arm-none-eabi
--host=x86_64-w64-mingw32

Then I ran make and get the following error (I omitted most of the output
because it is pretty large):

[...]
x86_64-w64-mingw32-gcc  -DHAVE_CONFIG_H 
-DWITH_DEFAULT_ALIGNMENT=STRICT_ALIGNMENT     -DDEFAULT_INLINE=0   -Wall
-Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused
-Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts
-Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body
-Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition
-Wno-format -Werror  -DMODET -I. -I. -I../common -I./../common -I../../include
-I./../../include -I../../bfd -I./../../bfd -I../../opcodes -I./../../opcodes
-I../../intl -g -O2     -c -o callback.o -MT callback.o -MMD -MP -MF
.deps/callback.Tpo ./../common/callback.c
./../common/callback.c: In function ‘os_time’:
./../common/callback.c:417:25: error: passing argument 1 of ‘time’ from
incompatible pointer type [-Werror=incompatible-pointer-types]
  417 |   return wrap (p, time (t));
      |                         ^
      |                         |
      |                         long int *
In file included from ./../common/callback.c:35:
/usr/share/mingw-w64/include/time.h:230:47: note: expected ‘time_t *’ {aka
‘long long int *’} but argument is of type ‘long int *’
  230 | static __inline time_t __CRTDECL time(time_t *_Time) { return
_time64(_Time); }
      |                                       ~~~~~~~~^~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:513: callback.o] Error 1
make[3]: Leaving directory '/media/D/Work/FC/binutils-gdb/sim/arm'
make[2]: *** [Makefile:928: all-recursive] Error 1
make[2]: Leaving directory '/media/D/Work/FC/binutils-gdb/sim'
make[1]: *** [Makefile:8376: all-sim] Error 2
make[1]: Leaving directory '/media/D/Work/FC/binutils-gdb'
make: *** [Makefile:915: all] Error 2

I think it has something to do with time_t being typedef'd as a long long int
(64 bit integer) in the host platform (Windows), however, the function os_time
from the file sim/common/callback.c:414 (path relative to project root), takes
a long (32 bit integer) as a parameter:

static long
os_time (host_callback *p, long *t)
{
  return wrap (p, time (t));
}

How can I fix this error?

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

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

* [Bug sim/27705] Error cross-compiling binutils-gdb for windows
  2021-04-07  9:58 [Bug sim/27705] New: Error cross-compiling binutils-gdb for windows stepanstepan0000 at gmail dot com
@ 2021-04-13  1:42 ` tromey at sourceware dot org
  2021-04-13  3:37 ` vapier at gentoo dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2021-04-13  1:42 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
If you want to try your hand at fixing the bug, the very
best thing to do would be to convert the callback 'time'
field to be of type 'time_t (*) (host_callback *)' -- removing
the second argument and using the correct return type.

If you don't want the sim, use --disable-sim when configuring
as a quick workaround.

If you do want the sim, but don't want to get too deep in
the weeds, I guess you can rewrite os_time to create a local
time_t and then cast it back; though from what I can tell
just using 'time (NULL)' would work as well, since no caller
seems to use this parameter.

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

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

* [Bug sim/27705] Error cross-compiling binutils-gdb for windows
  2021-04-07  9:58 [Bug sim/27705] New: Error cross-compiling binutils-gdb for windows stepanstepan0000 at gmail dot com
  2021-04-13  1:42 ` [Bug sim/27705] " tromey at sourceware dot org
@ 2021-04-13  3:37 ` vapier at gentoo dot org
  2021-04-24 18:44 ` [Bug sim/27705] sim/callback.c fails when time_t is not a long due to passing long* to time() vapier at gentoo dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vapier at gentoo dot org @ 2021-04-13  3:37 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Mike Frysinger <vapier at gentoo dot org> ---
doing a cast on the integer value instead of indirectly via pointer types makes
perfect sense.  we'll ignore the lack of 64-bit time_t in libgloss ports until
they implement the relevant syscalls (if they ever do).

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

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

* [Bug sim/27705] sim/callback.c fails when time_t is not a long due to passing long* to time()
  2021-04-07  9:58 [Bug sim/27705] New: Error cross-compiling binutils-gdb for windows stepanstepan0000 at gmail dot com
  2021-04-13  1:42 ` [Bug sim/27705] " tromey at sourceware dot org
  2021-04-13  3:37 ` vapier at gentoo dot org
@ 2021-04-24 18:44 ` vapier at gentoo dot org
  2021-05-15  1:06 ` cvs-commit at gcc dot gnu.org
  2021-05-15  1:20 ` vapier at gentoo dot org
  4 siblings, 0 replies; 6+ messages in thread
From: vapier at gentoo dot org @ 2021-04-24 18:44 UTC (permalink / raw)
  To: gdb-prs

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

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://sourceware.org/pipe
                   |                            |rmail/gdb-patches/2021-Apri
                   |                            |l/178147.html
   Last reconfirmed|                            |2021-04-24
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at sourceware dot org   |vapier at gentoo dot org
            Summary|Error cross-compiling       |sim/callback.c fails when
                   |binutils-gdb for windows    |time_t is not a long due to
                   |                            |passing long* to time()

--- Comment #3 from Mike Frysinger <vapier at gentoo dot org> ---
posted a few patches to handle this:
https://sourceware.org/pipermail/gdb-patches/2021-April/178147.html

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

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

* [Bug sim/27705] sim/callback.c fails when time_t is not a long due to passing long* to time()
  2021-04-07  9:58 [Bug sim/27705] New: Error cross-compiling binutils-gdb for windows stepanstepan0000 at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-24 18:44 ` [Bug sim/27705] sim/callback.c fails when time_t is not a long due to passing long* to time() vapier at gentoo dot org
@ 2021-05-15  1:06 ` cvs-commit at gcc dot gnu.org
  2021-05-15  1:20 ` vapier at gentoo dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-15  1:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Michael Frysinger
<vapier@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=00330cd18a4ba83beabad4cb9f4215170828cd29

commit 00330cd18a4ba83beabad4cb9f4215170828cd29
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat Apr 24 14:35:14 2021 -0400

    sim: callback: convert time interface to 64-bit

    PR sim/27705
    Rather than rely on time_t being the right size between the host &
    target, have the interface always be 64-bit.  We can figure out if
    we need to truncate when actually outputting it to the right target.

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

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

* [Bug sim/27705] sim/callback.c fails when time_t is not a long due to passing long* to time()
  2021-04-07  9:58 [Bug sim/27705] New: Error cross-compiling binutils-gdb for windows stepanstepan0000 at gmail dot com
                   ` (3 preceding siblings ...)
  2021-05-15  1:06 ` cvs-commit at gcc dot gnu.org
@ 2021-05-15  1:20 ` vapier at gentoo dot org
  4 siblings, 0 replies; 6+ messages in thread
From: vapier at gentoo dot org @ 2021-05-15  1:20 UTC (permalink / raw)
  To: gdb-prs

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

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Mike Frysinger <vapier at gentoo dot org> ---
should be fixed for gdb-11

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

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

end of thread, other threads:[~2021-05-15  1:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  9:58 [Bug sim/27705] New: Error cross-compiling binutils-gdb for windows stepanstepan0000 at gmail dot com
2021-04-13  1:42 ` [Bug sim/27705] " tromey at sourceware dot org
2021-04-13  3:37 ` vapier at gentoo dot org
2021-04-24 18:44 ` [Bug sim/27705] sim/callback.c fails when time_t is not a long due to passing long* to time() vapier at gentoo dot org
2021-05-15  1:06 ` cvs-commit at gcc dot gnu.org
2021-05-15  1:20 ` vapier at gentoo dot 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).