Quantcast

Clang compiling needs help

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Clang compiling needs help

Ammarguellat, Zahira via cfe-dev

Dear Clang Experts,

 

I’m a Clang user. I met some problem during using Clang. Would you please help to give any suggestion?

 

I’m using Clang to compile a lib. The generated lib file will be linked to other source code in other compile environment.

One target of the final image is ARM and the other is MIPS.

 

When compile the lib for ARM, we use the options as below:

 

ARCH_OPTS=-target arm-none-eabi -mcpu=arm926ej-s

LLC_ARCH_OPTS="-mtriple armv5-none-none-eabi -mattr=+v5te"

AR=/usr/bin/ar

ARFLAGS=-rv

 

We got the lib successfully. But when linked to other source code in ARM, we got the error as below:

 

 

Do you have any idea of the error “invalid call from ‘~PRE8’”? Should I make some change when compile the lib with CLANG?

 

 

When compile the lib for MIPS, we use the options as below:

 

ARCH_OPTS=-target mipsel

CFLAGS=-c -fno-pic -mabicalls -integrated-as  

 

We got the lib successfully. But when linked to other source code in MIPS, we got the error as below:

 

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.elf] Error 1

make[1]: *** [/cygdrive/d/RDA/Projects/QW300/soft/build/8851m_dbs_rdamodem_qj/_d

efault_/8809/8851m_dbs_rdamodem_qj_debug.srec] Error 2

make: *** [lod] Error 2

 

Do you have any idea about the warnings? How about the errors?

 

I’m not familiar with Clang, but if not use Clang, the linking is successful. So we hope we can get some help from you, the experts of CLANG.

Thank you in advance!

 

BR,

Michelle

 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Ammarguellat, Zahira via cfe-dev

That error looks like an armlink error, and there’s some documentation for it here:

http://infocenter.arm.com/help/topic/com.arm.doc.dui0807g/dom1365073159742.html

 

Clang always emits objects with the PRES8 (preserves 8-byte stack alignment) and REQ8 (requires

8-byte stack alignment) attributes, so it looks like the error is coming from objects that haven’t

been built with clang (I’m guessing that’s the “other source code in ARM” you mention).

 

Probably you need to look these other objects and how they’re built  in order to resolve this.

 

John

 

From: cfe-dev [mailto:[hidden email]] On Behalf Of Michelle Gu (micgu) via cfe-dev
Sent: 07 February 2017 08:25
To: [hidden email]
Cc: Alon Shaltiel (ashaltie)
Subject: [cfe-dev] Clang compiling needs help

 

Dear Clang Experts,

 

I’m a Clang user. I met some problem during using Clang. Would you please help to give any suggestion?

 

I’m using Clang to compile a lib. The generated lib file will be linked to other source code in other compile environment.

One target of the final image is ARM and the other is MIPS.

 

When compile the lib for ARM, we use the options as below:

 

ARCH_OPTS=-target arm-none-eabi -mcpu=arm926ej-s

LLC_ARCH_OPTS="-mtriple armv5-none-none-eabi -mattr=+v5te"

AR=/usr/bin/ar

ARFLAGS=-rv

 

We got the lib successfully. But when linked to other source code in ARM, we got the error as below:

 

 

Do you have any idea of the error “invalid call from ‘~PRE8’”? Should I make some change when compile the lib with CLANG?

 

 

When compile the lib for MIPS, we use the options as below:

 

ARCH_OPTS=-target mipsel

CFLAGS=-c -fno-pic -mabicalls -integrated-as  

 

We got the lib successfully. But when linked to other source code in MIPS, we got the error as below:

 

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.elf] Error 1

make[1]: *** [/cygdrive/d/RDA/Projects/QW300/soft/build/8851m_dbs_rdamodem_qj/_d

efault_/8809/8851m_dbs_rdamodem_qj_debug.srec] Error 2

make: *** [lod] Error 2

 

Do you have any idea about the warnings? How about the errors?

 

I’m not familiar with Clang, but if not use Clang, the linking is successful. So we hope we can get some help from you, the experts of CLANG.

Thank you in advance!

 

BR,

Michelle

 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Ammarguellat, Zahira via cfe-dev
In reply to this post by Ammarguellat, Zahira via cfe-dev
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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Ammarguellat, Zahira via cfe-dev
In reply to this post by Ammarguellat, Zahira via cfe-dev

Hi John,

 

Thank you for feedback!

 

I emailed with the other objects’ vendor, they confirmed they are using ‘PRES8’ within their objects.

 

Do you have other suggestion?

 

BR,

Michelle

 

From: John Brawn [mailto:[hidden email]]
Sent: 2017
27 20:35
To: Michelle Gu (micgu) <[hidden email]>
Cc: Alon Shaltiel (ashaltie) <[hidden email]>; [hidden email]; nd <[hidden email]>
Subject: RE: Clang compiling needs help

 

That error looks like an armlink error, and there’s some documentation for it here:

http://infocenter.arm.com/help/topic/com.arm.doc.dui0807g/dom1365073159742.html

 

Clang always emits objects with the PRES8 (preserves 8-byte stack alignment) and REQ8 (requires

8-byte stack alignment) attributes, so it looks like the error is coming from objects that haven’t

been built with clang (I’m guessing that’s the “other source code in ARM” you mention).

 

Probably you need to look these other objects and how they’re built  in order to resolve this.

 

John

 

From: cfe-dev [[hidden email]] On Behalf Of Michelle Gu (micgu) via cfe-dev
Sent: 07 February 2017 08:25
To: [hidden email]
Cc: Alon Shaltiel (ashaltie)
Subject: [cfe-dev] Clang compiling needs help

 

Dear Clang Experts,

 

I’m a Clang user. I met some problem during using Clang. Would you please help to give any suggestion?

 

I’m using Clang to compile a lib. The generated lib file will be linked to other source code in other compile environment.

One target of the final image is ARM and the other is MIPS.

 

When compile the lib for ARM, we use the options as below:

 

ARCH_OPTS=-target arm-none-eabi -mcpu=arm926ej-s

LLC_ARCH_OPTS="-mtriple armv5-none-none-eabi -mattr=+v5te"

AR=/usr/bin/ar

ARFLAGS=-rv

 

We got the lib successfully. But when linked to other source code in ARM, we got the error as below:

 

 

Do you have any idea of the error “invalid call from ‘~PRE8’”? Should I make some change when compile the lib with CLANG?

 

 

When compile the lib for MIPS, we use the options as below:

 

ARCH_OPTS=-target mipsel

CFLAGS=-c -fno-pic -mabicalls -integrated-as  

 

We got the lib successfully. But when linked to other source code in MIPS, we got the error as below:

 

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.elf] Error 1

make[1]: *** [/cygdrive/d/RDA/Projects/QW300/soft/build/8851m_dbs_rdamodem_qj/_d

efault_/8809/8851m_dbs_rdamodem_qj_debug.srec] Error 2

make: *** [lod] Error 2

 

Do you have any idea about the warnings? How about the errors?

 

I’m not familiar with Clang, but if not use Clang, the linking is successful. So we hope we can get some help from you, the experts of CLANG.

Thank you in advance!

 

BR,

Michelle

 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Ammarguellat, Zahira via cfe-dev
In reply to this post by Ammarguellat, Zahira via cfe-dev
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:[hidden email]]
Sent: 2017年2月7日 22:04
To: Michelle Gu (micgu) <[hidden email]>; [hidden email]
Cc: Alon Shaltiel (ashaltie) <[hidden email]>
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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Ammarguellat, Zahira via cfe-dev
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) [[hidden email]]
Sent: 10 February 2017 02:07
To: Simon Dardis; [hidden email]
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:[hidden email]]
Sent: 2017年2月7日 22:04
To: Michelle Gu (micgu) <[hidden email]>; [hidden email]
Cc: Alon Shaltiel (ashaltie) <[hidden email]>
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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Ammarguellat, Zahira via cfe-dev
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:[hidden email]]
Sent: 2017年2月10日 22:21
To: Michelle Gu (micgu) <[hidden email]>
Cc: Alon Shaltiel (ashaltie) <[hidden email]>
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:[hidden email]] On Behalf Of
> Simon Dardis via cfe-dev
> Sent: 10 February 2017 13:45
> To: Michelle Gu (micgu); [hidden email]
> 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) [[hidden email]]
> Sent: 10 February 2017 02:07
> To: Simon Dardis; [hidden email]
> 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:[hidden email]]
> Sent: 2017年2月7日 22:04
> To: Michelle Gu (micgu) <[hidden email]>; [hidden email]
> Cc: Alon Shaltiel (ashaltie) <[hidden email]>
> 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
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...