Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when building .S file with -mfloat-abi=soft

Bug #1304267 reported by changyp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Invalid
Undecided
Unassigned

Bug Description

I have a ASM file with extension .S
After I build this file with option
"-marm -march=armv4t -mfloat-abi=soft -c xxx.S -o xxx.o"
I checked xxx.o with command "arm-linux-gnueabihf-readelf -A xxx.o"

And the output is
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "4t"
  Tag_CPU_arch: v4T
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_FP_arch: VFPv3-D16

I noticed tag " Tag_FP_arch: VFPv3-D16", this tag prevents this xxx.o from linking with other .o files.

However, when building .c or .cpp files, the generated .o files don't have " Tag_FP_arch: VFPv3-D16"

It seems that AS doen't respect option "-mfloat-abi=soft" and always add "Tag_FP_arch: VFPv3-D16" to the genrated .o files

changyp (changyp6)
description: updated
Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

Can you attach your .S file for us to reproduce the issue?

If your .S is writen with hard float ABI, I think there is no way for AS to change your code.

Revision history for this message
changyp (changyp6) wrote :

I checked, the .S file doesn't contain any hard float ABI.

You can test with the attached file, which is from bandwidth arm.

please compile with the following options:

arm-linux-gnueabihf-gcc -c -O3 -Wall -o routinesARM.o -marm -march=armv4t -mfloat-abi=soft routinesARM.S

you can check it with command:

arm-linux-gnueabihf-readelf -A routinesARM.o

The output is

Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "4T"
  Tag_CPU_arch: v4T
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_FP_arch: VFPv3-D16

Revision history for this message
changyp (changyp6) wrote :

I consider this behavior as a bug is based on the following facts.

When I try to build a multi-lib Linaro arm linux gcc, I always get error messages like this "libgcc_s.so.tmp uses VFP registers while xxxx.o does not", when building for armv6 soft float libgcc_s.so, even if I added -mfloat-abi=soft and -msoft-float and configured eglibc with option --without-fp

After some investigation, I found crti.o crtn.o and crt1.o are always tagged with Tag_FP_arch: VFPv3.
But when I build .c and .cpp files with -mfloat-abi=soft, this tag goes away.

So I did a test with Linaro-arm-linux-gcc 2014.03, and I found that when multi-lib gcc build .S files, the VFP tag is always added, but when building .c or .cpp files, gcc respect option -mfloat-abi=soft and remove Tag_FP_arch: XXXX

Revision history for this message
changyp (changyp6) wrote :

I found a solution, when build .S file using multi-lib gcc, -mfloat-api=soft is not enough, option -Wa,-mfpu=softvfp also needs to be added to the command line to make AS generate .o file without tagging Tag_FP_arch.

Is it possible to make gcc pass -mfpu=softvfp to AS when building .S file with option -mfloat-api=soft by default ?

Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

"-mfpu=vfpv3-d16" is our default option. If you add "-v" when compiling the .S file, you can find the final options.

BTW:
What's the impact of "Tag_FP_arch: VFPv3-D16"? Link fail?

Revision history for this message
changyp (changyp6) wrote : Re: [Bug 1304267] Re: Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when building .S file with -mfloat-abi=soft

Yes,link fail.
The error would be xxx uses VFP register parameters,but xxx.o does not.
2014-4-9 上午11:55于 "Zhenqiang Chen" <email address hidden>写道:

> "-mfpu=vfpv3-d16" is our default option. If you add "-v" when compiling
> the .S file, you can find the final options.
>
> BTW:
> What's the impact of "Tag_FP_arch: VFPv3-D16"? Link fail?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1304267
>
> Title:
> Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when
> building .S file with -mfloat-abi=soft
>
> Status in Linaro GCC:
> New
>
> Bug description:
> I have a ASM file with extension .S
> After I build this file with option
> "-marm -march=armv4t -mfloat-abi=soft -c xxx.S -o xxx.o"
> I checked xxx.o with command "arm-linux-gnueabihf-readelf -A xxx.o"
>
> And the output is
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "4t"
> Tag_CPU_arch: v4T
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-1
> Tag_FP_arch: VFPv3-D16
>
> I noticed tag " Tag_FP_arch: VFPv3-D16", this tag prevents this xxx.o
> from linking with other .o files.
>
> However, when building .c or .cpp files, the generated .o files don't
> have " Tag_FP_arch: VFPv3-D16"
>
> It seems that AS doen't respect option "-mfloat-abi=soft" and always
> add "Tag_FP_arch: VFPv3-D16" to the genrated .o files
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-linaro/+bug/1304267/+subscriptions
>

Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

Then what's you link option? It seams you do not add the multilib options when linking the object files:

arm-linux-gnueabihf-gcc -marm -march=armv4t -mfloat-abi=soft ...

Revision history for this message
changyp (changyp6) wrote :

Thank you very much!
I forgot one option which led multilib link fail.
After I added that option, link works OK.

I still have one question.
I use crosstools-ng latest code to build multilib toolchain, I
modified t-mlibs to add arm mode softfp armv7-a support

the multilib options is "-marm -march=armv7-a -mtune=cortex-a9
-mfloat-abi=softfp -mfpu=vfpv3"
When building process goes to build libgcc stage 2, I always get the
following errors:

libgcc_s.so.1.tmp uses VFP registers, but xxx.o does not

I can't get any clue about this error.
Could you give me some suggestions about this error?

On Wed, Apr 9, 2014 at 1:44 PM, Zhenqiang Chen
<email address hidden> wrote:
> Then what's you link option? It seams you do not add the multilib
> options when linking the object files:
>
> arm-linux-gnueabihf-gcc -marm -march=armv4t -mfloat-abi=soft ...
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1304267
>
> Title:
> Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when
> building .S file with -mfloat-abi=soft
>
> Status in Linaro GCC:
> New
>
> Bug description:
> I have a ASM file with extension .S
> After I build this file with option
> "-marm -march=armv4t -mfloat-abi=soft -c xxx.S -o xxx.o"
> I checked xxx.o with command "arm-linux-gnueabihf-readelf -A xxx.o"
>
> And the output is
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "4t"
> Tag_CPU_arch: v4T
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-1
> Tag_FP_arch: VFPv3-D16
>
> I noticed tag " Tag_FP_arch: VFPv3-D16", this tag prevents this xxx.o
> from linking with other .o files.
>
> However, when building .c or .cpp files, the generated .o files don't
> have " Tag_FP_arch: VFPv3-D16"
>
> It seems that AS doen't respect option "-mfloat-abi=soft" and always
> add "Tag_FP_arch: VFPv3-D16" to the genrated .o files
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-linaro/+bug/1304267/+subscriptions

Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

Please check your (e)glibc build whether it has all the multilib builds.

And please try to add "--disable-multiarch" for your gcc config.

Finally, please goto the build-cc dir and run the final failed cmdline with additional option "-v" to check which libc is linked.

Changed in gcc-linaro:
status: New → Invalid
Revision history for this message
changyp (changyp6) wrote :

Hi Zhengqiang,

Thank you for your instruction.
I have found the root cause.
The problem causing this issue is that the link search path for
libgcc_s.so.1.tmp is wrong, it is set to the default path instead of
the multilib path.

Is this a bug in libgcc configure or somewhere else? How can I fix this issue?

Thanks again for your instruction!

On Wed, Apr 9, 2014 at 3:02 PM, Zhenqiang Chen
<email address hidden> wrote:
> Please check your (e)glibc build whether it has all the multilib builds.
>
> And please try to add "--disable-multiarch" for your gcc config.
>
> Finally, please goto the build-cc dir and run the final failed cmdline
> with additional option "-v" to check which libc is linked.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1304267
>
> Title:
> Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when
> building .S file with -mfloat-abi=soft
>
> Status in Linaro GCC:
> New
>
> Bug description:
> I have a ASM file with extension .S
> After I build this file with option
> "-marm -march=armv4t -mfloat-abi=soft -c xxx.S -o xxx.o"
> I checked xxx.o with command "arm-linux-gnueabihf-readelf -A xxx.o"
>
> And the output is
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "4t"
> Tag_CPU_arch: v4T
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-1
> Tag_FP_arch: VFPv3-D16
>
> I noticed tag " Tag_FP_arch: VFPv3-D16", this tag prevents this xxx.o
> from linking with other .o files.
>
> However, when building .c or .cpp files, the generated .o files don't
> have " Tag_FP_arch: VFPv3-D16"
>
> It seems that AS doen't respect option "-mfloat-abi=soft" and always
> add "Tag_FP_arch: VFPv3-D16" to the genrated .o files
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-linaro/+bug/1304267/+subscriptions

Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

I do not think it is a libgcc bug. If your multilib option is correct, libgcc should find the correct path.

Can you show me the multilib options?

./gcc/xgcc --print-multi-lib

And all your libc layout in your install dir?

Revision history for this message
changyp (changyp6) wrote :

I changed t-mlibs to support armv6k and armv7-a without fpu and with
vfpv3 respectively.
Here is the output
./gcc/xgcc -print-multi-lib
.;
armv7a-linux-gnueabi;@marm@march=armv7-a@mtune=cortex-a9@mfloat-abi=softfp@mfpu=vfpv3
armv6k-linux-gnueabi;@marm@march=armv6k@mtune=arm1136j-s@mfloat-abi=soft@Wa,-mfpu=softvfp

libc layout in install_root/arm-linux-gnueabihf/libc/usr/lib is

usr/lib
├── arm-linux-gnueabihf
│ ├── crt1.o
│ ├── crti.o
│ ├── crtn.o
│ └── libc.so
├── armv6k-linux-gnueabi
│ ├── crt1.o
│ ├── crti.o
│ ├── crtn.o
│ └── libc.so
└── armv7a-linux-gnueabi
    ├── crt1.o
    ├── crti.o
    ├── crtn.o
    └── libc.so

The final link commands of
armv6k-linux-gnueabi/libgcc/libgcc_s.so.1.tmp show that xgcc is
looking for ./gcc/crtendS.o instead of
./gcc/armv6k-linux-gnueabi/crtendS.o

However, libgcc_s.so.1 for armv7a-linux-gnueabi is compiled
successfully, the link command is correct,
armv7a-linux-gnueabi/libgcc/libgcc_s.so.1.tmp is linking
./gcc/armv7a-linux-gnueabi/crtendS.o

I don't understand why one multilib directory is correct, the other is wrong.

On Wed, Apr 9, 2014 at 5:29 PM, Zhenqiang Chen
<email address hidden> wrote:
> I do not think it is a libgcc bug. If your multilib option is correct,
> libgcc should find the correct path.
>
> Can you show me the multilib options?
>
> ./gcc/xgcc --print-multi-lib
>
> And all your libc layout in your install dir?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1304267
>
> Title:
> Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when
> building .S file with -mfloat-abi=soft
>
> Status in Linaro GCC:
> Invalid
>
> Bug description:
> I have a ASM file with extension .S
> After I build this file with option
> "-marm -march=armv4t -mfloat-abi=soft -c xxx.S -o xxx.o"
> I checked xxx.o with command "arm-linux-gnueabihf-readelf -A xxx.o"
>
> And the output is
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "4t"
> Tag_CPU_arch: v4T
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-1
> Tag_FP_arch: VFPv3-D16
>
> I noticed tag " Tag_FP_arch: VFPv3-D16", this tag prevents this xxx.o
> from linking with other .o files.
>
> However, when building .c or .cpp files, the generated .o files don't
> have " Tag_FP_arch: VFPv3-D16"
>
> It seems that AS doen't respect option "-mfloat-abi=soft" and always
> add "Tag_FP_arch: VFPv3-D16" to the genrated .o files
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-linaro/+bug/1304267/+subscriptions

Revision history for this message
changyp (changyp6) wrote :
Download full text (3.4 KiB)

Hi Zhengqiang,
I have found the root cause.

The following command can get correct results
./gcc/xgcc -print-multi-lib
.;
armv7a-linux-gnueabi;@marm@march=armv7-a@mtune=cortex-a9@mfloat-abi=softfp@mfpu=vfpv3
armv6k-linux-gnueabi;@marm@march=armv6k@mtune=arm1136j-s@mfloat-abi=soft@Wa,-mfpu=softvfp

./gcc/xgcc -print-multi-directory -marm -march=armv7-a
-mtune=cortex-a9 -mfloat-abi=softfp -mfpu=vfpv3
armv7a-linux-gnueabi

But this command can't get the correct multi-directory
./gcc/xgcc -print-multi-directory -marm -march=armv6k
-mtune=arm1136j-s -mfloat-abi=soft -Wa,-mfpu=softvfp
.
The result is .(dot), instead of armv6k-linux-gnueabi

I don't know if there's something wrong with my t-mlibs file, here is
my t-mlibs file, could you please help check and give me some
suggestions:

# A set of predefined MULTILIB for different ARM targets.
# Through the configure option --with-multilib-list, user can customize the
# final MULTILIB implementation.

comma := ,
space :=
space +=

MULTILIB_OPTIONS = marm
MULTILIB_DIRNAMES = arm
MULTILIB_OPTIONS += march=armv6k
MULTILIB_DIRNAMES += armv6k
MULTILIB_OPTIONS += march=armv7-a
MULTILIB_DIRNAMES += armv7-a
MULTILIB_OPTIONS += mtune=arm1136j-s
MULTILIB_DIRNAMES += arm1136j-s
MULTILIB_OPTIONS += mtune=cortex-a9
MULTILIB_DIRNAMES += cortex-a9
MULTILIB_OPTIONS += mfloat-abi=soft
MULTILIB_DIRNAMES += soft
MULTILIB_OPTIONS += mfloat-abi=softfp
MULTILIB_DIRNAMES += softfp
MULTILIB_OPTIONS += mfpu=vfpv3
MULTILIB_DIRNAMES += vfpv3
MULTILIB_OPTIONS += Wa,-mfpu=softvfp
MULTILIB_DIRNAMES += softvfp

MULTILIB_EXCEPTIONS =

MULTILIB_REQUIRED =
marm/march=armv7-a/mtune=cortex-a9/mfloat-abi=softfp/mfpu=vfpv3
MULTILIB_OSDIRNAMES =
marm/march.armv7-a/mtune.cortex-a9/mfloat-abi.softfp/mfpu.vfpv3=!armv7a-linux-gnueabi

MULTILIB_REQUIRED +=
marm/march=armv6k/mtune=arm1136j-s/mfloat-abi=soft/Wa,-mfpu=softvfp
MULTILIB_OSDIRNAMES +=
marm/march.armv6k/mtune.arm1136j-s/mfloat-abi.soft/Wa,-mfpu.softvfp=!armv6k-linux-gnueabi

On Wed, Apr 9, 2014 at 5:29 PM, Zhenqiang Chen
<email address hidden> wrote:
> I do not think it is a libgcc bug. If your multilib option is correct,
> libgcc should find the correct path.
>
> Can you show me the multilib options?
>
> ./gcc/xgcc --print-multi-lib
>
> And all your libc layout in your install dir?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1304267
>
> Title:
> Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when
> building .S file with -mfloat-abi=soft
>
> Status in Linaro GCC:
> Invalid
>
> Bug description:
> I have a ASM file with extension .S
> After I build this file with option
> "-marm -march=armv4t -mfloat-abi=soft -c xxx.S -o xxx.o"
> I checked xxx.o with command "arm-linux-gnueabihf-readelf -A xxx.o"
>
> And the output is
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "4t"
> Tag_CPU_arch: v4T
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-1
> Tag_FP_arch: VFPv3-D16
>
> I noticed tag " Tag_FP_arch: VFPv3-D16", this tag prevents this xxx.o
> from linking with other .o files.
>
> However, when building .c or .cpp...

Read more...

Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

Please try to remove " -Wa,-mfpu=softvfp".

Revision history for this message
changyp (changyp6) wrote :

Hi Zhengqiang,

Thanks for your reply!

I removed "-Wa,-mfpu=softvfp", but result is the same.
But, if I also remove "-mfpu=vfpv3", xgcc -print-multi-directory can
work correctly, both armv6k-linux-gnueabi and armv7a-linux-gnueabi can
be printed.

Are there any constrains on MULTILIB_OPTIONS ? Or is this a bug
related to gcc multilib option parsing?

On Fri, Apr 11, 2014 at 9:21 AM, Zhenqiang Chen
<email address hidden> wrote:
> Please try to remove " -Wa,-mfpu=softvfp".
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1304267
>
> Title:
> Linaro arm linux gnueabihf gcc always add Tag_FP_arch: VFPv3-D16 when
> building .S file with -mfloat-abi=soft
>
> Status in Linaro GCC:
> Invalid
>
> Bug description:
> I have a ASM file with extension .S
> After I build this file with option
> "-marm -march=armv4t -mfloat-abi=soft -c xxx.S -o xxx.o"
> I checked xxx.o with command "arm-linux-gnueabihf-readelf -A xxx.o"
>
> And the output is
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "4t"
> Tag_CPU_arch: v4T
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-1
> Tag_FP_arch: VFPv3-D16
>
> I noticed tag " Tag_FP_arch: VFPv3-D16", this tag prevents this xxx.o
> from linking with other .o files.
>
> However, when building .c or .cpp files, the generated .o files don't
> have " Tag_FP_arch: VFPv3-D16"
>
> It seems that AS doen't respect option "-mfloat-abi=soft" and always
> add "Tag_FP_arch: VFPv3-D16" to the genrated .o files
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-linaro/+bug/1304267/+subscriptions

Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

On 11 April 2014 16:25, changyp <email address hidden> wrote:
> Hi Zhengqiang,
>
> Thanks for your reply!
>
> I removed "-Wa,-mfpu=softvfp", but result is the same.
> But, if I also remove "-mfpu=vfpv3", xgcc -print-multi-directory can
> work correctly, both armv6k-linux-gnueabi and armv7a-linux-gnueabi can
> be printed.
>
> Are there any constrains on MULTILIB_OPTIONS ? Or is this a bug
> related to gcc multilib option parsing?

I do not know. Multilib is always mess. If you think it it a bug,
please reproduce the issue based on a clean gcc trunk and raise to gcc
upstream.

Thanks!
-Zhenqiang

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.