Bug 63929 - GCC sets soft-float ABI even is specified -mfloat-abi=hard when compiling an assembler file.
Summary: GCC sets soft-float ABI even is specified -mfloat-abi=hard when compiling an ...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.8.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-18 10:29 UTC by Natalia
Modified: 2014-11-21 18:03 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Natalia 2014-11-18 10:29:19 UTC
I have a simple source : 
---- test.s ----------------------
	.syntax unified
	.arch armv7-a
	.fpu vfpv3-d16
	.thumb
	.file	"test.c"
	.global	a
	.data
	.align	2
	.type	a, %object
	.size	a, 4
a:
	.word	2330
	.section	.note.GNU-stack,"",%progbits
-----------------------------------

Compile it:

gcc -D_REENTRANT -DU_ATTRIBUTE_DEPRECATED= -O2 -g -march=armv7-a -mfloat-abi=hard -mthumb -mabi=aapcs-linux -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long  -c -DPIC -fPIC -o test.o test.s

gcc -O2 -g -march=armv7-a -mfloat-abi=hard -mthumb -mabi=aapcs-linux -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -shared -Wl,-Bsymbolic -nodefaultlibs -nostdlib -o test.so test.o   -Wl,-Bsymbolic


So Flags is rewrited to 'soft-float':

readelf -a test.so |grep Flags
  Flags:                             0x5000200, Version5 EABI, soft-float ABI
Key to Flags:


If specify explicitly .eabi_attribute here:
------ test1.s -------------------
	.syntax unified
	.arch armv7-a
	.eabi_attribute 28, 1
	.fpu vfpv3-d16
	.thumb
	.file	"test.c"
	.global	a
	.data
	.align	2
	.type	a, %object
	.size	a, 4
a:
	.word	2330
	.section	.note.GNU-stack,"",%progbits
----------------------------------------------

it will work correctly now:

readelf -a test1.so |grep Flags
  Flags:                             0x5000400, Version5 EABI, hard-float ABI
Key to Flags:
Comment 1 Richard Earnshaw 2014-11-21 18:03:09 UTC
This is nothing to do with the compiler.  Attributes are derived from annotations in the assembly file (GCC generates assembly code when compiling C/C++/Fortran, etc and puts the relevant annotations in for you, but can't do that for assembler source).

If you write assembly code, you'll have to manually attribute your source code.