Clang compiling needs help

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

Clang compiling needs help

Richard Pennington 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

Richard Pennington 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

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington 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

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington 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

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington 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

Richard Pennington 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

Richard Pennington 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
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); [hidden email]
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:[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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
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:[hidden email]]
> Sent: 02 March 2017 12:32
> To: Michelle Gu (micgu); Simon Dardis
> Cc: [hidden email]
> 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); [hidden email]
> 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:[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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
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:[hidden email]]
Sent: 2017年3月2日 20:37
To: Alon Shaltiel (ashaltie) <[hidden email]>; Michelle Gu (micgu) <[hidden email]>
Cc: [hidden email]
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:[hidden email]]
> Sent: 02 March 2017 12:32
> To: Michelle Gu (micgu); Simon Dardis
> Cc: [hidden email]
> 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); [hidden email]
> 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:[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

clang file.txt (4K) Download Attachment
linked lib.txt (2M) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
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:[hidden email]]
> Sent: 06 March 2017 01:23
> To: Simon Dardis; Alon Shaltiel (ashaltie)
> Cc: [hidden email]
> 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:[hidden email]]
> Sent: 2017年3月2日 20:37
> To: Alon Shaltiel (ashaltie) <[hidden email]>; Michelle Gu (micgu)
> <[hidden email]>
> Cc: [hidden email]
> 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:[hidden email]]
> > Sent: 02 March 2017 12:32
> > To: Michelle Gu (micgu); Simon Dardis
> > Cc: [hidden email]
> > 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); [hidden email]
> > 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:[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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
Hi Simon,

Let me explain what I did first.
I used clang to compile a lib.
Then I move this lib to another environment which is not clang.
In that environment, I linked the lib generated in clang with other object to get a final object.
The final object is running on mips platform.

I met the issue during getting the final object.

-v in the another environment is just for version.
The output is as below. But I'm afraid this is not what you need.

OTAServer@OTAServer-VM201 /cygdrive/d/RDA/Projects/QW300/soft
$ mips-elf-ld -v
GNU ld (GNU Binutils) 2.20 (Coolsand Tech v.4)


BR,
Michelle

-----Original Message-----
From: Simon Dardis [mailto:[hidden email]]
Sent: 2017年3月7日 19:13
To: Michelle Gu (micgu) <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

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:[hidden email]]
> Sent: 06 March 2017 01:23
> To: Simon Dardis; Alon Shaltiel (ashaltie)
> Cc: [hidden email]
> 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:[hidden email]]
> Sent: 2017年3月2日 20:37
> To: Alon Shaltiel (ashaltie) <[hidden email]>; Michelle Gu (micgu)
> <[hidden email]>
> Cc: [hidden email]
> 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:[hidden email]]
> > Sent: 02 March 2017 12:32
> > To: Michelle Gu (micgu); Simon Dardis
> > Cc: [hidden email]
> > 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); [hidden email]
> > 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:[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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington via cfe-dev
Hi Simon,

Attached is the log with --verbose.

BR,
Michelle

-----Original Message-----
From: Michelle Gu (micgu)
Sent: 2017年3月16日 14:07
To: 'Simon Dardis' <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Simon,

Let me explain what I did first.
I used clang to compile a lib.
Then I move this lib to another environment which is not clang.
In that environment, I linked the lib generated in clang with other object to get a final object.
The final object is running on mips platform.

I met the issue during getting the final object.

-v in the another environment is just for version.
The output is as below. But I'm afraid this is not what you need.

OTAServer@OTAServer-VM201 /cygdrive/d/RDA/Projects/QW300/soft
$ mips-elf-ld -v
GNU ld (GNU Binutils) 2.20 (Coolsand Tech v.4)


BR,
Michelle

-----Original Message-----
From: Simon Dardis [mailto:[hidden email]]
Sent: 2017年3月7日 19:13
To: Michelle Gu (micgu) <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

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:[hidden email]]
> Sent: 06 March 2017 01:23
> To: Simon Dardis; Alon Shaltiel (ashaltie)
> Cc: [hidden email]
> 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:[hidden email]]
> Sent: 2017年3月2日 20:37
> To: Alon Shaltiel (ashaltie) <[hidden email]>; Michelle Gu (micgu)
> <[hidden email]>
> Cc: [hidden email]
> 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:[hidden email]]
> > Sent: 02 March 2017 12:32
> > To: Michelle Gu (micgu); Simon Dardis
> > Cc: [hidden email]
> > 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); [hidden email]
> > 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:[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

Edit1 (393K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
Simon, just to clarify, when generating that same lib with a different compiler everything works well.
Do you still think it has something to do with dynamic vs static crt objects?

-----Original Message-----
From: Michelle Gu (micgu)
Sent: Thursday, March 16, 2017 11:16 AM
To: Simon Dardis; Alon Shaltiel (ashaltie)
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Simon,

Attached is the log with --verbose.

BR,
Michelle

-----Original Message-----
From: Michelle Gu (micgu)
Sent: 2017年3月16日 14:07
To: 'Simon Dardis' <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Simon,

Let me explain what I did first.
I used clang to compile a lib.
Then I move this lib to another environment which is not clang.
In that environment, I linked the lib generated in clang with other object to get a final object.
The final object is running on mips platform.

I met the issue during getting the final object.

-v in the another environment is just for version.
The output is as below. But I'm afraid this is not what you need.

OTAServer@OTAServer-VM201 /cygdrive/d/RDA/Projects/QW300/soft
$ mips-elf-ld -v
GNU ld (GNU Binutils) 2.20 (Coolsand Tech v.4)


BR,
Michelle

-----Original Message-----
From: Simon Dardis [mailto:[hidden email]]
Sent: 2017年3月7日 19:13
To: Michelle Gu (micgu) <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

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:[hidden email]]
> Sent: 06 March 2017 01:23
> To: Simon Dardis; Alon Shaltiel (ashaltie)
> Cc: [hidden email]
> 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:[hidden email]]
> Sent: 2017年3月2日 20:37
> To: Alon Shaltiel (ashaltie) <[hidden email]>; Michelle Gu (micgu)
> <[hidden email]>
> Cc: [hidden email]
> 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:[hidden email]]
> > Sent: 02 March 2017 12:32
> > To: Michelle Gu (micgu); Simon Dardis
> > Cc: [hidden email]
> > 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); [hidden email]
> > 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:[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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington via cfe-dev
Hi Michelle, Alon,

I'm seeing two problems. The first is that somehow a cpic object is being pulled into the
link, but I'm not seeing where. I was suspecting crtbegin.o is at fault as none of the library
files are marked cpic, but I'm unsure that it's that object now.

The second problem (which is causing the link to fail altogether) is that the linker is
rejecting the merge of the objects produced by clang and the portions of libgcc.a. There's
a number of possible reasons for this.

It could be rejecting the link because the clang produced objects contains gnu attributes
it doesn't understand or are incompatible with the ones in libgcc.a.

A second possible reason is the supplied linker only permits xcpu objects to be linked
together, i.e. you can't link mips32r2 objects with xcpu objects.

If the xcpu is really a mips1 chip with the usual mips1 structural hazards, clang+llvm can't
target it currently, as it doesn't deal with the mips1 hazards.

Thanks,
Simon

________________________________________
From: Michelle Gu (micgu) [[hidden email]]
Sent: 16 March 2017 09:15
To: Simon Dardis; Alon Shaltiel (ashaltie)
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Simon,

Attached is the log with --verbose.

BR,
Michelle

-----Original Message-----
From: Michelle Gu (micgu)
Sent: 2017年3月16日 14:07
To: 'Simon Dardis' <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Simon,

Let me explain what I did first.
I used clang to compile a lib.
Then I move this lib to another environment which is not clang.
In that environment, I linked the lib generated in clang with other object to get a final object.
The final object is running on mips platform.

I met the issue during getting the final object.

-v in the another environment is just for version.
The output is as below. But I'm afraid this is not what you need.

OTAServer@OTAServer-VM201 /cygdrive/d/RDA/Projects/QW300/soft
$ mips-elf-ld -v
GNU ld (GNU Binutils) 2.20 (Coolsand Tech v.4)


BR,
Michelle

-----Original Message-----
From: Simon Dardis [mailto:[hidden email]]
Sent: 2017年3月7日 19:13
To: Michelle Gu (micgu) <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

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:[hidden email]]
> Sent: 06 March 2017 01:23
> To: Simon Dardis; Alon Shaltiel (ashaltie)
> Cc: [hidden email]
> 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:[hidden email]]
> Sent: 2017年3月2日 20:37
> To: Alon Shaltiel (ashaltie) <[hidden email]>; Michelle Gu (micgu)
> <[hidden email]>
> Cc: [hidden email]
> 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:[hidden email]]
> > Sent: 02 March 2017 12:32
> > To: Michelle Gu (micgu); Simon Dardis
> > Cc: [hidden email]
> > 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); [hidden email]
> > 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:[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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiling needs help

Richard Pennington via cfe-dev
Thanks Simon,

We checked with the vendor, and indeed the chip is mips1.
Does this mean we absolutely can't work with clang? Is it planned to be supported?

Thanks anyway for all your help! We really appreciate it.

-----Original Message-----
From: Simon Dardis [mailto:[hidden email]]
Sent: Monday, March 20, 2017 10:12 PM
To: Michelle Gu (micgu); Alon Shaltiel (ashaltie)
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Michelle, Alon,

I'm seeing two problems. The first is that somehow a cpic object is being pulled into the link, but I'm not seeing where. I was suspecting crtbegin.o is at fault as none of the library files are marked cpic, but I'm unsure that it's that object now.

The second problem (which is causing the link to fail altogether) is that the linker is rejecting the merge of the objects produced by clang and the portions of libgcc.a. There's a number of possible reasons for this.

It could be rejecting the link because the clang produced objects contains gnu attributes it doesn't understand or are incompatible with the ones in libgcc.a.

A second possible reason is the supplied linker only permits xcpu objects to be linked together, i.e. you can't link mips32r2 objects with xcpu objects.

If the xcpu is really a mips1 chip with the usual mips1 structural hazards, clang+llvm can't target it currently, as it doesn't deal with the mips1 hazards.

Thanks,
Simon

________________________________________
From: Michelle Gu (micgu) [[hidden email]]
Sent: 16 March 2017 09:15
To: Simon Dardis; Alon Shaltiel (ashaltie)
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Simon,

Attached is the log with --verbose.

BR,
Michelle

-----Original Message-----
From: Michelle Gu (micgu)
Sent: 2017年3月16日 14:07
To: 'Simon Dardis' <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

Hi Simon,

Let me explain what I did first.
I used clang to compile a lib.
Then I move this lib to another environment which is not clang.
In that environment, I linked the lib generated in clang with other object to get a final object.
The final object is running on mips platform.

I met the issue during getting the final object.

-v in the another environment is just for version.
The output is as below. But I'm afraid this is not what you need.

OTAServer@OTAServer-VM201 /cygdrive/d/RDA/Projects/QW300/soft
$ mips-elf-ld -v
GNU ld (GNU Binutils) 2.20 (Coolsand Tech v.4)


BR,
Michelle

-----Original Message-----
From: Simon Dardis [mailto:[hidden email]]
Sent: 2017年3月7日 19:13
To: Michelle Gu (micgu) <[hidden email]>; Alon Shaltiel (ashaltie) <[hidden email]>
Cc: [hidden email]
Subject: RE: Clang compiling needs help

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:[hidden email]]
> Sent: 06 March 2017 01:23
> To: Simon Dardis; Alon Shaltiel (ashaltie)
> Cc: [hidden email]
> 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:[hidden email]]
> Sent: 2017年3月2日 20:37
> To: Alon Shaltiel (ashaltie) <[hidden email]>; Michelle Gu (micgu)
> <[hidden email]>
> Cc: [hidden email]
> 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:[hidden email]]
> > Sent: 02 March 2017 12:32
> > To: Michelle Gu (micgu); Simon Dardis
> > Cc: [hidden email]
> > 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); [hidden email]
> > 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:[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...