diff mbox

mesa3d: use -mno-compact-eh for Code Sourcery MIPS

Message ID 1464689755-63804-1-git-send-email-Vincent.Riera@imgtec.com
State Accepted
Headers show

Commit Message

Vicente Olivert Riera May 31, 2016, 10:15 a.m. UTC
mesa3d doesn't like the new compressed exception handling of the Code
Sourcery MIPS toolchain and it fails to compile with an error like this
one:

/br/output/host/opt/ext-toolchain/bin/../lib/gcc/mips-linux-gnu/5.3.0/../../../../mips-linux-gnu/bin/ld:
../../../../src/mesa/.libs/libmesagallium.a(ir_to_mesa.o):
.eh_frame_entry not in order
/br/output/host/opt/ext-toolchain/bin/../lib/gcc/mips-linux-gnu/5.3.0/../../../../mips-linux-gnu/bin/ld:
final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

Using -mno-compact-eh fixes the problem.

Fixes:

  http://autobuild.buildroot.net/results/3cd/3cd81c57c51c0963ee6f4d9b814989460bb35316/

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/mesa3d/mesa3d.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Thomas Petazzoni May 31, 2016, 11:59 a.m. UTC | #1
Hello,

On Tue, 31 May 2016 11:15:55 +0100, Vicente Olivert Riera wrote:

> +# mesa3d doesn't like the new compressed exception handling of the Code
> +# Sourcery MIPS toolchain and it fails to compile. Using -mno-compact-eh
> +# fixes the problem.
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS),y)
> +MESA3D_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -mno-compact-eh"
> +MESA3D_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -mno-compact-eh"
> +endif

Isn't an upstreamable fix to mesa3d configure script a better solution?
See package/libffi/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch in
Buildroot.

Do you know when code can be built with this "Compact EH" feature and
when code cannot? I.e how many packages are going to be potentially
affected by this?

Thanks,

Thomas
Vicente Olivert Riera May 31, 2016, 2:28 p.m. UTC | #2
Hello Thomas,

On 31/05/16 12:59, Thomas Petazzoni wrote:
> Hello,
> 
> On Tue, 31 May 2016 11:15:55 +0100, Vicente Olivert Riera wrote:
> 
>> +# mesa3d doesn't like the new compressed exception handling of the Code
>> +# Sourcery MIPS toolchain and it fails to compile. Using -mno-compact-eh
>> +# fixes the problem.
>> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS),y)
>> +MESA3D_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -mno-compact-eh"
>> +MESA3D_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -mno-compact-eh"
>> +endif
> 
> Isn't an upstreamable fix to mesa3d configure script a better solution?
> See package/libffi/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch in
> Buildroot.

-mcompact-eh is only supported in Mentor tools currently. My patch is a
workaround for a broken toolchain feature. I'm not sure which
place is best. I suggest Buildroot is appropriate here as the issue is
specific to Mentor tools which are only used in cross compile
environments like Buildroot.

> Do you know when code can be built with this "Compact EH" feature and
> when code cannot? I.e how many packages are going to be potentially
> affected by this?

No, I believe this will be a toolchain bug. However Mentor have stopped
listing MIPS on their website so the chance of a fix seems low.

Regards,

Vincent.

> Thanks,
> 
> Thomas
>
Thomas Petazzoni May 31, 2016, 2:44 p.m. UTC | #3
Hello,

On Tue, 31 May 2016 15:28:38 +0100, Vicente Olivert Riera wrote:

> > Isn't an upstreamable fix to mesa3d configure script a better solution?
> > See package/libffi/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch in
> > Buildroot.  
> 
> -mcompact-eh is only supported in Mentor tools currently. My patch is a
> workaround for a broken toolchain feature. I'm not sure which
> place is best. I suggest Buildroot is appropriate here as the issue is
> specific to Mentor tools which are only used in cross compile
> environments like Buildroot.

Hum, OK. This should probably have been explained in the commit log
and/or in a comment above the workaround. But if indeed
-mcompact-eh/-mno-compact-eh are available only in the Mentor
toolchain, then your proposal is the most appropriate one.

Or, alternatively, we could simply add this as a forced CFLAGS when
this toolchain is used, which would also avoid the need for a similar
workaround in the libffi package.

Best regards,

Thomas
Vicente Olivert Riera May 31, 2016, 2:46 p.m. UTC | #4
Hello Thomas,

On 31/05/16 15:44, Thomas Petazzoni wrote:
> Hello,
> 
> On Tue, 31 May 2016 15:28:38 +0100, Vicente Olivert Riera wrote:
> 
>>> Isn't an upstreamable fix to mesa3d configure script a better solution?
>>> See package/libffi/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch in
>>> Buildroot.  
>>
>> -mcompact-eh is only supported in Mentor tools currently. My patch is a
>> workaround for a broken toolchain feature. I'm not sure which
>> place is best. I suggest Buildroot is appropriate here as the issue is
>> specific to Mentor tools which are only used in cross compile
>> environments like Buildroot.
> 
> Hum, OK. This should probably have been explained in the commit log
> and/or in a comment above the workaround.

Sorry about that. Care to amend the commit log if you finally apply this
patch?

> But if indeed
> -mcompact-eh/-mno-compact-eh are available only in the Mentor
> toolchain, then your proposal is the most appropriate one.

This for master...

> Or, alternatively, we could simply add this as a forced CFLAGS when
> this toolchain is used, which would also avoid the need for a similar
> workaround in the libffi package.

...and this for next?

Regards,

Vincent.

> Best regards,
> 
> Thomas
>
Thomas Petazzoni May 31, 2016, 7:11 p.m. UTC | #5
Hello,

On Tue, 31 May 2016 11:15:55 +0100, Vicente Olivert Riera wrote:
> mesa3d doesn't like the new compressed exception handling of the Code
> Sourcery MIPS toolchain and it fails to compile with an error like this
> one:
> 
> /br/output/host/opt/ext-toolchain/bin/../lib/gcc/mips-linux-gnu/5.3.0/../../../../mips-linux-gnu/bin/ld:
> ../../../../src/mesa/.libs/libmesagallium.a(ir_to_mesa.o):
> .eh_frame_entry not in order
> /br/output/host/opt/ext-toolchain/bin/../lib/gcc/mips-linux-gnu/5.3.0/../../../../mips-linux-gnu/bin/ld:
> final link failed: Nonrepresentable section on output
> collect2: error: ld returned 1 exit status
> 
> Using -mno-compact-eh fixes the problem.
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/3cd/3cd81c57c51c0963ee6f4d9b814989460bb35316/
> 
> Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> ---
>  package/mesa3d/mesa3d.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)

Applied to master after tweaking the comment in the code, as we
discussed. Thanks!

Thomas
diff mbox

Patch

diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index 3c98f8d..b47fada 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -22,6 +22,14 @@  MESA3D_DEPENDENCIES = \
 	expat \
 	libdrm
 
+# mesa3d doesn't like the new compressed exception handling of the Code
+# Sourcery MIPS toolchain and it fails to compile. Using -mno-compact-eh
+# fixes the problem.
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS),y)
+MESA3D_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -mno-compact-eh"
+MESA3D_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -mno-compact-eh"
+endif
+
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 MESA3D_DEPENDENCIES += openssl
 MESA3D_CONF_OPTS += --with-sha1=libcrypto