This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 14/14] the "compile" command
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: tromey at redhat dot com, gdb-patches at sourceware dot org
- Date: Wed, 08 Oct 2014 21:42:46 +0300
- Subject: Re: [PATCH v2 14/14] the "compile" command
- Authentication-results: sourceware.org; auth=none
- References: <1403279874-23781-1-git-send-email-tromey at redhat dot com> <1403279874-23781-15-git-send-email-tromey at redhat dot com> <83fvizqtlq dot fsf at gnu dot org> <20141008174431 dot GB17704 at host2 dot jankratochvil dot net>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Wed, 8 Oct 2014 19:44:31 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
>
> > > + /* Override flags possibly coming from DW_AT_producer. */
> > > + compile_args = xstrdup ("-O0 -gdwarf-4"
> >
> > This cannot be a fixed setting, I think. E.g., MinGW compilers barf
> > when they see -gdwarf-4.
>
> I have to disagree, -gdwarf-4 works for me. One needs to build new GCC for
> libcc1.so anyway.
>
> $ for i in x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc;do $i --version|head -n1;echo 'main(){}'|$i -gdwarf-4 -x c -;file a.exe;objdump -Wi a.exe|egrep 'Version:|DW_AT_comp_dir'|grep -B1 /tmp|head -n1;done
> x86_64-w64-mingw32-gcc (GCC) 4.8.3 20140522 (Fedora MinGW 4.8.3-1.fc20)
> a.exe: PE32+ executable (console) x86-64, for MS Windows
> Version: 4
> i686-w64-mingw32-gcc (GCC) 4.8.3 20140522 (Fedora MinGW 4.8.3-1.fc20)
> a.exe: PE32 executable (console) Intel 80386, for MS Windows
> Version: 4
>
>
> > > + /* We use -fPIC to ensure that we can reference properly. Otherwise
> > > + on x86-64 a string constant's address might be truncated when gdb
> > > + loads the object; another approach would be -mcmodel=large, but
> > > + -fPIC seems more portable across back ends. */
> > > + " -fPIC"
> > > + /* We don't want warnings. */
> > > + " -w"
> > > + /* Override CU's possible -fstack-protector-strong. */
> > > + " -fno-stack-protector"
> >
> > Likewise: these are architecture dependent switches, they cannot be
> > fixed constants, I think.
>
> These options work for me for x86_64-w64-mingw32-gcc and i686-w64-mingw32-gcc.
AFAIK, MinGW compilers simply ignore -fPIC.
But if the feature will only work with these options and no others,
then I guess it's OK to have them as fixed strings.
Thanks, the documentation parts are OK.