* [Buildroot] [PATCH v2 1/3] uclibc: add missing .literal_position directives
2014-03-30 16:55 [Buildroot] [PATCH v2 0/3] xtensa: add -mtext-section-literals to xtensa ABI Max Filippov
@ 2014-03-30 16:55 ` Max Filippov
2014-03-30 16:55 ` [Buildroot] [PATCH v2 2/3] Makefile.in: add -mtext-section-literals to xtensa ABI Max Filippov
2014-03-30 16:55 ` [Buildroot] [PATCH v2 3/3] xtensa: remove -mtext-section-literals from individual package *.mk's Max Filippov
2 siblings, 0 replies; 5+ messages in thread
From: Max Filippov @ 2014-03-30 16:55 UTC (permalink / raw)
To: buildroot
This allows building uclibc with -mtext-section-literals flag.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
...-add-missing-.literal_position-directives.patch | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 package/uclibc/7bf35c8b7d4a1f97174eb49f47f33946b282114c/uclibc-0001-xtensa-add-missing-.literal_position-directives.patch
diff --git a/package/uclibc/7bf35c8b7d4a1f97174eb49f47f33946b282114c/uclibc-0001-xtensa-add-missing-.literal_position-directives.patch b/package/uclibc/7bf35c8b7d4a1f97174eb49f47f33946b282114c/uclibc-0001-xtensa-add-missing-.literal_position-directives.patch
new file mode 100644
index 0000000..f5577c6
--- /dev/null
+++ b/package/uclibc/7bf35c8b7d4a1f97174eb49f47f33946b282114c/uclibc-0001-xtensa-add-missing-.literal_position-directives.patch
@@ -0,0 +1,62 @@
+From 04d7bd868b300c8150231d7a37e62150eaf810d0 Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Mon, 24 Mar 2014 01:06:35 +0400
+Subject: [PATCH] xtensa: add missing .literal_position directives
+
+This addition allows building uClibc with -mtext-section-literals
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+ ldso/ldso/xtensa/dl-startup.h | 1 +
+ ldso/ldso/xtensa/resolve.S | 1 +
+ libc/string/xtensa/strcmp.S | 5 +++--
+ 3 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/ldso/ldso/xtensa/dl-startup.h b/ldso/ldso/xtensa/dl-startup.h
+index 45af82d..b135a4c 100644
+--- a/ldso/ldso/xtensa/dl-startup.h
++++ b/ldso/ldso/xtensa/dl-startup.h
+@@ -11,6 +11,7 @@
+ __asm__ (
+ " .text\n"
+ " .align 4\n"
++ " .literal_position\n"
+ " .global _start\n"
+ " .type _start, @function\n"
+ " .hidden _start\n"
+diff --git a/ldso/ldso/xtensa/resolve.S b/ldso/ldso/xtensa/resolve.S
+index 61c2c5d..d1ae8aa 100644
+--- a/ldso/ldso/xtensa/resolve.S
++++ b/ldso/ldso/xtensa/resolve.S
+@@ -27,6 +27,7 @@
+
+ .text
+ .align 4
++ .literal_position
+ .global _dl_linux_resolve
+ .type _dl_linux_resolve, @function
+ _dl_linux_resolve:
+diff --git a/libc/string/xtensa/strcmp.S b/libc/string/xtensa/strcmp.S
+index d3d72e0..8ed1ed0 100644
+--- a/libc/string/xtensa/strcmp.S
++++ b/libc/string/xtensa/strcmp.S
+@@ -34,13 +34,14 @@
+
+ #define MASK4 0x40404040
+
++ .text
++ .align 4
++ .literal_position
+ .literal .Lmask0, MASK0
+ .literal .Lmask1, MASK1
+ .literal .Lmask2, MASK2
+ .literal .Lmask3, MASK3
+ .literal .Lmask4, MASK4
+-
+- .text
+ ENTRY (strcmp)
+ /* a2 = s1, a3 = s2 */
+
+--
+1.8.1.4
+
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v2 2/3] Makefile.in: add -mtext-section-literals to xtensa ABI
2014-03-30 16:55 [Buildroot] [PATCH v2 0/3] xtensa: add -mtext-section-literals to xtensa ABI Max Filippov
2014-03-30 16:55 ` [Buildroot] [PATCH v2 1/3] uclibc: add missing .literal_position directives Max Filippov
@ 2014-03-30 16:55 ` Max Filippov
2014-03-30 16:55 ` [Buildroot] [PATCH v2 3/3] xtensa: remove -mtext-section-literals from individual package *.mk's Max Filippov
2 siblings, 0 replies; 5+ messages in thread
From: Max Filippov @ 2014-03-30 16:55 UTC (permalink / raw)
To: buildroot
Collecting literals into separate section can be advantageous if that
section is placed into DTCM at link time. This is applicable for code
running on bare metal, but makes no sense under linux, where userspace
is isolated from the physical memory details. OTOH placing literals into
separate section breaks build of huge source files, because l32r
instruction can only access literals in 256 KBytes range.
Add -mtext-section-literals into xtensa ABI to fix build issues of
packages with huge sources.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1 -> v2:
- add comment to XTENSA_ABI variable explaining -mtext-section-literals usage
package/Makefile.in | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/package/Makefile.in b/package/Makefile.in
index eea7043..a70e538 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -72,8 +72,17 @@ endif
# and is required for some packages. While this option can degrade both
# code size and performance, the linker can usually optimize away the
# overhead when a call ends up within a certain range.
+#
+# Use text-section-literals for Xtensa globally.
+# Collecting literals into separate section can be advantageous if that
+# section is placed into DTCM at link time. This is applicable for code
+# running on bare metal, but makes no sense under linux, where userspace
+# is isolated from the physical memory details. OTOH placing literals into
+# separate section breaks build of huge source files, because l32r
+# instruction can only access literals in 256 KBytes range.
+#
ifeq ($(BR2_xtensa),y)
-TARGET_ABI += -mlongcalls
+TARGET_ABI += -mlongcalls -mtext-section-literals
endif
STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v2 3/3] xtensa: remove -mtext-section-literals from individual package *.mk's
2014-03-30 16:55 [Buildroot] [PATCH v2 0/3] xtensa: add -mtext-section-literals to xtensa ABI Max Filippov
2014-03-30 16:55 ` [Buildroot] [PATCH v2 1/3] uclibc: add missing .literal_position directives Max Filippov
2014-03-30 16:55 ` [Buildroot] [PATCH v2 2/3] Makefile.in: add -mtext-section-literals to xtensa ABI Max Filippov
@ 2014-03-30 16:55 ` Max Filippov
2014-03-30 17:30 ` Baruch Siach
2 siblings, 1 reply; 5+ messages in thread
From: Max Filippov @ 2014-03-30 16:55 UTC (permalink / raw)
To: buildroot
Now that -mtext-section-literals is specified in xtensa ABI remove it
from individual packages that needed it.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1 -> v2:
- new patch
package/civetweb/civetweb.mk | 3 ---
package/ffmpeg/ffmpeg.mk | 4 ----
package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk | 4 ----
package/gstreamer1/gst1-libav/gst1-libav.mk | 4 ----
package/lmbench/lmbench.mk | 4 ----
package/php/php.mk | 4 ----
package/sqlcipher/sqlcipher.mk | 4 ----
package/sqlite/sqlite.mk | 4 ----
8 files changed, 31 deletions(-)
diff --git a/package/civetweb/civetweb.mk b/package/civetweb/civetweb.mk
index be7620a..4b73a5e 100644
--- a/package/civetweb/civetweb.mk
+++ b/package/civetweb/civetweb.mk
@@ -25,9 +25,6 @@ endif
ifeq ($(BR2_CIVETWEB_WITH_LUA),y)
CIVETWEB_CONF_OPT += WITH_LUA=1
-ifeq ($(BR2_xtensa),y)
- CIVETWEB_COPT += -mtext-section-literals
-endif
endif
ifeq ($(BR2_PACKAGE_OPENSSL),y)
diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk
index a067fe6..a5d5de1 100644
--- a/package/ffmpeg/ffmpeg.mk
+++ b/package/ffmpeg/ffmpeg.mk
@@ -75,10 +75,6 @@ FFMPEG_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv)
FFMPEG_CFLAGS = $(TARGET_CFLAGS)
-ifeq ($(BR2_xtensa),y)
-FFMPEG_CFLAGS += -mtext-section-literals
-endif
-
FFMPEG_CONF_ENV = CFLAGS="$(FFMPEG_CFLAGS)"
ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
diff --git a/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk b/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
index eb7389f..1975682 100644
--- a/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
+++ b/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
@@ -16,10 +16,6 @@ GST_FFMPEG_CONF_EXTRA_OPT = \
GST_FFMPEG_CFLAGS = $(TARGET_CFLAGS)
-ifeq ($(BR2_xtensa),y)
-GST_FFMPEG_CFLAGS += -mtext-section-literals
-endif
-
GST_FFMPEG_CONF_ENV = CFLAGS="$(GST_FFMPEG_CFLAGS)"
ifeq ($(BR2_PACKAGE_ZLIB),y)
diff --git a/package/gstreamer1/gst1-libav/gst1-libav.mk b/package/gstreamer1/gst1-libav/gst1-libav.mk
index a0a536e..6e6ff51 100644
--- a/package/gstreamer1/gst1-libav/gst1-libav.mk
+++ b/package/gstreamer1/gst1-libav/gst1-libav.mk
@@ -85,10 +85,6 @@ GST1_LIBAV_CONF_OPT = \
GST1_LIBAV_CFLAGS = $(TARGET_CFLAGS)
-ifeq ($(BR2_xtensa),y)
-GST1_LIBAV_CFLAGS += -mtext-section-literals
-endif
-
GST1_LIBAV_CONF_ENV += CFLAGS="$(GST1_LIBAV_CFLAGS)"
$(eval $(autotools-package))
diff --git a/package/lmbench/lmbench.mk b/package/lmbench/lmbench.mk
index 529026f..c3a6c09 100644
--- a/package/lmbench/lmbench.mk
+++ b/package/lmbench/lmbench.mk
@@ -19,10 +19,6 @@ LMBENCH_CFLAGS += -I$(STAGING_DIR)/usr/include/tirpc/
LMBENCH_LDFLAGS += -ltirpc
endif
-ifeq ($(BR2_xtensa),y)
-LMBENCH_CFLAGS += -mtext-section-literals
-endif
-
define LMBENCH_CONFIGURE_CMDS
$(call CONFIG_UPDATE,$(@D))
sed -i 's/CFLAGS=/CFLAGS+=/g' $(@D)/src/Makefile
diff --git a/package/php/php.mk b/package/php/php.mk
index de02f4b..5797758 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -35,10 +35,6 @@ ifneq ($(BR2_INET_IPV6),y)
endif
endif
-ifeq ($(BR2_xtensa),y)
-PHP_CFLAGS += -mtext-section-literals
-endif
-
PHP_CONF_OPT += $(if $(BR2_PACKAGE_PHP_CLI),,--disable-cli)
PHP_CONF_OPT += $(if $(BR2_PACKAGE_PHP_CGI),,--disable-cgi)
diff --git a/package/sqlcipher/sqlcipher.mk b/package/sqlcipher/sqlcipher.mk
index ace5ce8..6130870 100644
--- a/package/sqlcipher/sqlcipher.mk
+++ b/package/sqlcipher/sqlcipher.mk
@@ -32,10 +32,6 @@ ifeq ($(BR2_PACKAGE_SQLCIPHER_STAT3),y)
SQLCIPHER_CFLAGS += -DSQLITE_ENABLE_STAT3
endif
-ifeq ($(BR2_xtensa),y)
-SQLCIPHER_CFLAGS += -mtext-section-literals
-endif
-
ifeq ($(BR2_PACKAGE_SQLCIPHER_READLINE),y)
SQLCIPHER_DEPENDENCIES += ncurses readline
SQLCIPHER_CONF_OPT += --with-readline-inc="-I$(STAGING_DIR)/usr/include"
diff --git a/package/sqlite/sqlite.mk b/package/sqlite/sqlite.mk
index b27eb58..6493a29 100644
--- a/package/sqlite/sqlite.mk
+++ b/package/sqlite/sqlite.mk
@@ -33,10 +33,6 @@ ifeq ($(BR2_PACKAGE_SQLITE_SECURE_DELETE),y)
SQLITE_CFLAGS += -DSQLITE_SECURE_DELETE
endif
-ifeq ($(BR2_xtensa),y)
-SQLITE_CFLAGS += -mtext-section-literals
-endif
-
SQLITE_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) $(SQLITE_CFLAGS)"
SQLITE_CONF_OPT = \
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread