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.


-- 
           Summary: Calling gcc with empty output filename can remove crt0.o
                    (crt1.o on linux)
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot haubenwallner at salomon dot at


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31468

Reply via email to