This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compiling libgcc not optimized

Good moorning,

I am trying to compile libgcc for arm-none-eabi target from scratch, since I need to compare Floating Point SW emulation on an ARM Cortex-M4 and Risc-V based processors. The problem is that by default GCC includes the optimized version of FP SW emulation functions which is ieee754-sf.S. 

Does anyone knows how to exclude ieee754-sf.S in the libgcc compilation process? In particular how to configure GCC?

Thanks,

Parents
  • Edit: I had mistakenly built the a-profile toolchain, hence the mix of thumb and arm instructions for armv7e-m. The toolchain (built with the diff below) did work for compiling a small test program for armv7-a, as verified by running a statically built binary with qemu-arm.

    The diff remains as before, and is given below. I will attempt to build an arm-none-eabi with libgcc.a to see if the diff needs any changes.

    diff -ru org/gcc-10.2.0/gcc/config/arm/arm.c gcc-10.2.0/gcc/config/arm/arm.c
    --- org/gcc-10.2.0/gcc/config/arm/arm.c	2020-07-23 12:05:17.344384552 +0530
    +++ gcc-10.2.0/gcc/config/arm/arm.c	2020-11-26 12:50:11.121893412 +0530
    @@ -2531,6 +2531,7 @@
       /* For Linux, we have access to kernel support for atomic operations.  */
       if (arm_abi == ARM_ABI_AAPCS_LINUX)
         init_sync_libfuncs (MAX_SYNC_LIBFUNC_SIZE);
    +  return;
     
       /* There are no special library functions unless we are using the
          ARM BPABI.  */
    diff -ru org/gcc-10.2.0/libgcc/config/arm/sfp-machine.h gcc-10.2.0/libgcc/config/arm/sfp-machine.h
    --- org/gcc-10.2.0/libgcc/config/arm/sfp-machine.h	2020-07-23 12:05:18.752400064 +0530
    +++ gcc-10.2.0/libgcc/config/arm/sfp-machine.h	2020-11-26 13:31:10.565636471 +0530
    @@ -67,7 +67,7 @@
     # define _strong_alias(name, aliasname) \
       extern __typeof (name) aliasname __attribute__ ((alias (#name)));
     
    -#ifdef __ARM_EABI__
    +#if 0
     /* Rename functions to their EABI names.  */
     /* The comparison functions need wrappers for EABI semantics, so
        leave them unmolested.  */
    diff -ru org/gcc-10.2.0/libgcc/config/arm/t-arm gcc-10.2.0/libgcc/config/arm/t-arm
    --- org/gcc-10.2.0/libgcc/config/arm/t-arm	2020-07-23 12:05:18.752400064 +0530
    +++ gcc-10.2.0/libgcc/config/arm/t-arm	2020-11-26 12:18:01.909926794 +0530
    @@ -1,6 +1,7 @@
     LIB1ASMSRC = arm/lib1funcs.S
     LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \
     	_thumb1_case_uhi _thumb1_case_si _speculation_barrier
    +LIB2ADD += $(srcdir)/udivmodsi4.c $(srcdir)/udivmod.c $(srcdir)/divmod.c
     
     HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
     HAVE_V81M:=$(findstring armv8.1-m.main,$(gcc_compile_bare))
    diff -ru org/gcc-10.2.0/libgcc/config/arm/t-softfp gcc-10.2.0/libgcc/config/arm/t-softfp
    --- org/gcc-10.2.0/libgcc/config/arm/t-softfp	2020-07-23 12:05:18.752400064 +0530
    +++ gcc-10.2.0/libgcc/config/arm/t-softfp	2020-11-26 13:28:39.584201073 +0530
    @@ -1,2 +1,3 @@
    -softfp_wrap_start := '\#if !__ARM_ARCH_ISA_ARM && __ARM_ARCH_ISA_THUMB == 1'
    +softfp_wrap_start := '\#if 1'
     softfp_wrap_end := '\#endif'
    +softfp_exclude_libgcc2 := n
    diff -ru org/gcc-10.2.0/libgcc/Makefile.in gcc-10.2.0/libgcc/Makefile.in
    --- org/gcc-10.2.0/libgcc/Makefile.in	2020-07-23 12:05:18.748400018 +0530
    +++ gcc-10.2.0/libgcc/Makefile.in	2020-11-26 13:30:50.989201425 +0530
    @@ -484,14 +484,14 @@
     	$(gcc_compile) -DL$* -xassembler-with-cpp -c $< -include $*.vis
     $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
     	$(gen-hide-list)
    -libgcc-objects += $(lib1asmfuncs-o)
    +#libgcc-objects += $(lib1asmfuncs-o)
     
     lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
     $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
     	$(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
     ifeq ($(enable_shared),yes)
     
    -libgcc-s-objects += $(lib1asmfuncs-s-o)
    +#libgcc-s-objects += $(lib1asmfuncs-s-o)
     
     endif
     
    diff -ru org/gcc-10.2.0/libsanitizer/asan/asan_linux.cpp gcc-10.2.0/libsanitizer/asan/asan_linux.cpp
    --- org/gcc-10.2.0/libsanitizer/asan/asan_linux.cpp	2020-07-23 12:05:19.124404163 +0530
    +++ gcc-10.2.0/libsanitizer/asan/asan_linux.cpp	2020-11-26 07:06:35.712906746 +0530
    @@ -199,7 +199,9 @@
         Die();
       }
     }
    -
    +#ifndef PATH_MAX
    +#define PATH_MAX 1024
    +#endif
     void AsanCheckIncompatibleRT() {
       if (ASAN_DYNAMIC) {
         if (__asan_rt_version == ASAN_RT_VERSION_UNDEFINED) {

Reply
  • Edit: I had mistakenly built the a-profile toolchain, hence the mix of thumb and arm instructions for armv7e-m. The toolchain (built with the diff below) did work for compiling a small test program for armv7-a, as verified by running a statically built binary with qemu-arm.

    The diff remains as before, and is given below. I will attempt to build an arm-none-eabi with libgcc.a to see if the diff needs any changes.

    diff -ru org/gcc-10.2.0/gcc/config/arm/arm.c gcc-10.2.0/gcc/config/arm/arm.c
    --- org/gcc-10.2.0/gcc/config/arm/arm.c	2020-07-23 12:05:17.344384552 +0530
    +++ gcc-10.2.0/gcc/config/arm/arm.c	2020-11-26 12:50:11.121893412 +0530
    @@ -2531,6 +2531,7 @@
       /* For Linux, we have access to kernel support for atomic operations.  */
       if (arm_abi == ARM_ABI_AAPCS_LINUX)
         init_sync_libfuncs (MAX_SYNC_LIBFUNC_SIZE);
    +  return;
     
       /* There are no special library functions unless we are using the
          ARM BPABI.  */
    diff -ru org/gcc-10.2.0/libgcc/config/arm/sfp-machine.h gcc-10.2.0/libgcc/config/arm/sfp-machine.h
    --- org/gcc-10.2.0/libgcc/config/arm/sfp-machine.h	2020-07-23 12:05:18.752400064 +0530
    +++ gcc-10.2.0/libgcc/config/arm/sfp-machine.h	2020-11-26 13:31:10.565636471 +0530
    @@ -67,7 +67,7 @@
     # define _strong_alias(name, aliasname) \
       extern __typeof (name) aliasname __attribute__ ((alias (#name)));
     
    -#ifdef __ARM_EABI__
    +#if 0
     /* Rename functions to their EABI names.  */
     /* The comparison functions need wrappers for EABI semantics, so
        leave them unmolested.  */
    diff -ru org/gcc-10.2.0/libgcc/config/arm/t-arm gcc-10.2.0/libgcc/config/arm/t-arm
    --- org/gcc-10.2.0/libgcc/config/arm/t-arm	2020-07-23 12:05:18.752400064 +0530
    +++ gcc-10.2.0/libgcc/config/arm/t-arm	2020-11-26 12:18:01.909926794 +0530
    @@ -1,6 +1,7 @@
     LIB1ASMSRC = arm/lib1funcs.S
     LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \
     	_thumb1_case_uhi _thumb1_case_si _speculation_barrier
    +LIB2ADD += $(srcdir)/udivmodsi4.c $(srcdir)/udivmod.c $(srcdir)/divmod.c
     
     HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
     HAVE_V81M:=$(findstring armv8.1-m.main,$(gcc_compile_bare))
    diff -ru org/gcc-10.2.0/libgcc/config/arm/t-softfp gcc-10.2.0/libgcc/config/arm/t-softfp
    --- org/gcc-10.2.0/libgcc/config/arm/t-softfp	2020-07-23 12:05:18.752400064 +0530
    +++ gcc-10.2.0/libgcc/config/arm/t-softfp	2020-11-26 13:28:39.584201073 +0530
    @@ -1,2 +1,3 @@
    -softfp_wrap_start := '\#if !__ARM_ARCH_ISA_ARM && __ARM_ARCH_ISA_THUMB == 1'
    +softfp_wrap_start := '\#if 1'
     softfp_wrap_end := '\#endif'
    +softfp_exclude_libgcc2 := n
    diff -ru org/gcc-10.2.0/libgcc/Makefile.in gcc-10.2.0/libgcc/Makefile.in
    --- org/gcc-10.2.0/libgcc/Makefile.in	2020-07-23 12:05:18.748400018 +0530
    +++ gcc-10.2.0/libgcc/Makefile.in	2020-11-26 13:30:50.989201425 +0530
    @@ -484,14 +484,14 @@
     	$(gcc_compile) -DL$* -xassembler-with-cpp -c $< -include $*.vis
     $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
     	$(gen-hide-list)
    -libgcc-objects += $(lib1asmfuncs-o)
    +#libgcc-objects += $(lib1asmfuncs-o)
     
     lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
     $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
     	$(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
     ifeq ($(enable_shared),yes)
     
    -libgcc-s-objects += $(lib1asmfuncs-s-o)
    +#libgcc-s-objects += $(lib1asmfuncs-s-o)
     
     endif
     
    diff -ru org/gcc-10.2.0/libsanitizer/asan/asan_linux.cpp gcc-10.2.0/libsanitizer/asan/asan_linux.cpp
    --- org/gcc-10.2.0/libsanitizer/asan/asan_linux.cpp	2020-07-23 12:05:19.124404163 +0530
    +++ gcc-10.2.0/libsanitizer/asan/asan_linux.cpp	2020-11-26 07:06:35.712906746 +0530
    @@ -199,7 +199,9 @@
         Die();
       }
     }
    -
    +#ifndef PATH_MAX
    +#define PATH_MAX 1024
    +#endif
     void AsanCheckIncompatibleRT() {
       if (ASAN_DYNAMIC) {
         if (__asan_rt_version == ASAN_RT_VERSION_UNDEFINED) {

Children
No data