Patchwork [7/7] arc: Make sure that libgcc doesn't get included when it doesn't exist yet

login
register
mail settings
Submitter Mischa Jonker
Date April 22, 2013, 11:37 a.m.
Message ID <1366630651-6857-8-git-send-email-mjonker@synopsys.com>
Download mbox | patch
Permalink /patch/238479/
State Changes Requested
Headers show

Comments

Mischa Jonker - April 22, 2013, 11:37 a.m.
For ARC, libgcc is always included, even when -nostdlib is given. This is
related to some small pieces of code that are not always generated by the
compiler; a call to libgcc is used in those cases instead.

During the initial stages of building the toolchain, this is a problem, as
libgcc does not exist yet. The ARC compiler supports -really-nostdlib to
override the default behavior.

Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
---
 toolchain/uClibc/uclibc.mk |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
Thomas Petazzoni - April 22, 2013, 3:57 p.m.
Dear Mischa Jonker,

On Mon, 22 Apr 2013 13:37:31 +0200, Mischa Jonker wrote:
> For ARC, libgcc is always included, even when -nostdlib is given. This is
> related to some small pieces of code that are not always generated by the
> compiler; a call to libgcc is used in those cases instead.
> 
> During the initial stages of building the toolchain, this is a problem, as
> libgcc does not exist yet. The ARC compiler supports -really-nostdlib to
> override the default behavior.
> 
> Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
> ---
>  toolchain/uClibc/uclibc.mk |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk
> index 1629e76..14083a9 100644
> --- a/toolchain/uClibc/uclibc.mk
> +++ b/toolchain/uClibc/uclibc.mk
> @@ -404,6 +404,12 @@ ifeq ($(BR2_CCACHE),y)
>  $(UCLIBC_DIR)/.config: | host-ccache
>  endif
>  
> +ifeq ($(BR2_arc)$(BR2_arceb),)
> +REALLY_NOSTDLIB=
> +else
> +REALLY_NOSTDLIB=-really-nostdlib
> +endif

Could you copy/paste parts of your commit log as a comment above this
piece of code? This would make it easier to understand. Also, you could
write it this way:

ifeq ($(BR2_arc)$(BR2_arceb),y)
REALLY_NOSTDLIB=-really-nostdlib
endif

Thomas

Patch

diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk
index 1629e76..14083a9 100644
--- a/toolchain/uClibc/uclibc.mk
+++ b/toolchain/uClibc/uclibc.mk
@@ -404,6 +404,12 @@  ifeq ($(BR2_CCACHE),y)
 $(UCLIBC_DIR)/.config: | host-ccache
 endif
 
+ifeq ($(BR2_arc)$(BR2_arceb),)
+REALLY_NOSTDLIB=
+else
+REALLY_NOSTDLIB=-really-nostdlib
+endif
+
 $(UCLIBC_DIR)/.configured: $(LINUX_HEADERS_DIR)/.configured $(UCLIBC_DIR)/.config
 	$(Q)$(call MESSAGE,"Installing uClibc headers")
 	$(MAKE1) -C $(UCLIBC_DIR) \
@@ -422,8 +428,8 @@  $(UCLIBC_DIR)/.configured: $(LINUX_HEADERS_DIR)/.configured $(UCLIBC_DIR)/.confi
 		cp -pLR $(LINUX_HEADERS_DIR)/include/* \
 			$(TOOLCHAIN_DIR)/uClibc_dev/usr/include/; \
 	fi
-	$(TARGET_CROSS)gcc -nostdlib -nostartfiles -shared -x c /dev/null -o $(TOOLCHAIN_DIR)/uClibc_dev/usr/lib/libc.so
-	$(TARGET_CROSS)gcc -nostdlib -nostartfiles -shared -x c /dev/null -o $(TOOLCHAIN_DIR)/uClibc_dev/usr/lib/libm.so
+	$(TARGET_CROSS)gcc -nostdlib $(REALLY_NOSTDLIB) -nostartfiles -shared -x c /dev/null -o $(TOOLCHAIN_DIR)/uClibc_dev/usr/lib/libc.so
+	$(TARGET_CROSS)gcc -nostdlib $(REALLY_NOSTDLIB) -nostartfiles -shared -x c /dev/null -o $(TOOLCHAIN_DIR)/uClibc_dev/usr/lib/libm.so
 	cp -pLR $(UCLIBC_DIR)/lib/crt[1in].o $(TOOLCHAIN_DIR)/uClibc_dev/usr/lib/
 	touch $@