[cfe-dev] Clang compiling needs help

Simon Dardis via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 7 03:13:14 PST 2017


Hi,

Those libraries and built objects look correct for noabi calls objects. I think the issue
is that clang is invoking the linker with the dynamic crt objects instead of the static crt
objects. Could you check by running the final link with -v in clang and see what directories
it points the linker to for the crt objects?

Thanks,
Simon

> -----Original Message-----
> From: Michelle Gu (micgu) [mailto:mgu at nds.com]
> Sent: 06 March 2017 01:23
> To: Simon Dardis; Alon Shaltiel (ashaltie)
> Cc: cfe-dev at lists.llvm.org
> Subject: RE: Clang compiling needs help
> 
> Hi Simon,
> 
> Thank you for your feedback.
> Attached are the output according to what you said.
> clang.txt is the log of the file I built, while linked.txt is the log of lib I want to
> link with.
> 
> BR,
> Michelle
> 
> -----Original Message-----
> From: Simon Dardis [mailto:Simon.Dardis at imgtec.com]
> Sent: 2017年3月2日 20:37
> To: Alon Shaltiel (ashaltie) <ashaltie at cisco.com>; Michelle Gu (micgu)
> <mgu at nds.com>
> Cc: cfe-dev at lists.llvm.org
> Subject: RE: Clang compiling needs help
> 
> Sorry about the delay in responding.
> 
> Can you run 'readelf -h' over the files you've built and the libraries you're
> linking against and report back?
> 
> You're looking for which files have 'cpic' in the Flags section of the ELF
> header.
> 
> Thanks,
> Simon
> 
> > -----Original Message-----
> > From: Alon Shaltiel (ashaltie) [mailto:ashaltie at cisco.com]
> > Sent: 02 March 2017 12:32
> > To: Michelle Gu (micgu); Simon Dardis
> > Cc: cfe-dev at lists.llvm.org
> > Subject: RE: Clang compiling needs help
> >
> > Can anyone please help with this?
> > The -mno-abicalls flag seems to still be problematic - even when using
> > the live svn build
> >
> > -----Original Message-----
> > From: Michelle Gu (micgu)
> > Sent: Wednesday, February 22, 2017 10:25 AM
> > To: Simon Dardis
> > Cc: Alon Shaltiel (ashaltie); cfe-dev at lists.llvm.org
> > Subject: RE: Clang compiling needs help
> >
> > Hi Simon,
> >
> > Thank you for your feedback!
> >
> > I checkout the live svn repository and build that
> > (http://www.llvm.org/docs/GettingStarted.html).
> >
> > Then use the option as below to get my object.
> >
> > ARCH_OPTS=-target mipsel
> > CFLAGS=-c -fno-pic -mno-abicalls -integrated-as
> >
> > But when linked to the mips object, the error code was still there.
> > Seems nothing changed.
> >
> > gcc.a(_ucmpdi2.o): warning: linking abicalls files with non-abicalls
> > files
> > mips-elf-ld: /cygdrive/d/RDA/Projects/QW300/soft/env/lib/gcc/mips-
> > elf/4.4.2//lib
> > gcc.a(_clzsi2.o): warning: linking abicalls files with non-abicalls
> > files
> > mips-elf-ld: /cygdrive/d/RDA/Projects/QW300/soft/env/lib/gcc/mips-
> > elf/4.4.2//lib
> > gcc.a(_fixunsdfsi.o): warning: linking abicalls files with
> > non-abicalls files
> > mips-elf-ld: /cygdrive/d/RDA/Projects/QW300/soft/env/lib/gcc/mips-
> > elf/4.4.2//lib
> > gcc.a(_pack_df.o): warning: linking abicalls files with non-abicalls
> > files
> > mips-elf-ld: /cygdrive/d/RDA/Projects/QW300/soft/env/lib/gcc/mips-
> > elf/4.4.2//lib
> > gcc.a(_unpack_df.o): warning: linking abicalls files with non-abicalls
> > files
> > mips-elf-ld: /cygdrive/d/RDA/Projects/QW300/soft/env/lib/gcc/mips-
> > elf/4.4.2//lib
> > gcc.a(_fpcmp_parts_df.o): warning: linking abicalls files with
> > non-abicalls file s
> > mips-elf-ld: /cygdrive/d/RDA/Projects/QW300/soft/env/lib/gcc/mips-
> > elf/4.4.2//lib
> > gcc.a(_ge_df.o): warning: linking abicalls files with non-abicalls
> > files
> > mips-elf-ld: /cygdrive/d/RDA/Projects/QW300/soft/env/lib/gcc/mips-
> > elf/4.4.2//lib
> > gcc.a(_df_to_si.o): warning: linking abicalls files with non-abicalls
> > files
> > make[2]: ***
> >
> [/cygdrive/d/RDA/Projects/QW300/soft/build/8851m_dbs_rdamodem_qj/_
> > d
> > efault_/8809/8851m_dbs_rdamodem_qj_debug_bin.elf] Error 1
> > make[1]: ***
> >
> [/cygdrive/d/RDA/Projects/QW300/soft/build/8851m_dbs_rdamodem_qj/_
> > d
> > efault_/8809/8851m_dbs_rdamodem_qj_debug_bin.srec] Error 2
> > make: *** [lod] Error 2
> >
> > Any other suggestion.
> >
> > BR,
> > Michelle
> >
> > -----Original Message-----
> > From: Simon Dardis [mailto:Simon.Dardis at imgtec.com]
> > Sent: 2017年2月10日 22:21
> > To: Michelle Gu (micgu) <mgu at nds.com>
> > Cc: Alon Shaltiel (ashaltie) <ashaltie at cisco.com>
> > Subject: RE: Clang compiling needs help
> >
> > Hi,
> >
> > My apologies, I spoke too soon. I'd forgotten that I also patched
> > clang recently to invoke the assembler correctly when -mno-abicalls is
> > passed to clang. Existing releases of clang will always pass
> > -call_nonpic to an external MIPS assembler. You could checkout the
> > live svn repository and build that
> > (http://www.llvm.org/docs/GettingStarted.html,
> > you'll need both llvm and clang) and use it to compile for MIPS. In
> > that case, I'd recommend using the integrated assembler (which is on
> > by default for MIPS32).
> >
> > Apologies again,
> > Simon
> >
> > > -----Original Message-----
> > > From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of
> > > Simon Dardis via cfe-dev
> > > Sent: 10 February 2017 13:45
> > > To: Michelle Gu (micgu); cfe-dev at lists.llvm.org
> > > Cc: Alon Shaltiel (ashaltie)
> > > Subject: Re: [cfe-dev] Clang compiling needs help
> > >
> > > Hi,
> > >
> > > You need to use 'fno-pic -mno-abicalls -fno-integrated-as' to get
> > > the output you're looking for I believe. It does require the use of
> > > the GNU assembler, which may require specifying the sysroot of your
> > > gcc installation so clang finds the assembler and/or making a symlink
> 'mipsel-as'
> > to your mips-elf-as.
> > >
> > > Hopefully that should work around the warning. I don't have any
> > > other suggestions with the output you've posted.
> > >
> > > -mno-abicalls with -fintegrated-as should be properly supported in
> > > the next release after 4.0.
> > >
> > > Thanks,
> > > Simon
> > > ________________________________________
> > > From: Michelle Gu (micgu) [mgu at nds.com]
> > > Sent: 10 February 2017 02:07
> > > To: Simon Dardis; cfe-dev at lists.llvm.org
> > > Cc: Alon Shaltiel (ashaltie)
> > > Subject: RE: Clang compiling needs help
> > >
> > > Hi Simon,
> > >
> > > Thank you for your feedback!
> > >
> > > First, I delete '-fno-pic -mabicalls' options and rerun the
> > > compiling, the error result is same as before. I doubt if these options
> work or not.
> > > Second, when I tried to link my lib with other projects, I can see
> > > compile option ' WITHOUT_WERROR=1' during compiling. I think that
> > > means it's not the problem of warnings became errors.
> > >
> > > Do you have any other suggestion?
> > >
> > > BR,
> > > Michelle
> > >
> > > -----Original Message-----
> > > From: Simon Dardis [mailto:Simon.Dardis at imgtec.com]
> > > Sent: 2017年2月7日 22:04
> > > To: Michelle Gu (micgu) <mgu at nds.com>; cfe-dev at lists.llvm.org
> > > Cc: Alon Shaltiel (ashaltie) <ashaltie at cisco.com>
> > > Subject: RE: Clang compiling needs help
> > >
> > > The "warning: linking abicalls files with non-abicalls files"
> > > warning is almost certainly arising from a long standing LLVM bug
> > > where all files produced from the integrated assembler for MIPS were
> > > marked as being abicalls files. It's fixed on ToT.
> > >
> > > In theory the produced binary should be fine, as the error is
> > > occurring from incorrect ELF header flags. The error from 'make' may
> > > be due to treating warnings as errors.
> > >
> > > The CFLAGS you've specified appear to be inconsistent with your
> > > mips-elf target. "-fno-pic -mabicalls"
> > > produces position dependant code that can call position independent
> code.
> > > This would be for environments such as Linux/BSDs/etc. mips-elf I
> > > expect is a bare-metal environment, so -mabicalls would not be used
> > > for
> > that target.
> > >
> > > Thanks,
> > > Simon
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > cfe-dev mailing list
> > > cfe-dev at lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


More information about the cfe-dev mailing list