All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virglrenderer: fix compiling failure with `-fvisibility=default'
@ 2019-05-19  5:00 Hongxu Jia
  2019-05-19 10:10 ` Alexander Kanavin
  0 siblings, 1 reply; 5+ messages in thread
From: Hongxu Jia @ 2019-05-19  5:00 UTC (permalink / raw)
  To: openembedded-core, richard.purdie

Extern global variable `util_cpu_caps' to multiple C source files is
not a good habit, it caused linking failure when making a shard object
in some cross compiling circumstance
...
|ld: gallium/auxiliary/.libs/libgallium.a(u_cpu_detect.o): relocation
R_386_GOTOFF against undefined symbol `util_cpu_caps' can not be used
when making a shared object
|ld: final link failed: bad value
...

Covert global variable to static and assign it only in one C source file,
provide get function for other C source files

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 ...util_cpu_caps-can-not-be-used-when-making.patch | 97 ++++++++++++++++++++++
 .../virglrenderer/virglrenderer_0.7.0.bb           |  1 +
 2 files changed, 98 insertions(+)
 create mode 100644 meta/recipes-graphics/virglrenderer/virglrenderer/0001-fix-symbol-util_cpu_caps-can-not-be-used-when-making.patch

diff --git a/meta/recipes-graphics/virglrenderer/virglrenderer/0001-fix-symbol-util_cpu_caps-can-not-be-used-when-making.patch b/meta/recipes-graphics/virglrenderer/virglrenderer/0001-fix-symbol-util_cpu_caps-can-not-be-used-when-making.patch
new file mode 100644
index 0000000..e5dc8f9
--- /dev/null
+++ b/meta/recipes-graphics/virglrenderer/virglrenderer/0001-fix-symbol-util_cpu_caps-can-not-be-used-when-making.patch
@@ -0,0 +1,97 @@
+From e991050fec102a5fde766226c7f49444c3860c49 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Sun, 19 May 2019 00:12:51 -0400
+Subject: [PATCH] fix symbol `util_cpu_caps' can not be used when making a
+ shared object
+
+Extern global variable `util_cpu_caps' to multiple C source files is
+not a good habit, it caused linking failure when making a shard object
+in some cross compiling circumstance
+...
+|ld: gallium/auxiliary/.libs/libgallium.a(u_cpu_detect.o): relocation
+R_386_GOTOFF against undefined symbol `util_cpu_caps' can not be used
+when making a shared object
+|ld: final link failed: bad value
+...
+
+Covert global variable to static and assign it only in one C source file,
+provide get function for other C source files
+
+Upstream-Status: Submitted [virglrenderer-devel@lists.freedesktop.org]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ src/gallium/auxiliary/util/u_cpu_detect.c | 6 +++++-
+ src/gallium/auxiliary/util/u_cpu_detect.h | 3 +--
+ src/gallium/auxiliary/util/u_math.c       | 8 ++++----
+ 3 files changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c
+index 0b4b83a..be0cedd 100644
+--- a/src/gallium/auxiliary/util/u_cpu_detect.c
++++ b/src/gallium/auxiliary/util/u_cpu_detect.c
+@@ -78,7 +78,11 @@ DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", FALSE)
+ #endif
+ 
+ 
+-struct util_cpu_caps util_cpu_caps;
++static struct util_cpu_caps util_cpu_caps;
++struct util_cpu_caps* get_util_cpu_caps(void)
++{
++    return &util_cpu_caps;
++}
+ 
+ #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
+ static int has_cpuid(void);
+diff --git a/src/gallium/auxiliary/util/u_cpu_detect.h b/src/gallium/auxiliary/util/u_cpu_detect.h
+index 01f3896..58134ab 100644
+--- a/src/gallium/auxiliary/util/u_cpu_detect.h
++++ b/src/gallium/auxiliary/util/u_cpu_detect.h
+@@ -73,8 +73,7 @@ struct util_cpu_caps {
+    unsigned has_daz:1;
+ };
+ 
+-extern struct util_cpu_caps
+-util_cpu_caps;
++struct util_cpu_caps* get_util_cpu_caps(void);
+ 
+ void util_cpu_detect(void);
+ 
+diff --git a/src/gallium/auxiliary/util/u_math.c b/src/gallium/auxiliary/util/u_math.c
+index e574153..c08ed3b 100644
+--- a/src/gallium/auxiliary/util/u_math.c
++++ b/src/gallium/auxiliary/util/u_math.c
+@@ -90,7 +90,7 @@ util_fpstate_get(void)
+    unsigned mxcsr = 0;
+ 
+ #if defined(PIPE_ARCH_SSE)
+-   if (util_cpu_caps.has_sse) {
++   if (get_util_cpu_caps()->has_sse) {
+       mxcsr = _mm_getcsr();
+    }
+ #endif
+@@ -108,10 +108,10 @@ unsigned
+ util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
+ {
+ #if defined(PIPE_ARCH_SSE)
+-   if (util_cpu_caps.has_sse) {
++   if (get_util_cpu_caps()->has_sse) {
+       /* Enable flush to zero mode */
+       current_mxcsr |= _MM_FLUSH_ZERO_MASK;
+-      if (util_cpu_caps.has_daz) {
++      if (get_util_cpu_caps()->has_daz) {
+          /* Enable denormals are zero mode */
+          current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
+       }
+@@ -130,7 +130,7 @@ void
+ util_fpstate_set(unsigned mxcsr)
+ {
+ #if defined(PIPE_ARCH_SSE)
+-   if (util_cpu_caps.has_sse) {
++   if (get_util_cpu_caps()->has_sse) {
+       _mm_setcsr(mxcsr);
+    }
+ #endif
+-- 
+2.8.1
+
diff --git a/meta/recipes-graphics/virglrenderer/virglrenderer_0.7.0.bb b/meta/recipes-graphics/virglrenderer/virglrenderer_0.7.0.bb
index 225a0b8..441c692 100644
--- a/meta/recipes-graphics/virglrenderer/virglrenderer_0.7.0.bb
+++ b/meta/recipes-graphics/virglrenderer/virglrenderer_0.7.0.bb
@@ -9,6 +9,7 @@ SRCREV = "402c228861c9893f64cffbbcb4cb23044b8c721c"
 SRC_URI = "git://anongit.freedesktop.org/virglrenderer \
            file://0001-vtest-add-missing-includes.patch \
            file://0001-Makefile.am-explicitly-link-with-libdrm.patch \
+           file://0001-fix-symbol-util_cpu_caps-can-not-be-used-when-making.patch \
            "
 
 S = "${WORKDIR}/git"
-- 
2.8.1



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

* Re: [PATCH] virglrenderer: fix compiling failure with `-fvisibility=default'
  2019-05-19  5:00 [PATCH] virglrenderer: fix compiling failure with `-fvisibility=default' Hongxu Jia
@ 2019-05-19 10:10 ` Alexander Kanavin
  2019-05-19 14:30   ` Hongxu Jia
  2019-05-19 14:30   ` Hongxu Jia
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Kanavin @ 2019-05-19 10:10 UTC (permalink / raw)
  To: Hongxu Jia; +Cc: OE-core

On Sun, 19 May 2019 at 07:01, Hongxu Jia <hongxu.jia@windriver.com> wrote:
> +Extern global variable `util_cpu_caps' to multiple C source files is
> +not a good habit, it caused linking failure when making a shard object
> +in some cross compiling circumstance
> +...
> +|ld: gallium/auxiliary/.libs/libgallium.a(u_cpu_detect.o): relocation
> +R_386_GOTOFF against undefined symbol `util_cpu_caps' can not be used
> +when making a shared object
> +|ld: final link failed: bad value
> +...
> +
> +Covert global variable to static and assign it only in one C source file,
> +provide get function for other C source files
> +
> +Upstream-Status: Submitted [virglrenderer-devel@lists.freedesktop.org]

I do not actually see the submission here:
https://lists.freedesktop.org/archives/virglrenderer-devel/2019-May/date.html

I think the patch should be submitted as a merge request here:
https://gitlab.freedesktop.org/virgl/virglrenderer/merge_requests

and I would rather wait for upstream to accept it, and then take it in
oe-core as a backport.

Alex


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

* Re: [PATCH] virglrenderer: fix compiling failure with `-fvisibility=default'
  2019-05-19 10:10 ` Alexander Kanavin
@ 2019-05-19 14:30   ` Hongxu Jia
  2019-05-19 14:30   ` Hongxu Jia
  1 sibling, 0 replies; 5+ messages in thread
From: Hongxu Jia @ 2019-05-19 14:30 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

On 5/19/19 6:10 PM, Alexander Kanavin wrote:
> On Sun, 19 May 2019 at 07:01, Hongxu Jia <hongxu.jia@windriver.com> wrote:
>> +Extern global variable `util_cpu_caps' to multiple C source files is
>> +not a good habit, it caused linking failure when making a shard object
>> +in some cross compiling circumstance
>> +...
>> +|ld: gallium/auxiliary/.libs/libgallium.a(u_cpu_detect.o): relocation
>> +R_386_GOTOFF against undefined symbol `util_cpu_caps' can not be used
>> +when making a shared object
>> +|ld: final link failed: bad value
>> +...
>> +
>> +Covert global variable to static and assign it only in one C source file,
>> +provide get function for other C source files
>> +
>> +Upstream-Status: Submitted [virglrenderer-devel@lists.freedesktop.org]
> I do not actually see the submission here:
> https://lists.freedesktop.org/archives/virglrenderer-devel/2019-May/date.html

Here is te mailing list reply

...

Your mail to 'virglrenderer-devel' with the subject

     [PATCH] fix symbol `util_cpu_caps' can not be used when making a
shared object

Is being held until the list moderator can review it for approval.

The reason it is being held:

     Post by non-member to a members-only list

Either the message will get posted to the list, or you will receive
notification of the moderator's decision.  If you would like to cancel
this posting, please visit the following URL:

     https://lists.freedesktop.org/mailman/confirm/virglrenderer-devel/131d0999373561efdb12c196276096402856dbc7

...
//Hongxu

> I think the patch should be submitted as a merge request here:
> https://gitlab.freedesktop.org/virgl/virglrenderer/merge_requests
>
> and I would rather wait for upstream to accept it, and then take it in
> oe-core as a backport.
>
> Alex




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

* Re: [PATCH] virglrenderer: fix compiling failure with `-fvisibility=default'
  2019-05-19 10:10 ` Alexander Kanavin
  2019-05-19 14:30   ` Hongxu Jia
@ 2019-05-19 14:30   ` Hongxu Jia
  2019-05-19 15:04     ` Hongxu Jia
  1 sibling, 1 reply; 5+ messages in thread
From: Hongxu Jia @ 2019-05-19 14:30 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

On 5/19/19 6:10 PM, Alexander Kanavin wrote:
> On Sun, 19 May 2019 at 07:01, Hongxu Jia <hongxu.jia@windriver.com> wrote:
>> +Extern global variable `util_cpu_caps' to multiple C source files is
>> +not a good habit, it caused linking failure when making a shard object
>> +in some cross compiling circumstance
>> +...
>> +|ld: gallium/auxiliary/.libs/libgallium.a(u_cpu_detect.o): relocation
>> +R_386_GOTOFF against undefined symbol `util_cpu_caps' can not be used
>> +when making a shared object
>> +|ld: final link failed: bad value
>> +...
>> +
>> +Covert global variable to static and assign it only in one C source file,
>> +provide get function for other C source files
>> +
>> +Upstream-Status: Submitted [virglrenderer-devel@lists.freedesktop.org]
> I do not actually see the submission here:
> https://lists.freedesktop.org/archives/virglrenderer-devel/2019-May/date.html

Here is the mailing list reply

...

Your mail to 'virglrenderer-devel' with the subject

     [PATCH] fix symbol `util_cpu_caps' can not be used when making a
shared object

Is being held until the list moderator can review it for approval.

The reason it is being held:

     Post by non-member to a members-only list

Either the message will get posted to the list, or you will receive
notification of the moderator's decision.  If you would like to cancel
this posting, please visit the following URL:

     https://lists.freedesktop.org/mailman/confirm/virglrenderer-devel/131d0999373561efdb12c196276096402856dbc7

...
//Hongxu

> I think the patch should be submitted as a merge request here:
> https://gitlab.freedesktop.org/virgl/virglrenderer/merge_requests
>
> and I would rather wait for upstream to accept it, and then take it in
> oe-core as a backport.
>
> Alex




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

* Re: [PATCH] virglrenderer: fix compiling failure with `-fvisibility=default'
  2019-05-19 14:30   ` Hongxu Jia
@ 2019-05-19 15:04     ` Hongxu Jia
  0 siblings, 0 replies; 5+ messages in thread
From: Hongxu Jia @ 2019-05-19 15:04 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

On 5/19/19 10:30 PM, Hongxu Jia wrote:
> On 5/19/19 6:10 PM, Alexander Kanavin wrote:
>> On Sun, 19 May 2019 at 07:01, Hongxu Jia <hongxu.jia@windriver.com> 
>> wrote:
>>> +Extern global variable `util_cpu_caps' to multiple C source files is
>>> +not a good habit, it caused linking failure when making a shard object
>>> +in some cross compiling circumstance
>>> +...
>>> +|ld: gallium/auxiliary/.libs/libgallium.a(u_cpu_detect.o): relocation
>>> +R_386_GOTOFF against undefined symbol `util_cpu_caps' can not be used
>>> +when making a shared object
>>> +|ld: final link failed: bad value
>>> +...
>>> +
>>> +Covert global variable to static and assign it only in one C source 
>>> file,
>>> +provide get function for other C source files
>>> +
>>> +Upstream-Status: Submitted [virglrenderer-devel@lists.freedesktop.org]
>> I do not actually see the submission here:
>> https://lists.freedesktop.org/archives/virglrenderer-devel/2019-May/date.html 
>>
>
> Here is the mailing list reply
>
> ...
>
> Your mail to 'virglrenderer-devel' with the subject
>
>     [PATCH] fix symbol `util_cpu_caps' can not be used when making a
> shared object
>
> Is being held until the list moderator can review it for approval.
>
> The reason it is being held:
>
>     Post by non-member to a members-only list
>
> Either the message will get posted to the list, or you will receive
> notification of the moderator's decision.  If you would like to cancel
> this posting, please visit the following URL:
>
> https://lists.freedesktop.org/mailman/confirm/virglrenderer-devel/131d0999373561efdb12c196276096402856dbc7
>
> ...
> //Hongxu
>
>> I think the patch should be submitted as a merge request here:
>> https://gitlab.freedesktop.org/virgl/virglrenderer/merge_requests
>>
I also submit a merge request

https://gitlab.freedesktop.org/virgl/virglrenderer/merge_requests/239

//Hongxu

>> and I would rather wait for upstream to accept it, and then take it in
>> oe-core as a backport.
>>
>> Alex
>
>



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

end of thread, other threads:[~2019-05-19 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-19  5:00 [PATCH] virglrenderer: fix compiling failure with `-fvisibility=default' Hongxu Jia
2019-05-19 10:10 ` Alexander Kanavin
2019-05-19 14:30   ` Hongxu Jia
2019-05-19 14:30   ` Hongxu Jia
2019-05-19 15:04     ` Hongxu Jia

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.