All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/gcc: or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
@ 2023-07-28 14:38 Bernd Kuhls
  2023-07-28 19:33 ` Thomas Petazzoni via buildroot
  2023-08-30 11:44 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Bernd Kuhls @ 2023-07-28 14:38 UTC (permalink / raw)
  To: buildroot
  Cc: Stafford Horne, Giulio Benetti, Yann E . MORIN, Romain Naour,
	Thomas Petazzoni

Backport upstream patch to fix build error seens with alsa-lib:
error.c:(.text+0x12c): undefined reference to `__tls_get_addr'

Fixes:
http://autobuild.buildroot.net/results/525ca7fe78015168c186ffda5fa52c0edb2071c9/

The fix is included in gcc 13.x.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 ...ine-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch | 49 +++++++++++++++++++
 ...ine-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch | 49 +++++++++++++++++++
 ...ine-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch | 48 ++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 package/gcc/10.4.0/0007-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
 create mode 100644 package/gcc/11.4.0/0006-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
 create mode 100644 package/gcc/12.3.0/0002-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch

diff --git a/package/gcc/10.4.0/0007-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch b/package/gcc/10.4.0/0007-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
new file mode 100644
index 0000000000..7e9714e9cb
--- /dev/null
+++ b/package/gcc/10.4.0/0007-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
@@ -0,0 +1,49 @@
+From ca01d2526917ec6e54b30472d3aedfd46d4ca585 Mon Sep 17 00:00:00 2001
+From: Stafford Horne <shorne@gmail.com>
+Date: Thu, 29 Sep 2022 15:32:39 +0100
+Subject: [PATCH] or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
+
+This was found when testing buildroot with linuxthreads enabled.  In
+this case, the build passes --disable-tls to the toolchain during
+configuration.  After building the OpenRISC toolchain it was still
+generating TLS code sequences and causing linker failures such as:
+
+ ..../or1k-buildroot-linux-uclibc-gcc -o gpsd-3.24/gpsctl .... -lusb-1.0 -lm -lrt -lnsl
+ ..../ld: ..../sysroot/usr/lib/libusb-1.0.so: undefined reference to `__tls_get_addr'
+
+This patch fixes this by disabling tls for the OpenRISC target when requested
+via --disable-tls.
+
+gcc/ChangeLog:
+
+	* config/or1k/or1k.c (TARGET_HAVE_TLS): Only define if
+	HAVE_AS_TLS is defined.
+
+Tested-by: Yann E. MORIN <yann.morin@orange.com>
+
+Upstream: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ca01d2526917ec6e54b30472d3aedfd46d4ca585
+
+[Bernd: backported to 10.4.0]
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+---
+ gcc/config/or1k/or1k.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c
+index da2f59062ba..0ce7b234417 100644
+--- a/gcc/config/or1k/or1k.c
++++ b/gcc/config/or1k/or1k.c
+@@ -2175,8 +2175,10 @@ or1k_output_mi_thunk (FILE *file, tree thunk_fndecl,
+ #undef  TARGET_LEGITIMATE_ADDRESS_P
+ #define TARGET_LEGITIMATE_ADDRESS_P or1k_legitimate_address_p
+ 
++#ifdef HAVE_AS_TLS
+ #undef  TARGET_HAVE_TLS
+ #define TARGET_HAVE_TLS true
++#endif
+ 
+ #undef  TARGET_HAVE_SPECULATION_SAFE_VALUE
+ #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
+-- 
+2.39.3
+
diff --git a/package/gcc/11.4.0/0006-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch b/package/gcc/11.4.0/0006-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
new file mode 100644
index 0000000000..025e6cfe32
--- /dev/null
+++ b/package/gcc/11.4.0/0006-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
@@ -0,0 +1,49 @@
+From ca01d2526917ec6e54b30472d3aedfd46d4ca585 Mon Sep 17 00:00:00 2001
+From: Stafford Horne <shorne@gmail.com>
+Date: Thu, 29 Sep 2022 15:32:39 +0100
+Subject: [PATCH] or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
+
+This was found when testing buildroot with linuxthreads enabled.  In
+this case, the build passes --disable-tls to the toolchain during
+configuration.  After building the OpenRISC toolchain it was still
+generating TLS code sequences and causing linker failures such as:
+
+ ..../or1k-buildroot-linux-uclibc-gcc -o gpsd-3.24/gpsctl .... -lusb-1.0 -lm -lrt -lnsl
+ ..../ld: ..../sysroot/usr/lib/libusb-1.0.so: undefined reference to `__tls_get_addr'
+
+This patch fixes this by disabling tls for the OpenRISC target when requested
+via --disable-tls.
+
+gcc/ChangeLog:
+
+	* config/or1k/or1k.c (TARGET_HAVE_TLS): Only define if
+	HAVE_AS_TLS is defined.
+
+Tested-by: Yann E. MORIN <yann.morin@orange.com>
+
+Upstream: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ca01d2526917ec6e54b30472d3aedfd46d4ca585
+
+[Bernd: backported to 11.4.0]
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+---
+ gcc/config/or1k/or1k.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c
+index da2f59062ba..0ce7b234417 100644
+--- a/gcc/config/or1k/or1k.c
++++ b/gcc/config/or1k/or1k.c
+@@ -2175,8 +2175,10 @@ or1k_output_mi_thunk (FILE *file, tree thunk_fndecl,
+ #undef  TARGET_LEGITIMATE_ADDRESS_P
+ #define TARGET_LEGITIMATE_ADDRESS_P or1k_legitimate_address_p
+ 
++#ifdef HAVE_AS_TLS
+ #undef  TARGET_HAVE_TLS
+ #define TARGET_HAVE_TLS true
++#endif
+ 
+ #undef  TARGET_HAVE_SPECULATION_SAFE_VALUE
+ #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
+-- 
+2.39.3
+
diff --git a/package/gcc/12.3.0/0002-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch b/package/gcc/12.3.0/0002-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
new file mode 100644
index 0000000000..4bac597233
--- /dev/null
+++ b/package/gcc/12.3.0/0002-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
@@ -0,0 +1,48 @@
+From ca01d2526917ec6e54b30472d3aedfd46d4ca585 Mon Sep 17 00:00:00 2001
+From: Stafford Horne <shorne@gmail.com>
+Date: Thu, 29 Sep 2022 15:32:39 +0100
+Subject: [PATCH] or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
+
+This was found when testing buildroot with linuxthreads enabled.  In
+this case, the build passes --disable-tls to the toolchain during
+configuration.  After building the OpenRISC toolchain it was still
+generating TLS code sequences and causing linker failures such as:
+
+ ..../or1k-buildroot-linux-uclibc-gcc -o gpsd-3.24/gpsctl .... -lusb-1.0 -lm -lrt -lnsl
+ ..../ld: ..../sysroot/usr/lib/libusb-1.0.so: undefined reference to `__tls_get_addr'
+
+This patch fixes this by disabling tls for the OpenRISC target when requested
+via --disable-tls.
+
+gcc/ChangeLog:
+
+	* config/or1k/or1k.cc (TARGET_HAVE_TLS): Only define if
+	HAVE_AS_TLS is defined.
+
+Tested-by: Yann E. MORIN <yann.morin@orange.com>
+
+Upstream: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ca01d2526917ec6e54b30472d3aedfd46d4ca585
+
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+---
+ gcc/config/or1k/or1k.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gcc/config/or1k/or1k.cc b/gcc/config/or1k/or1k.cc
+index da2f59062ba..0ce7b234417 100644
+--- a/gcc/config/or1k/or1k.cc
++++ b/gcc/config/or1k/or1k.cc
+@@ -2206,8 +2206,10 @@ or1k_output_mi_thunk (FILE *file, tree thunk_fndecl,
+ #undef  TARGET_LEGITIMATE_ADDRESS_P
+ #define TARGET_LEGITIMATE_ADDRESS_P or1k_legitimate_address_p
+ 
++#ifdef HAVE_AS_TLS
+ #undef  TARGET_HAVE_TLS
+ #define TARGET_HAVE_TLS true
++#endif
+ 
+ #undef  TARGET_HAVE_SPECULATION_SAFE_VALUE
+ #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
+-- 
+2.39.3
+
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/gcc: or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
  2023-07-28 14:38 [Buildroot] [PATCH 1/1] package/gcc: or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS Bernd Kuhls
@ 2023-07-28 19:33 ` Thomas Petazzoni via buildroot
  2023-08-30 11:44 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-07-28 19:33 UTC (permalink / raw)
  To: Bernd Kuhls
  Cc: Romain Naour, Stafford Horne, Yann E . MORIN, Giulio Benetti, buildroot

On Fri, 28 Jul 2023 16:38:40 +0200
Bernd Kuhls <bernd@kuhls.net> wrote:

> Backport upstream patch to fix build error seens with alsa-lib:
> error.c:(.text+0x12c): undefined reference to `__tls_get_addr'
> 
> Fixes:
> http://autobuild.buildroot.net/results/525ca7fe78015168c186ffda5fa52c0edb2071c9/
> 
> The fix is included in gcc 13.x.
> 
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> ---
>  ...ine-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch | 49 +++++++++++++++++++
>  ...ine-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch | 49 +++++++++++++++++++
>  ...ine-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch | 48 ++++++++++++++++++
>  3 files changed, 146 insertions(+)
>  create mode 100644 package/gcc/10.4.0/0007-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
>  create mode 100644 package/gcc/11.4.0/0006-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch
>  create mode 100644 package/gcc/12.3.0/0002-or1k-Only-define-TARGET_HAVE_TLS-when-HAVE_AS_TLS.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/gcc: or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
  2023-07-28 14:38 [Buildroot] [PATCH 1/1] package/gcc: or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS Bernd Kuhls
  2023-07-28 19:33 ` Thomas Petazzoni via buildroot
@ 2023-08-30 11:44 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2023-08-30 11:44 UTC (permalink / raw)
  To: Bernd Kuhls
  Cc: Giulio Benetti, Yann E . MORIN, Thomas Petazzoni, buildroot,
	Romain Naour, Stafford Horne

>>>>> "Bernd" == Bernd Kuhls <bernd@kuhls.net> writes:

 > Backport upstream patch to fix build error seens with alsa-lib:
 > error.c:(.text+0x12c): undefined reference to `__tls_get_addr'

 > Fixes:
 > http://autobuild.buildroot.net/results/525ca7fe78015168c186ffda5fa52c0edb2071c9/

 > The fix is included in gcc 13.x.

 > Signed-off-by: Bernd Kuhls <bernd@kuhls.net>

Committed to 2023.02.x and 2023.05.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-30 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 14:38 [Buildroot] [PATCH 1/1] package/gcc: or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS Bernd Kuhls
2023-07-28 19:33 ` Thomas Petazzoni via buildroot
2023-08-30 11:44 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.