On Tue, May 10, 2011, Pierre Habouzit wrote:
> What should be done for that, s/arm/armel/ and add -marmv7a to the
> CFLAGS at configure time, that's it?

 Yup; ideally, you would test whether the toolchain config supports
 ARMv7, and if it doesn't you add -march=armv7-a to the CFLAGS.  This
 means that no flags is added to e.g. Debian armhf or to Ubuntu's armel
 or any Debian derivative which already turns on armv7-a (or higher).

 Something like this rules snippet would work I guess:

CROSS :=
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
    CROSS :=  $(DEB_HOST_GNU_TYPE)-
endif

# this outputs 0 or 1 depending on whether a piece of assembly can be compiled
# with the *default* gcc flags; this is used to test the toolchain *default*
# configuration
check_asm = $(shell echo 'void foo(void) { __asm__ volatile("$(1)"); }' | 
$(CROSS)gcc -x c -c - -o /dev/null 2>/dev/null && echo 1 || echo 0)

ifeq ($(DEB_HOST_ARCH_CPU),arm)
    # whether the toolchain *default* configuration enables ARMv7
    v7_asm := dmb
    has_v7 := $(call check_asm, $(v7_asm))

ifneq ($(has_v7),1)
    CFLAGS += -march=armv7-a
endif
endif

> I'm mostly clueless about which arm CPU versions Debian is supposed to
> support, should I wrap valgrind in some shell script that checks if the
> CPU is recent enough to run valgrind and fail gracefully if not? and if
> thats a good idea, how can I know which arm version the CPU supports?

 That's a good idea idea; you could catch SIGILL or you could look at
 /proc/cpuid or cpuinfo.  This might also be known to eglibc, but I
 don't know whether you can get this information via some API.  I am not
 sure you can rely on uname -m.  Would someone have precise information
 for this?

-- 
Loïc Minier



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to