Try these commands: $ echo 'int main(void) { return 0;}' > xx.c $ gcc -o '' xx.c And if you have permission to remove /path/to/crtX.o, it will be removed, because gcc uses that as the output file. Although it is illegal to call gcc with an empty output filename, it really should not break any further link step by removing that crtX.o. Have seen this on linux, aix, solaris, and hpux. The best informational error message is from hpux: $ gcc -o '' xx.c /usr/ccs/bin/ld: Can't create /usr/ccs/lib/crt0.o /usr/ccs/bin/ld: Permission denied collect2: ld returned 1 exit status Same is true for 'g++', have not tried others.
Confirmed, huh, it's very old issue. I've got patch for that.
Author: marxin Date: Mon May 15 12:48:35 2017 New Revision: 248060 URL: https://gcc.gnu.org/viewcvs?rev=248060&root=gcc&view=rev Log: Do not allow empty argument of -o option (PR driver/31468). 2017-05-15 Martin Liska <mliska@suse.cz> PR driver/31468 * gcc.c (process_command): Do not allow empty argument of -o option. Modified: trunk/gcc/ChangeLog trunk/gcc/gcc.c
Fixed on trunk so far.
Author: marxin Date: Thu Jun 22 11:18:36 2017 New Revision: 249521 URL: https://gcc.gnu.org/viewcvs?rev=249521&root=gcc&view=rev Log: Backport r248060 2017-06-22 Martin Liska <mliska@suse.cz> Backport from mainline 2017-05-15 Martin Liska <mliska@suse.cz> PR driver/31468 * gcc.c (process_command): Do not allow empty argument of -o option. Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/gcc.c
Author: marxin Date: Thu Jun 22 11:29:02 2017 New Revision: 249534 URL: https://gcc.gnu.org/viewcvs?rev=249534&root=gcc&view=rev Log: Backport r248060 2017-06-22 Martin Liska <mliska@suse.cz> Backport from mainline 2017-05-15 Martin Liska <mliska@suse.cz> PR driver/31468 * gcc.c (process_command): Do not allow empty argument of -o option. Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/gcc.c
Author: marxin Date: Thu Jun 22 11:38:56 2017 New Revision: 249546 URL: https://gcc.gnu.org/viewcvs?rev=249546&root=gcc&view=rev Log: Backport r248060 2017-06-22 Martin Liska <mliska@suse.cz> Backport from mainline 2017-05-15 Martin Liska <mliska@suse.cz> PR driver/31468 * gcc.c (process_command): Do not allow empty argument of -o option. Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/gcc.c
Fixed on all active branches.