delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/04/08/13:02:40

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 8 Apr 2004 10:00:56 -0700 (PDT)
From: "Peter A. Castro" <doctor AT fruitbat DOT org>
To: Johan Holmberg <holmberg AT iar DOT se>
cc: cygwin AT cygwin DOT com
Subject: Re: Gcc/ld and long command lines (> 32k)
In-Reply-To: <Pine.GSO.4.50.0404081719370.380-100000@pjakkur.iar.se>
Message-ID: <Pine.LNX.4.53.0404080943250.1010@gremlin.fruitbat.org>
References: <Pine DOT GSO DOT 4 DOT 50 DOT 0404081719370 DOT 380-100000 AT pjakkur DOT iar DOT se>
MIME-Version: 1.0
X-IsSubscribed: yes

On Thu, 8 Apr 2004, Johan Holmberg wrote:

> Hi !
>
> I tried to compile/link an application consisting of several hundred
> C/C++ files. This gives quite a long command line when it is time
> to link the application.

A smarter, more traditional, approach would be to change your makefile to
archive object files after they are compiled into a static-link library
and then link against that.  Or, as part of your linking step, manually
archive some or all object files (enough to satisfy the command line
length limit issue) into a temporary library, link with it, then remove
it.

> Windows seem to have a limit of 32k for the length of the command
> line as given to to the system call 'CreateProcess'. I guess this is
> a "hard" limit in Windows.
>
> The length of my linker command line exceeds this 32k limit.
>
> Is it possible to pass a list of filenames to ld
> in some other way, to get around this limit ?
>
> I know about the special "@filename" syntax in Cygwin, but there
> seem to be two problems:

The @filename syntax is used by MS's linker (Visual C++/Studio).  To my
knowledge gcc's linker doesn't support this syntax.  Neither 'ld --help'
nor 'info ld' seem to present any options which support this syntax.  Try
my suggestion above.

> - it is no idea to give the special @filename argument to "gcc.exe",
>   since it is calling other exe-files and will have problems itself
>   to pass the file list on to these (ld, collect2, ...)
>
> - I tried to specify "-Wl,@files.txt" to "gcc.exe", hoping that
>   "@files.txt" would be picked up by "ld.exe", but I got the error
>   message:
>        ld: @files.txt: No such file: No such file or directory
>
>   Is ld.exe not interpreting the special "@" like other
>   Cygwin programs ?
>
> Am I missing some obvious way of doing what I want ?
>
> /Johan Holmberg

-- 
Peter A. Castro <doctor AT fruitbat DOT org> or <Peter DOT Castro AT oracle DOT com>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019