[Mesa-dev] [PATCH] android: mesa: revert "Enable asm unconditionally"
Mauro Rossi
issor.oruam at gmail.com
Thu Aug 15 09:52:02 UTC 2019
Hi Tapani,
On Thu, Aug 15, 2019 at 7:29 AM Tapani Pälli <tapani.palli at intel.com> wrote:
>
> On 8/13/19 9:55 PM, Mauro Rossi wrote:
> > Hi,
> >
> > On Tue, Aug 13, 2019 at 3:51 PM Tapani Pälli <tapani.palli at intel.com
> > <mailto:tapani.palli at intel.com>> wrote:
> >
> >
> > On 8/13/19 3:32 PM, Mauro Rossi wrote:
> > > Hi,
> > >
> > > On Tue, Aug 13, 2019 at 2:03 PM Tapani Pälli
> > <tapani.palli at intel.com <mailto:tapani.palli at intel.com>
> > > <mailto:tapani.palli at intel.com <mailto:tapani.palli at intel.com>>>
> > wrote:
> > >
> > > Hi;
> > >
> > > On 8/13/19 2:43 PM, Mauro Rossi wrote:
> > > > Hi Tapani,
> > > >
> > > > On Sat, Jul 27, 2019 at 2:56 PM Mauro Rossi
> > > <issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>
> > <mailto:issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>>
> > > > <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com> <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com>>>> wrote:
> > > >
> > > > On Sat, Jul 27, 2019 at 2:56 PM Mauro Rossi
> > > <issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>
> > <mailto:issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>>
> > > > <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com>
> > > <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com>>>> wrote:
> > > > >
> > > > > On Thu, Jul 18, 2019 at 1:07 PM Chih-Wei Huang
> > > > <cwhuang at android-x86.org
> > <mailto:cwhuang at android-x86.org> <mailto:cwhuang at android-x86.org
> > <mailto:cwhuang at android-x86.org>>
> > > <mailto:cwhuang at android-x86.org
> > <mailto:cwhuang at android-x86.org> <mailto:cwhuang at android-x86.org
> > <mailto:cwhuang at android-x86.org>>>>
> > > wrote:
> > > > > >
> > > > > > Mauro Rossi <issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com>
> > > <mailto:issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>>
> > > > <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com>
> > > <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com>>>> 於 2019年7月14日 週日 下午5:17寫道:
> > > > > > >
> > > > > > > This patch partially reverts 20294dc ("mesa:
> > Enable asm
> > > > unconditionally, ...")
> > > > > > >
> > > > > > > Android makefile build logic needs to disable
> > assembler
> > > > optimization
> > > > > > > in 32bit builds to avoid text relocations for
> > > libglapi.so shared
> > > > > > >
> > > > > > > Fixes the following build error with Android
> > x86 32bit
> > > target:
> > > > > > >
> > > > > > > [ 0% 4/477] target SharedLib: libglapi
> > > >
> > >
> >
> (out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/LINKED/libglapi.so)
> > > > > > > FAILED:
> > > >
> > >
> >
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/LINKED/libglapi.so
> > > > > > > ...
> > > > > > >
> > > >
> > >
> >
> prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/bin/ld:
> > > > warning: shared library text segment is not shareable
> > > > > > >
> > > >
> > >
> >
> prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/bin/ld:
> > > > error: treating warnings as errors
> > > > > > > clang-6.0: error: linker command failed with
> > exit code
> > > 1 (use
> > > > -v to see invocation)
> > > > > > >
> > > > > > > Fixes: 20294dc ("mesa: Enable asm
> > unconditionally, now
> > > that
> > > > gen_matypes is gone.")
> > > > > > > Signed-off-by: Mauro Rossi
> > <issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>
> > > <mailto:issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>>
> > > > <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com> <mailto:issor.oruam at gmail.com
> > <mailto:issor.oruam at gmail.com>>>>
> > > > > > > ---
> > > > > > > Android.common.mk <http://Android.common.mk>
> > <http://Android.common.mk>
> > > <http://Android.common.mk>
> > > > | 3 +++
> > > > > > > Android.mk | 7 +++++++
> > > > > > > src/mesa/Android.libmesa_dricore.mk
> > <http://Android.libmesa_dricore.mk>
> > > <http://Android.libmesa_dricore.mk>
> > > > <http://Android.libmesa_dricore.mk> | 2 ++
> > > > > > > src/mesa/Android.libmesa_st_mesa.mk
> > <http://Android.libmesa_st_mesa.mk>
> > > <http://Android.libmesa_st_mesa.mk>
> > > > <http://Android.libmesa_st_mesa.mk> | 2 ++
> > > > > > > 4 files changed, 14 insertions(+)
> > > > > > >
> > > > > > > diff --git a/Android.common.mk
> > <http://Android.common.mk>
> > > <http://Android.common.mk> <http://Android.common.mk>
> > > > b/Android.common.mk <http://Android.common.mk>
> > <http://Android.common.mk>
> > > <http://Android.common.mk>
> > > > > > > index 8a1c734353..209654bb75 100644
> > > > > > > --- a/Android.common.mk
> > <http://Android.common.mk> <http://Android.common.mk>
> > > <http://Android.common.mk>
> > > > > > > +++ b/Android.common.mk
> > <http://Android.common.mk> <http://Android.common.mk>
> > > <http://Android.common.mk>
> > > > > > > @@ -106,9 +106,12 @@ ifeq ($(shell test
> > > > $(PLATFORM_SDK_VERSION) -ge 26 && echo true),true)
> > > > > > > LOCAL_CFLAGS += -DHAVE_SYS_SHM_H
> > > > > > > endif
> > > > > > >
> > > > > > > +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
> > > > > > > ifeq ($(TARGET_ARCH),x86)
> > > > > > > LOCAL_CFLAGS += \
> > > > > > > -DUSE_X86_ASM
> > > > > > > +
> > > > > > > +endif
> > > > > > > endif
> > > > > > > ifeq ($(ARCH_ARM_HAVE_NEON),true)
> > > > > > > LOCAL_CFLAGS_arm += -DUSE_ARM_ASM
> > > > > > > diff --git a/Android.mk b/Android.mk
> > > > > > > index 57613eccfc..4a2a003ea3 100644
> > > > > > > --- a/Android.mk
> > > > > > > +++ b/Android.mk
> > > > > > > @@ -83,6 +83,13 @@ endif
> > > > > > >
> > > > > > > $(foreach d, $(MESA_BUILD_CLASSIC)
> > $(MESA_BUILD_GALLIUM),
> > > > $(eval $(d) := true))
> > > > > > >
> > > > > > > +# host and target must be the same arch to
> > generate
> > > matypes.h
> > > > > > > +ifeq ($(TARGET_ARCH),$(HOST_ARCH))
> > > > > > > +MESA_ENABLE_ASM := true
> > > > > > > +else
> > > > > > > +MESA_ENABLE_ASM := false
> > > > > > > +endif
> > > > > > > +
> > > > > > > ifneq ($(filter true,
> $(HAVE_GALLIUM_RADEONSI)),)
> > > > > > > MESA_ENABLE_LLVM := true
> > > > > > > endif
> > > > > > > diff --git
> > a/src/mesa/Android.libmesa_dricore.mk
> > <http://Android.libmesa_dricore.mk>
> > > <http://Android.libmesa_dricore.mk>
> > > > <http://Android.libmesa_dricore.mk>
> > > > b/src/mesa/Android.libmesa_dricore.mk
> > <http://Android.libmesa_dricore.mk>
> > > <http://Android.libmesa_dricore.mk>
> > > > <http://Android.libmesa_dricore.mk>
> > > > > > > index 8eb6aabe83..792117767b 100644
> > > > > > > --- a/src/mesa/Android.libmesa_dricore.mk
> > <http://Android.libmesa_dricore.mk>
> > > <http://Android.libmesa_dricore.mk>
> > > > <http://Android.libmesa_dricore.mk>
> > > > > > > +++ b/src/mesa/Android.libmesa_dricore.mk
> > <http://Android.libmesa_dricore.mk>
> > > <http://Android.libmesa_dricore.mk>
> > > > <http://Android.libmesa_dricore.mk>
> > > > > > > @@ -39,9 +39,11 @@ LOCAL_MODULE_CLASS :=
> > STATIC_LIBRARIES
> > > > > > > LOCAL_SRC_FILES := \
> > > > > > > $(MESA_FILES)
> > > > > > >
> > > > > > > +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
> > > > > > > ifeq ($(TARGET_ARCH),x86)
> > > > > > > LOCAL_SRC_FILES += $(X86_FILES)
> > > > > > > endif # x86
> > > > > > > +endif # MESA_ENABLE_ASM
> > > > > > >
> > > > > > > ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
> > > > > > > LOCAL_WHOLE_STATIC_LIBRARIES := \
> > > > > > > diff --git
> > a/src/mesa/Android.libmesa_st_mesa.mk
> > <http://Android.libmesa_st_mesa.mk>
> > > <http://Android.libmesa_st_mesa.mk>
> > > > <http://Android.libmesa_st_mesa.mk>
> > > > b/src/mesa/Android.libmesa_st_mesa.mk
> > <http://Android.libmesa_st_mesa.mk>
> > > <http://Android.libmesa_st_mesa.mk>
> > > > <http://Android.libmesa_st_mesa.mk>
> > > > > > > index 16153a3c5b..ddfd03059c 100644
> > > > > > > --- a/src/mesa/Android.libmesa_st_mesa.mk
> > <http://Android.libmesa_st_mesa.mk>
> > > <http://Android.libmesa_st_mesa.mk>
> > > > <http://Android.libmesa_st_mesa.mk>
> > > > > > > +++ b/src/mesa/Android.libmesa_st_mesa.mk
> > <http://Android.libmesa_st_mesa.mk>
> > > <http://Android.libmesa_st_mesa.mk>
> > > > <http://Android.libmesa_st_mesa.mk>
> > > > > > > @@ -42,9 +42,11 @@ LOCAL_GENERATED_SOURCES := \
> > > > > > > $(MESA_GEN_GLSL_H) \
> > > > > > > $(MESA_GEN_NIR_H)
> > > > > > >
> > > > > > > +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
> > > > > > > ifeq ($(TARGET_ARCH),x86)
> > > > > > > LOCAL_SRC_FILES += $(X86_FILES)
> > > > > > > endif # x86
> > > > > > > +endif # MESA_ENABLE_ASM
> > > > > > >
> > > > > > > ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
> > > > > > > LOCAL_WHOLE_STATIC_LIBRARIES := \
> > > > > > > --
> > > > > >
> > > > > > Looks good to me.
> > > > > >
> > > > > > Review-by: Chih-Wei Huang <cwhuang at linux.org.tw
> > <mailto:cwhuang at linux.org.tw>
> > > <mailto:cwhuang at linux.org.tw <mailto:cwhuang at linux.org.tw>>
> > > > <mailto:cwhuang at linux.org.tw
> > <mailto:cwhuang at linux.org.tw> <mailto:cwhuang at linux.org.tw
> > <mailto:cwhuang at linux.org.tw>>>>
> > > > >
> > > > > Added Tapani who should one of the users of 32bit
> mesa,
> > > > > please provide feedback to proceed.
> > > > > Mauro
> > > >
> > > > Tapani added now
> > > > M.
> > > >
> > > >
> > > > did you had the chance to have a look
> > > > and provide Reviewed-by ?
> > > >
> > >
> > > Sorry I've managed to miss this one. I'm not hitting any
> > problems after
> > > mentioned changes though. Does this happen only if you
> > compile on a
> > > 32bit machine? I'm compiling both 64bit and 32bit but on a
> 64bit
> > > machine.
> > >
> > >
> > >
> > > // Tapani
> > >
> > >
> > > It happens when compiling on a 64 bit build machine,
> > > the assembler parts of mesa have text relocation when mesa
> libglapi
> > > 32bit target is compiled.
> > >
> > > How do you avoid the linker error?
> >
> > I'm not getting any linker error. Today I've compiled and tested both
> > i965 and iris with some patches rebased on top of commit b594796f1b8.
> >
> > Does this happen with a particular version of Android?
> >
> > // Tapani
> >
> >
> > It happens with oreo-x86 (Android 8.1) and pie-x86 (Android 9),
> > but we histocally know since Lollipop that building mesa
> > with asm optimization induces text relocations in libglapi shared library
> > and the specific problem affects 32bit builds
> >
> > Here is the build log where '--warn-shared-textrel' is visible for
> > target libglapi.so,
> > please Tapani could you provide the corresponding section of your build
> log?
> > (There may be clues about the reason you are not getting the error)
>
> I've made a celadon P build today and put the build log here:
>
> http://tpalli.kapsi.fi/build_log.tgz
>
> This is not complete image but builds the mesa parts, you can see that
> libglapi is being built both for 32bit and 64bit in the log.
>
In our scenario the text relocations happen when building android-x86 32bit
user space on 32bit kernel,
in your build log you are building x86_64 target, where we also don't get
any issue.
Could you please try, when you have time (and no hurry) to build Celadon P
32bit user space on 32bit kernel?
I'd really like to use asm optimizations if now possible
As additional info here is the android-x86-development thread were all
attempst to use -fPIC, -DPIC were failed,
in our experience the 32bit user space will just refuse to use the
libglapi.so with Text Relocations:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/android-x86-devel/qO9gtkyE_PU/9fUan0VjCAAJ
Then if Celadon P can build libglapi.so without Text Relocations for 32bit
user space on 32bit kernel,
how is it done? We have this problem since Android nougat-x86
Thanks (and sorry in case I'm doing something wrong)
Mauro
>
> > [ 1% 5/326] target SharedLib: libglapi
> >
> (out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/LINKED/libglapi.so)
> > FAILED:
> >
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/LINKED/libglapi.so
>
> >
> > /bin/bash -c "prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++
> > -nostdlib -Wl,-soname,libglapi.so -Wl,--gc-sections -shared
> > out/target/product/x86/obj/lib/crtbegin_so.o
> >
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/entry.o
> >
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/mapi_glapi.o
>
> >
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/stub.o
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/table.o
> >
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/u_current.o
>
> >
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/u_execmem.o
>
> > -Wl,--whole-archive -Wl,--no-whole-archive
> >
> out/target/product/x86/obj/STATIC_LIBRARIES/libclang_rt.ubsan_minimal-i686-android_intermediates/libclang_rt.ubsan_minimal-i686-android.a
>
> >
> out/target/product/x86/obj/STATIC_LIBRARIES/libcompiler_rt-extras_intermediates/libcompiler_rt-extras.a
>
> out/target/product/x86/obj/STATIC_LIBRARIES/libatomic_intermediates/libatomic.a
> out/target/product/x86/obj/STATIC_LIBRARIES/libgcc_intermediates/libgcc.a
> -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5
> -Wl,*--warn-shared-textrel *-Wl,--fatal-warnings -Wl,--no-undefined-version
> -Wl,--hash-style=gnu -m32 -target i686-linux-android
> -Bprebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/bin
> -Wl,--exclude-libs,libclang_rt.ubsan_minimal-i686-android.a
> -Wl,--no-undefined out/target/product/x86/obj/lib/libdrm.so
> out/target/product/x86/obj/lib/libc++.so
> out/target/product/x86/obj/lib/libc.so
> out/target/product/x86/obj/lib/libm.so
> out/target/product/x86/obj/lib/libdl.so -o
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/LINKED/libglapi.so
> out/target/product/x86/obj/lib/crtend_so.o"
> >
> prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/bin/ld:
>
> > warning: shared library text segment is not shareable
> >
> prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/bin/ld:
>
> > error: treating warnings as errors
> > clang-6.0: error: linker command failed with exit code 1 (use -v to see
> > invocation)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190815/ff3b0c1e/attachment-0001.html>
More information about the mesa-dev
mailing list