Pārlūkot izejas kodu

toolchain/gcc: add openmp support option

Add OpenMP support in gcc as an option instead of dynamically enabling
it when threads are present.
Also fix it up since we never installed libgomp to the target or staging
thus it was never really functional.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Gustavo Zacarias 14 gadi atpakaļ
vecāks
revīzija
0073143087
2 mainītis faili ar 22 papildinājumiem un 1 dzēšanām
  1. 6 0
      toolchain/gcc/Config.in
  2. 16 1
      toolchain/gcc/gcc-uclibc-4.x.mk

+ 6 - 0
toolchain/gcc/Config.in

@@ -109,3 +109,9 @@ config BR2_GCC_ENABLE_TLS
 	help
 	help
 	  Enable the compiler to generate code for accessing
 	  Enable the compiler to generate code for accessing
 	  thread local storage variables
 	  thread local storage variables
+
+config BR2_GCC_ENABLE_OPENMP
+	bool "Enable compiler OpenMP support"
+	depends on !BR2_PTHREADS_NONE && !BR2_avr32
+	help
+	  Enable OpenMP support for the compiler

+ 16 - 1
toolchain/gcc/gcc-uclibc-4.x.mk

@@ -147,6 +147,12 @@ else
 GCC_SHARED_LIBGCC:=--disable-shared
 GCC_SHARED_LIBGCC:=--disable-shared
 endif
 endif
 
 
+ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
+GCC_ENABLE_OPENMP:=--enable-libgomp
+else
+GCC_ENABLE_OPENMP:=--disable-libgomp
+endif
+
 ifeq ($(BR2_GCC_ENABLE_TLS),y)
 ifeq ($(BR2_GCC_ENABLE_TLS),y)
 GCC_TLS:=--enable-tls
 GCC_TLS:=--enable-tls
 else
 else
@@ -154,7 +160,7 @@ GCC_TLS:=--disable-tls
 endif
 endif
 
 
 ifeq ($(BR2_PTHREADS_NONE),y)
 ifeq ($(BR2_PTHREADS_NONE),y)
-THREADS:=--disable-threads --disable-libgomp
+THREADS:=--disable-threads
 else
 else
 THREADS:=--enable-threads
 THREADS:=--enable-threads
 endif
 endif
@@ -234,6 +240,7 @@ $(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
 		--disable-__cxa_atexit \
 		--disable-__cxa_atexit \
 		$(GCC_OPTSPACE) \
 		$(GCC_OPTSPACE) \
 		$(GCC_QUADMATH) \
 		$(GCC_QUADMATH) \
+		$(GCC_ENABLE_OPENMP) \
 		--with-gnu-ld \
 		--with-gnu-ld \
 		--disable-shared \
 		--disable-shared \
 		--disable-libssp \
 		--disable-libssp \
@@ -301,6 +308,7 @@ $(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched
 		--disable-__cxa_atexit \
 		--disable-__cxa_atexit \
 		$(GCC_OPTSPACE) \
 		$(GCC_OPTSPACE) \
 		$(GCC_QUADMATH) \
 		$(GCC_QUADMATH) \
+		$(GCC_ENABLE_OPENMP) \
 		--with-gnu-ld \
 		--with-gnu-ld \
 		--enable-shared \
 		--enable-shared \
 		--disable-libssp \
 		--disable-libssp \
@@ -379,6 +387,7 @@ $(GCC_BUILD_DIR3)/.configured: $(GCC_SRC_DIR)/.patched $(GCC_STAGING_PREREQ)
 		--disable-__cxa_atexit \
 		--disable-__cxa_atexit \
 		$(GCC_OPTSPACE) \
 		$(GCC_OPTSPACE) \
 		$(GCC_QUADMATH) \
 		$(GCC_QUADMATH) \
+		$(GCC_ENABLE_OPENMP) \
 		--with-gnu-ld \
 		--with-gnu-ld \
 		--disable-libssp \
 		--disable-libssp \
 		--disable-multilib \
 		--disable-multilib \
@@ -469,6 +478,11 @@ ifeq ($(BR2_INSTALL_LIBGCJ),y)
 	cp -dpf $(HOST_DIR)/usr/lib/security/classpath.security \
 	cp -dpf $(HOST_DIR)/usr/lib/security/classpath.security \
 		$(TARGET_DIR)/usr/lib/security/
 		$(TARGET_DIR)/usr/lib/security/
 	-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libgcj.so*
 	-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libgcj.so*
+endif
+ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
+	cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgomp.so* $(STAGING_DIR)/usr/lib/
+	cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgomp.so* $(TARGET_DIR)/usr/lib/
+	-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libgomp.so*
 endif
 endif
 	mkdir -p $(@D)
 	mkdir -p $(@D)
 	touch $@
 	touch $@
@@ -523,6 +537,7 @@ $(GCC_BUILD_DIR4)/.configured: $(GCC_BUILD_DIR4)/.prepared
 		--disable-__cxa_atexit \
 		--disable-__cxa_atexit \
 		$(GCC_OPTSPACE) \
 		$(GCC_OPTSPACE) \
 		$(GCC_QUADMATH) \
 		$(GCC_QUADMATH) \
+		$(GCC_ENABLE_OPENMP) \
 		--with-gnu-ld \
 		--with-gnu-ld \
 		--disable-libssp \
 		--disable-libssp \
 		--disable-multilib \
 		--disable-multilib \