[Bug ld/10865] New: The entry point is mainCRTStartup

View: New views
4 Messages — Rating Filter:   Alert me  

[Bug ld/10865] New: The entry point is mainCRTStartup

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The documentation of ld [1] says that the default ENTRY point is start.  This
is not universally true; the default ENTRY point in MinGW is mainCRTStartup.

Steps to reproduce:

gcc -nostartfiles the following source code without crt2.o:

#include <stdio.h>
#include <stdlib.h>
int begin() { puts ("begin"); return 0; }
int start() { puts ("start"); return 0; }
int mainCRTStartup() { puts ("CRT"); return 0; }

The program prints "CRT", not "start".

In order to solve the problem, modify the documentation to say that the
initial symbol is implementation-dependent.

[1] <URL:http://sourceware.org/binutils/docs/ld/Entry-Point.html#Entry-Point>

--
           Summary: The entry point is mainCRTStartup
           Product: binutils
           Version: 2.19
            Status: NEW
          Severity: minor
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: giecrilj at stegny dot 2a dot pl
                CC: bug-binutils at gnu dot org
 GCC build triplet: mingw32
  GCC host triplet: mingw32
GCC target triplet: mingw32


http://sourceware.org/bugzilla/show_bug.cgi?id=10865

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug ld/10865] The entry point is mainCRTStartup

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From nickc at redhat dot com  2009-11-10 15:58 -------
Created an attachment (id=4379)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4379&action=view)
Amend linker documentation


--


http://sourceware.org/bugzilla/show_bug.cgi?id=10865

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug ld/10865] The entry point is mainCRTStartup

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From nickc at redhat dot com  2009-11-10 16:00 -------
Hi Christopher,

The uploaded patch changes the documentation to read:

   There are several ways to set the entry point.  The linker will
   set the entry point by trying each of the following methods in
   order, and stopping when one of them succeeds:

   * the `-e' ENTRY command-line option;

   * the `ENTRY(SYMBOL)' command in a linker script;

   * the value of a target specific symbol, if it is defined;  For many
     targets this is `start', but PE and BeOS based systems for example
     check a list of possible entry symbols, matching the first one
     found.

   * the address of the first byte of the `.text' section, if present;

   * The address `0'.

Does this seem OK to you ?

Cheers
  Nick

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://sourceware.org/bugzilla/show_bug.cgi?id=10865

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug ld/10865] The entry point is mainCRTStartup

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From giecrilj at stegny dot 2a dot pl  2009-11-10 16:14 -------
Subject: RE:  The entry point is mainCRTStartup

That patch is right, thanks, except that that PE is rather surprising
because is not used as a target symbol within gcc docs.  I cannot tell about
BeOS because I never got in touch with one.  I am going to report a bug
against MinGW as soon as the ld documentation is fixed to specify the
startup symbols supported.  That information should probably go to the
platform-specific section of ld also, except that I hope it is subject to
change because the implementation should be augmented to support
wide-character applications properly (or at least as properly as MSVCRT
allows, which means UTF-16LE and BMP only).
Cheers,
Chris

-----Original Message-----
From: nickc at redhat dot com [mailto:sourceware-bugzilla@...]
Sent: Tuesday, November 10, 2009 5:00 PM
To: giecrilj@...
Subject: [Bug ld/10865] The entry point is mainCRTStartup


------- Additional Comments From nickc at redhat dot com  2009-11-10 16:00
-------
Hi Christopher,

The uploaded patch changes the documentation to read:

   There are several ways to set the entry point.  The linker will
   set the entry point by trying each of the following methods in
   order, and stopping when one of them succeeds:

   * the `-e' ENTRY command-line option;

   * the `ENTRY(SYMBOL)' command in a linker script;

   * the value of a target specific symbol, if it is defined;  For many
     targets this is `start', but PE and BeOS based systems for example
     check a list of possible entry symbols, matching the first one
     found.

   * the address of the first byte of the `.text' section, if present;

   * The address `0'.

Does this seem OK to you ?

Cheers
  Nick

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://sourceware.org/bugzilla/show_bug.cgi?id=10865

------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.



--


http://sourceware.org/bugzilla/show_bug.cgi?id=10865

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils