This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 14/14] the "compile" command


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]