Summary: | ffs builtin calls undefined __ffshi2 | ||
---|---|---|---|
Product: | gcc | Reporter: | Shaun Jackman <sjackman> |
Component: | target | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dmixm, eric.weddington, gcc-bugs, hutchinsonandy, pmarques, sjackman |
Priority: | P3 | ||
Version: | 4.3.0 | ||
Target Milestone: | --- | ||
Host: | Target: | avr | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2007-11-23 22:39:04 |
Description
Shaun Jackman
2007-11-23 19:38:21 UTC
It's worth noting that __ffsi2 generates terrible code on the AVR: a 194 byte function. avr-libc also provides ffs (16-bit, not 32-bit as in __ffssi2) which is written in assembler and 24 bytes long. As a workaround, you can force the use of avr-libc's ffs by providing the -fno-builtin-ffs. Cheers, Shaun Confirmed. libgcc2.c doesn't have a ffs implementation for targets with 2 byte integers. You want something like this in libgcc/config/avr/t-avr to get the 16-bit versions: # Extra 16-bit integer functions. intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _ffsXX2 _clzXX2 \ _ctzXX2 _popcountXX2 hiintfuncs16 = $(subst XX,hi,$(intfuncs16)) siintfuncs16 = $(subst XX,si,$(intfuncs16)) iter-items := $(hiintfuncs16) iter-labels := $(siintfuncs16) iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16)) include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items)) libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16)) ifeq ($(enable_shared),yes) libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16)) endif gcc.c-torture/execute/ffs-1.c and gcc.c-torture/execute/ffs-2.c also fail with this message. The test case gcc.c-torture/execute/builtin-bitops-1.c shows some more similar errors: builtin-bitops-1.c:(.text+0x6b4): undefined reference to `__popcounthi2' builtin-bitops-1.c:(.text+0x6ee): undefined reference to `__parityhi2' builtin-bitops-1.c:(.text+0x183e): undefined reference to `__clzhi2' I tried to add the suggested libgcc/config/avr/t-avr. It didn't work, and I don't know enough of gcc internals to understand what is going on. Patch posted: http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01341.html *** Bug 35508 has been marked as a duplicate of this bug. *** Subject: Bug 34210 Author: hutchinsonandy Date: Mon Apr 7 23:15:35 2008 New Revision: 133993 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133993 Log: PR target/34210 PR target/35508 * config.host (avr-*-*): Add avr cpu_type and avr tmake_file. * config/t-avr: New file. Build 16bit libgcc functions. Added: trunk/libgcc/config/avr/ trunk/libgcc/config/avr/t-avr Modified: trunk/libgcc/ChangeLog trunk/libgcc/config.host Commit from Andy fixes the bug. *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla. |