Skip to contentSkip to conversation

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

PATCH New Vicente Olivert Riera 2 participants 6 messages May 31, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mesa3d: use -mno-compact-eh for Code Sourcery MIPS

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/

---
 package/mesa3d/mesa3d.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/mesa3d/mesa3d.mk +8 -0
index 3c98f8d..b47fada 100644
@@ -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
Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/1 mesa3d: use -mno-compact-eh for Code Sourcery MIPS

Hello,

package/mesa3d/mesa3d.mk MESA3D_DEPENDENCIES = \ · line 31

Quoted 7 lines · Vicente Olivert Riera
package/mesa3d/mesa3d.mk +7 -0
+# 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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 mesa3d: use -mno-compact-eh for Code Sourcery MIPS

Hello Thomas,

Quoted 4 lines · Thomas Petazzoni

Hello,

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

Quoted 11 lines

package/mesa3d/mesa3d.mk MESA3D_DEPENDENCIES = \ · line 31

Quoted 7 lines
package/mesa3d/mesa3d.mk +7 -0
+# 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.

Quoted 3 lines

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.

Quoted 4 lines

Thanks,

Thomas

#3 lore raw

PATCH 1/1 mesa3d: use -mno-compact-eh for Code Sourcery MIPS

Hello,

Quoted 9 lines · Vicente Olivert Riera
Quoted 3 lines

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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 mesa3d: use -mno-compact-eh for Code Sourcery MIPS

Hello Thomas,

Quoted 8 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · Vicente Olivert Riera
Quoted 3 lines

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.

Quoted 8 lines
Quoted 5 lines

-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?

Quoted 3 lines

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...

Quoted 3 lines

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.

Quoted 4 lines

Best regards,

Thomas

#5 lore raw

PATCH 1/1 mesa3d: use -mno-compact-eh for Code Sourcery MIPS

In reply to Vicente Olivert Riera

Hello,

Quoted 13 lines · Vicente Olivert Riera

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.

Quoted 8 lines

Fixes:

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

---
 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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com