[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-21 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

--- Comment #8 from schorsch_76 at gmx dot de ---
Toolchain Info:

georg@M4700-vm:~/Downloads/gcc-arm-none-eabi-7-2018-q2-update/bin$
./arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

georg@M4700-vm:~/Downloads/gcc-arm-none-eabi-7-2018-q2-update/bin$
./arm-none-eabi-ld --version
GNU ld (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 2.30.0.20180329
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-21 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

schorsch_76 at gmx dot de changed:

   What|Removed |Added

 Target||arm
   Host||x86_64

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-21 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

--- Comment #7 from schorsch_76 at gmx dot de ---
Created attachment 11354
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11354&action=edit
New Makefile with s/(MCU)/(CPU)/g

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-21 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

--- Comment #5 from schorsch_76 at gmx dot de ---
The project doesnt run, it is just as much scaled down to show this behaviour.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-21 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

--- Comment #6 from schorsch_76 at gmx dot de ---
Ops: I hade a small error in the specified makefile: Here is the update. I had
MCU instead of CPU variable used. But the __init_array_start is still greater
than __init_array_end.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-20 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

--- Comment #4 from schorsch_76 at gmx dot de ---
Created attachment 11353
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11353&action=edit
Linker script

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-20 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

--- Comment #3 from schorsch_76 at gmx dot de ---
Created attachment 11352
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11352&action=edit
Startup File for MCU

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] __init_array_end - __init_array_start < 0

2018-10-20 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

--- Comment #2 from schorsch_76 at gmx dot de ---
Created attachment 11351
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11351&action=edit
Makefile

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/23803] New: __init_array_end - __init_array_start < 0

2018-10-20 Thread schorsch_76 at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=23803

Bug ID: 23803
   Summary: __init_array_end - __init_array_start < 0
   Product: binutils
   Version: 2.30
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: schorsch_76 at gmx dot de
  Target Milestone: ---

The C++ Objects get instantiated from __libc_init_array. On this MCU it is
newlib. It initialize the c++ objects like this

https://github.com/redox-os/newlib/blob/master/newlib/libc/misc/init.c

/* Iterate over all the init routines.  */
void
__libc_init_array (void)
{
  size_t count;
  size_t i;

  count = __preinit_array_end - __preinit_array_start;
  for (i = 0; i < count; i++)
__preinit_array_start[i] ();

  _init ();

  count = __init_array_end - __init_array_start;
  for (i = 0; i < count; i++)
__init_array_start[i] ();
}

on my MCU (in the reset handler) i use gdb to print these variables, but they
are like this:

#0  0x0800017c in Reset_Handler ()
(gdb) print __init_array_start 
$1 = 134218568
(gdb) p __init_array_end 
$2 = 134217996
(gdb) p __init_array_end - __init_array_start 
$3 = -572

As count is an size_t it is unsigned and the loop doesn't stop. But end should
be greater than start in any case.

I created a very minimalistic c++ Project on Stm32F103RBT6 with the toolchain
from arm. It uses binutils and also tried different other compilers. like from
debian but all show this behaviour.

--- Comment #1 from schorsch_76 at gmx dot de ---
Created attachment 11350
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11350&action=edit
main.cpp

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils