View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000531 | GCC - GNU C Compiler | Bug | public | 2012-04-09 04:29 | 2020-08-24 03:13 |
Reporter | komh | Assigned To | psmedley | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Summary | 0000531: gcc 4.4.6 treat a non-option argument as a output file | ||||
Description | Hi/2. gcc 4.4.6 does not generate the executable unless -o is specified. For examples, gcc -lpthread test.c The above generate -lpthread.exe instead of test.exe. Of course, pthread.a should exist. gcc -Zomf -lpthread test.c this is also true. | ||||
Steps To Reproduce | gcc -lpthread test.c gcc -Zomf -lpthread test.c | ||||
Tags | No tags attached. | ||||
Attached Files | 0001-OS-2-Use-the-first-file-that-a-compiler-to-compile-i.patch (1,195 bytes)
From 4b41d498be392a4489dd4d35c8df7b0212e24b8e Mon Sep 17 00:00:00 2001 From: KO Myung-Hun <komh@chollian.net> Date: Sun, 29 Apr 2012 18:09:01 +0900 Subject: [PATCH] OS/2: Use the first file that a compiler to compile it as an input file --- gcc/gcc.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/gcc.c b/gcc/gcc.c index c113e90..939d616 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -6823,22 +6823,21 @@ main (int argc, char **argv) with %b in LINK_SPEC. We use the first input file that we can find a compiler to compile it instead of using infiles.language since for languages other than C we use aliases that we then lookup later. */ -#ifndef __EMX__ /* This code fails on OS/2 - revert to the GCC 3.4.6 code */ if (n_infiles > 0) { int i; for (i = 0; i < n_infiles ; i++) +#ifndef __EMX__ if (infiles[i].language && infiles[i].language[0] != '*') +#else + if (!infiles[i].language || infiles[i].language[0] != '*') +#endif { set_input (infiles[i].name); break; } } -#else - if (n_infiles > 0) - set_input (infiles[0].name); -#endif if (error_count == 0) { -- 1.7.3.2 | ||||
|
what is the behaviour on other platforms? |
|
gcc 4.6.1 of MingW generates 'a.exe'. |
|
gcc 4.6.1 on Ubutu 11 generates 'a.out' unless -o is specified. |
|
gcc 2.8.1 of emx 0.9d genereates test.exe. gcc 3.2.1 for emx generates -lpthread.exe |
|
I have some ideas on why this happens - GCC/2 has some weird stuff for adding .exe in gcc.c over and above what's used for windows - I've always planned on exploring what that does - perhaps backing it out will fix your issue - I will try look at it soon. |
|
ok - my original thought was wrong - I think the following in LINK_SPEC in emx.h is the problem: "%{!o*:-o %b%{Zdll|shared:.dll}%{!Zdll:%{!shared:%{!Zexe:.exe}}}} " \ I believe this adds a -o %b if o isn't a parameter. In STABS code - %b is: %b substitute the basename of the input file being processed. This is the substring up to (and not including) the last period and not including the directory. So this _should_ be OK but clearly isn't. Building a gcc.exe without that line and will see what happens |
|
OK - getting there - now I get a.out as the result of 'gcc -lpthread test.c' Just need to produce an executable now :P |
|
[U:\DEV\t]gcc -Zomf -lpthread test.c emxomfld: no output file, creating $$$.exe or $$$.dll |
|
I attach a patch, review please. |
|
Hi KO - your patch works nicely! |
|
Good to know that. If so, is it possible to get the fixed build ? Strangely, my build has a problem with -pipe option. |
|
http://smedley.id.au/gcc446.zip |
|
Thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-04-09 04:29 | komh | New Issue | |
2012-04-10 03:53 | psmedley | Note Added: 0002234 | |
2012-04-15 04:25 | komh | Note Added: 0002235 | |
2012-04-15 09:52 | komh | Note Added: 0002236 | |
2012-04-15 09:55 | komh | Note Added: 0002237 | |
2012-04-22 10:02 | psmedley | Note Added: 0002242 | |
2012-04-25 06:57 | psmedley | Assigned To | => psmedley |
2012-04-25 06:57 | psmedley | Status | new => assigned |
2012-04-25 09:38 | psmedley | Note Added: 0002252 | |
2012-04-26 09:22 | psmedley | Note Added: 0002254 | |
2012-04-26 09:48 | psmedley | Note Added: 0002256 | |
2012-04-29 09:18 | komh | Note Added: 0002257 | |
2012-04-29 09:19 | komh | File Added: 0001-OS-2-Use-the-first-file-that-a-compiler-to-compile-i.patch | |
2012-05-07 09:35 | psmedley | Note Added: 0002264 | |
2012-05-08 11:56 | komh | Note Added: 0002266 | |
2012-05-16 09:25 | psmedley | Note Added: 0002267 | |
2012-05-19 07:35 | komh | Note Added: 0002270 | |
2012-11-15 20:24 | psmedley | Status | assigned => resolved |
2012-11-15 20:24 | psmedley | Resolution | open => fixed |
2020-08-24 03:13 | psmedley | Status | resolved => closed |