User account creation filtered due to spam.

Bug 54461 - [avr] add configure option for better AVR-Libc integration
Summary: [avr] add configure option for better AVR-Libc integration
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.1
: P4 enhancement
Target Milestone: 4.7.2
Assignee: Georg-Johann Lay
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2012-09-02 19:32 UTC by Georg-Johann Lay
Modified: 2013-01-07 16:23 UTC (History)
2 users (show)

See Also:
Host:
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-09-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2012-09-02 19:32:21 UTC
For historical reasons, AVR-Libc implements functions that GCC expects to live in libgcc, namely float functions like __fixsfsi.

Currently, avr-gcc is not configurable to accommodate that situation which leads to performance loss if the float support functions from libgcc are used.

This happens at least in the following situations:

* The user does not specify -lm.  -lm should only be needed
  if function from math.h are used, not for language core
  features like int i = (int) float.

* The application is LTO compiled, i.e. linked with -flto.
  The plugin machinery passes lgcc -lc lgcc through to the
  linker by means of -plugin-opt=-pass-through=-lgcc etc.
  so that -lgcc is linked prior to -lm.

* The user uses fixed <-> float conversion routines from
  libgcc.  These routines refer float functions, and the linker
  resolves these function in libgcc if they are there.

* avr-g++ is used as linker driver.

See also PR28718 and
http://lists.gnu.org/archive/html/avr-gcc-list/2012-08/msg00070.html
Comment 1 Georg-Johann Lay 2012-09-05 08:48:00 UTC
Author: gjl
Date: Wed Sep  5 08:47:50 2012
New Revision: 190967

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190967
Log:
	PR target/54461
	* configure.ac (noconfigdirs,target=avr-*-*): Add target-newlib,
	target-libgloss if not configured --with-avrlibc=no.
	* configure: Regenerate.

libgcc/
	PR target/54461
	* config.host (tmake_file,host=avr-*-*): Add avr/t-avrlibc if
	not configured --with-avrlibc=no.
	* config/avr/t-avrlibc: New file.
	* Makefile.in (FPBIT_FUNCS): filter-out LIB2FUNCS_EXCLUDE.
	(DPBIT_FUNCS): Ditto.
	(TPBIT_FUNCS): Ditto.

gcc/
	PR target/54461
	* config.gcc (tm_file,target=avr-*-*): Add avr/avrlibc.h if
	not configured --with-avrlibc=no.
	(tm_defines,target=avr-*-*): Add WITH_AVRLIBC if not configured
	--with-avrlibc=no.
	* config/avr/avrlibc.h: New file.
	* config/avr/avr-c.c: Build-in define __WITH_AVRLIBC__ if
	not configured --with-avrlibc=no.
	* doc/invoke.texi (AVR Built-in Macros): Document __WITH_AVRLIBC__


Added:
    trunk/gcc/config/avr/avrlibc.h
    trunk/libgcc/config/avr/t-avrlibc
Modified:
    trunk/ChangeLog
    trunk/configure
    trunk/configure.ac
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc
    trunk/gcc/config/avr/avr-c.c
    trunk/gcc/doc/invoke.texi
    trunk/libgcc/ChangeLog
    trunk/libgcc/Makefile.in
    trunk/libgcc/config.host
Comment 2 Georg-Johann Lay 2012-09-05 12:19:54 UTC
Author: gjl
Date: Wed Sep  5 12:19:47 2012
New Revision: 190973

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190973
Log:
	Backport from 2012-09-05 mainline r190697.

	PR target/54461
	* configure.ac (noconfigdirs,target=avr-*-*): Add target-newlib,
	target-libgloss if configured --with-avrlibc.
	* configure: Regenerate.

libgcc/
	Backport from 2012-09-05 mainline r190697.

	PR target/54461
	* config.host (tmake_file,host=avr-*-*): Add avr/t-avrlibc if
	configured --with-avrlibc.
	* Makefile.in (FPBIT_FUNCS): filter-out LIB2FUNCS_EXCLUDE.
	(DPBIT_FUNCS): Ditto.
	(TPBIT_FUNCS): Ditto.
	* config/avr/t-avrlibc: New file.

gcc/
	Backport from 2012-09-05 mainline r190697.

	PR target/54461
	* config.gcc (tm_file,target=avr-*-*): Add avr/avrlibc.h if
	configured --with-avrlibc.
	(tm_defines,target=avr-*-*): Add WITH_AVRLIBC if configured
	--with-avrlibc.
	* config/avr/avrlibc.h: New file.
	* config/avr/avr-c.c: Build-in define __WITH_AVRLIBC__ if
	configured --with-avrlibc.
	* doc/invoke.texi (AVR Built-in Macros): Document __WITH_AVRLIBC__


Added:
    branches/gcc-4_7-branch/gcc/config/avr/avrlibc.h
    branches/gcc-4_7-branch/libgcc/config/avr/t-avrlibc
Modified:
    branches/gcc-4_7-branch/ChangeLog
    branches/gcc-4_7-branch/configure
    branches/gcc-4_7-branch/configure.ac
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config.gcc
    branches/gcc-4_7-branch/gcc/config/avr/avr-c.c
    branches/gcc-4_7-branch/gcc/doc/invoke.texi
    branches/gcc-4_7-branch/libgcc/ChangeLog
    branches/gcc-4_7-branch/libgcc/Makefile.in
    branches/gcc-4_7-branch/libgcc/config.host
Comment 3 Georg-Johann Lay 2012-09-05 12:23:00 UTC
Fixed in 4.7.2
Comment 4 Georg-Johann Lay 2012-09-05 13:02:24 UTC
*** Bug 28718 has been marked as a duplicate of this bug. ***
Comment 5 Georg-Johann Lay 2013-01-07 16:23:13 UTC
Author: gjl
Date: Mon Jan  7 16:22:59 2013
New Revision: 194981

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194981
Log:
	Backport from 2013-01-07 trunk r194978.
	PR target/54461
	* doc/install.texi (Cross-Compiler-Specific Options): Document
	--with-avrlibc.


Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/doc/install.texi