https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64499

            Bug ID: 64499
           Summary: -gsplit-dwarf splits objcopy argument at spaces in
                    file path
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlegg at feralinteractive dot com

If using -gsplit-dwarf and outputting an object file in a path containing
spaces, objcopy is invoked to copy the debug symbols to a dwo file, however the
dwo file path is split into multiple arguments at the spaces.

Here is a minimal test case that compiles an empty file:
$ gcc -v -gsplit-dwarf -x c -c /dev/null -o "o .o"
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --enable-multilib --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --disable-libgcj
--with-isl=/builddir/build/BUILD/gcc-4.9.2-20141101/obj-x86_64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.9.2-20141101/obj-x86_64-redhat-linux/cloog-install
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.2 20141101 (Red Hat 4.9.2-1) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-gsplit-dwarf' '-c' '-o' 'o .o' '-mtune=generic'
'-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.9.2/cc1 -quiet -v /dev/null -quiet
-dumpbase null -mtune=generic -march=x86-64 -auxbase-strip o .o -gsplit-dwarf
-version -o /tmp/ccUMU7DF.s
GNU C (GCC) version 4.9.2 20141101 (Red Hat 4.9.2-1) (x86_64-redhat-linux)
    compiled by GNU C version 4.9.2 20141101 (Red Hat 4.9.2-1), GMP version
6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.9.2 20141101 (Red Hat 4.9.2-1) (x86_64-redhat-linux)
    compiled by GNU C version 4.9.2 20141101 (Red Hat 4.9.2-1), GMP version
6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 03cfec3867418ce243292e9ba51d447c
COLLECT_GCC_OPTIONS='-v' '-gsplit-dwarf' '-c' '-o' 'o .o' '-mtune=generic'
'-march=x86-64'
 as -v --64 -o o .o /tmp/ccUMU7DF.s
GNU assembler version 2.24 (x86_64-redhat-linux) using BFD version version 2.24
COLLECT_GCC_OPTIONS='-v' '-gsplit-dwarf' '-c' '-o' 'o .o' '-mtune=generic'
'-march=x86-64'
 objcopy --extract-dwo o .o o .dwo
Usage: objcopy [option(s)] in-file [out-file]
 Copies a binary file, possibly transforming it in the process
 The options are:

I've cut off the rest of objcopy's usage output.

The command line arguments to objcopy in this example are
0) /usr/bin/objcopy
1) --extract-dwo
2) o .o
3) o
4) .dwo
Arguments 3 and 4 should be one argument, o .dwo.

Reply via email to