1 ################################################################################
5 ################################################################################
7 # Version is set when using buildroot toolchain.
8 # If not, we do like other packages
9 BINUTILS_VERSION
= $(call qstrip
,$(BR2_BINUTILS_VERSION
))
10 ifeq ($(BINUTILS_VERSION
),)
12 BINUTILS_VERSION
= arc-2016.09
-release
14 BINUTILS_VERSION
= 2.25.1
16 endif # BINUTILS_VERSION
19 BINUTILS_SITE
= $(call github
,foss-for-synopsys-dwc-arc-processors
,binutils-gdb
,$(BINUTILS_VERSION
))
20 BINUTILS_SOURCE
= binutils-
$(BINUTILS_VERSION
).
tar.gz
23 BINUTILS_SITE ?
= $(BR2_GNU_MIRROR
)/binutils
24 BINUTILS_SOURCE ?
= binutils-
$(BINUTILS_VERSION
).
tar.bz2
25 BINUTILS_EXTRA_CONFIG_OPTIONS
= $(call qstrip
,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS
))
26 BINUTILS_INSTALL_STAGING
= YES
27 BINUTILS_DEPENDENCIES
= $(if
$(BR2_NEEDS_GETTEXT_IF_LOCALE
),gettext
)
28 BINUTILS_LICENSE
= GPLv3
+, libiberty LGPLv2.1
+
29 BINUTILS_LICENSE_FILES
= COPYING3 COPYING.LIB
31 ifeq ($(BINUTILS_FROM_GIT
),y
)
32 BINUTILS_DEPENDENCIES
+= host-flex host-bison
33 HOST_BINUTILS_DEPENDENCIES
+= host-flex host-bison
36 # When binutils sources are fetched from the binutils-gdb repository,
37 # they also contain the gdb sources, but gdb shouldn't be built, so we
39 BINUTILS_DISABLE_GDB_CONF_OPTS
= \
43 # We need to specify host & target to avoid breaking ARM EABI
44 BINUTILS_CONF_OPTS
= \
47 --host
=$(GNU_TARGET_NAME
) \
48 --target
=$(GNU_TARGET_NAME
) \
49 --enable-install-libiberty \
50 --enable-build-warnings
=no \
51 $(BINUTILS_DISABLE_GDB_CONF_OPTS
) \
52 $(BINUTILS_EXTRA_CONFIG_OPTIONS
)
54 ifeq ($(BR2_STATIC_LIBS
),y
)
55 BINUTILS_CONF_OPTS
+= --disable-plugins
58 # Don't build documentation. It takes up extra space / build time,
59 # and sometimes needs specific makeinfo versions to work
60 BINUTILS_CONF_ENV
+= MAKEINFO
=true
61 BINUTILS_MAKE_OPTS
+= MAKEINFO
=true
62 BINUTILS_INSTALL_TARGET_OPTS
= DESTDIR
=$(TARGET_DIR
) MAKEINFO
=true
install
63 HOST_BINUTILS_CONF_ENV
+= MAKEINFO
=true
64 HOST_BINUTILS_MAKE_OPTS
+= MAKEINFO
=true
65 HOST_BINUTILS_INSTALL_OPTS
+= MAKEINFO
=true
install
67 # gcc bug with Os/O2/O3, PR77311
68 # error: unable to find a register to spill in class 'CCREGS'
70 BINUTILS_CONF_ENV
+= CFLAGS
="$(TARGET_CFLAGS) -O1"
73 # Workaround a build issue with -Os for ARM Cortex-M cpus.
74 # (Binutils 2.25.1 and 2.26.1)
75 # https://sourceware.org/bugzilla/show_bug.cgi?id=20552
76 ifeq ($(BR2_ARM_CPU_ARMV7M
)$(BR2_OPTIMIZE_S
),yy
)
77 BINUTILS_CONF_ENV
+= CFLAGS
="$(TARGET_CFLAGS) -O2"
80 # Install binutils after busybox to prefer full-blown utilities
81 ifeq ($(BR2_PACKAGE_BUSYBOX
),y
)
82 BINUTILS_DEPENDENCIES
+= busybox
85 ifeq ($(BR2_PACKAGE_ZLIB
),y
)
86 BINUTILS_DEPENDENCIES
+= zlib
89 # "host" binutils should actually be "cross"
90 # We just keep the convention of "host utility" for now
91 HOST_BINUTILS_CONF_OPTS
= \
94 --target
=$(GNU_TARGET_NAME
) \
97 --with-sysroot
=$(STAGING_DIR
) \
98 --enable-poison-system-directories \
99 $(BINUTILS_DISABLE_GDB_CONF_OPTS
) \
100 $(BINUTILS_EXTRA_CONFIG_OPTIONS
)
102 # binutils run configure script of subdirs at make time, so ensure
103 # our TARGET_CONFIGURE_ARGS are taken into consideration for those
104 define BINUTILS_BUILD_CMDS
105 $(TARGET_MAKE_ENV
) $(TARGET_CONFIGURE_ARGS
) $(MAKE
) $(BINUTILS_MAKE_OPTS
) -C
$(@D
)
108 # We just want libbfd, libiberty and libopcodes,
109 # not the full-blown binutils in staging
110 define BINUTILS_INSTALL_STAGING_CMDS
111 $(TARGET_MAKE_ENV
) $(MAKE
) -C
$(@D
)/bfd DESTDIR
=$(STAGING_DIR
) install
112 $(TARGET_MAKE_ENV
) $(MAKE
) -C
$(@D
)/opcodes DESTDIR
=$(STAGING_DIR
) install
113 $(TARGET_MAKE_ENV
) $(MAKE
) -C
$(@D
)/libiberty DESTDIR
=$(STAGING_DIR
) install
116 # If we don't want full binutils on target
117 ifneq ($(BR2_PACKAGE_BINUTILS_TARGET
),y
)
118 define BINUTILS_INSTALL_TARGET_CMDS
119 $(TARGET_MAKE_ENV
) $(MAKE
) -C
$(@D
)/bfd DESTDIR
=$(TARGET_DIR
) install
120 $(TARGET_MAKE_ENV
) $(MAKE
) -C
$(@D
)/libiberty DESTDIR
=$(STAGING_DIR
) install
124 XTENSA_CORE_NAME
= $(call qstrip
, $(BR2_XTENSA_CORE_NAME
))
125 ifneq ($(XTENSA_CORE_NAME
),)
126 define BINUTILS_XTENSA_PRE_PATCH
127 tar xf
$(BR2_XTENSA_OVERLAY_DIR
)/xtensa_
$(XTENSA_CORE_NAME
).
tar \
128 -C
$(@D
) --strip-components
=1 binutils
130 BINUTILS_PRE_PATCH_HOOKS
+= BINUTILS_XTENSA_PRE_PATCH
131 HOST_BINUTILS_PRE_PATCH_HOOKS
+= BINUTILS_XTENSA_PRE_PATCH
134 ifeq ($(BR2_BINUTILS_ENABLE_LTO
),y
)
135 HOST_BINUTILS_CONF_OPTS
+= --enable-plugins
--enable-lto
138 $(eval
$(autotools-package
))
139 $(eval
$(host-autotools-package
))