Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 867878

Summary: s390 build fails with Error: Unrecognized opcode: `srak'
Product: Red Hat Enterprise Linux 6 Reporter: Martin Stransky <stransky>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.3CC: mcermak, mnewsome, mpolacek
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-4.4.7-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 10:26:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
preprocessed c source of hb-ot-shape-fallback.cc none

Description Martin Stransky 2012-10-18 13:34:49 UTC
Created attachment 629381 [details]
preprocessed c source of hb-ot-shape-fallback.cc

Description of problem:

When building firefox in brew, gcc fails with Error: Unrecognized opcode: `srak'. The same package builds on stable systems. Affects both s390 and s390x.

Complete build log:
http://download.devel.redhat.com/brewroot/work/tasks/2306/4982306/build.log

Gcc command:
c++ -o hb-ot-shape-fallback.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/config/gcc_hidden.h -DMOZ_GLUE_IN_PROGRAM -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DPACKAGE_VERSION="\"moz\"" -DPACKAGE_BUGREPORT="\"http://bugzilla.mozilla.org/\"" -DHAVE_OT=1 -DHB_NO_MT -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src -I. -I../../../dist/include  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nspr -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nss      -fPIC  -pedantic -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wcast-align -Wno-long-long -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fno-exceptions -fstack-protector --param=ssp-buffer-size=4 -m31 -march=z9-109 -mtune=z10 -fpermissive -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -g -Os -freorder-blocks  -fomit-frame-pointer   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/hb-ot-shape-fallback.o.pp -UDEBUG /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src/hb-ot-shape-fallback.cc
{standard input}: Assembler messages:
{standard input}:131: Error: Unrecognized opcode: `srak'

Version-Release number of selected component (if applicable):

http://download.devel.redhat.com/brewroot/work/tasks/2306/4982306/root.log

gcc                    s390    4.4.6-4.el6
binutils               s390    2.20.51.0.2-5.34.el6

Comment 1 Martin Stransky 2012-10-18 13:38:07 UTC
s390x failure:

Build log: 
http://download.devel.redhat.com/brewroot/work/tasks/1827/4991827/build.log

Root log:
http://download.devel.redhat.com/brewroot/work/tasks/1827/4991827/root.log

gcc command:
c++ -o hb-ot-shape-fallback.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/config/gcc_hidden.h -DMOZ_GLUE_IN_PROGRAM -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DPACKAGE_VERSION="\"moz\"" -DPACKAGE_BUGREPORT="\"http://bugzilla.mozilla.org/\"" -DHAVE_OT=1 -DHB_NO_MT -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src -I. -I../../../dist/include  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nspr -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nss      -fPIC  -pedantic -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wcast-align -Wno-long-long -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fno-exceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -march=z9-109 -mtune=z10 -fpermissive -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -g -Os -freorder-blocks  -fomit-frame-pointer   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/hb-ot-shape-fallback.o.pp -UDEBUG /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src/hb-ot-shape-fallback.cc
{standard input}: Assembler messages:
{standard input}:134: Error: Unrecognized opcode: `srak'

packages:
gcc                    s390x   4.4.6-4.el6
binutils               s390x   2.20.51.0.2-5.34.el6

Comment 2 Martin Stransky 2012-10-18 13:40:35 UTC
Note: build fine on stable systems with:

gcc-4.4.4-13.el6.s390x
binutils-2.20.51.0.2-5.11.el6.s390x

Comment 6 Martin Stransky 2012-10-18 14:47:44 UTC
Is there any workaround for that? It blocks upcoming Firefox update.

Comment 7 Jakub Jelinek 2012-10-18 14:51:04 UTC
Regression from RHEL 6.0 caused by #633375.

Comment 9 Jakub Jelinek 2012-10-18 15:22:31 UTC
As workaround I guess
 static inline void
 position_cluster (const hb_ot_shape_plan_t *plan,
 		  hb_font_t *font,
 		  hb_buffer_t  *buffer,
 		  unsigned int start,
 		  unsigned int end)
 {
+#ifdef __s390__
+  hb_unicode_general_category_t category;
+#endif
   if (end - start < 2)
     return;
 
   /* Find the base glyph */
   for (unsigned int i = start; i < end; i++)
     if (is_a_ligature (buffer->info[i]) ||
+#ifdef __s390__
+	((category = _hb_glyph_info_get_general_category (&buffer->info[i]))
+	 != HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK
+	 && category != HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK
+	 && category != HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+#else
         !(FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) &
 	  (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
 	   FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
- 	   FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))))
+ 	   FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
+#endif
	)
     {
       position_around_base (plan, font, buffer, i, end);
       break;
     }
 }

(completely untested) might do the trick, that way there will be no right shift
with shift count which is bitwise and.  Or store result of
 _hb_glyph_info_get_general_category into a temporary and do
  __asm ("" : "+r" (category)); on it before doing the FLAG test to prevent gcc from optimizing it.
So basically change the:
         !(FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) &
line to:
         !(FLAG (({ hb_unicode_general_category_t category = _hb_glyph_info_get_general_category (&buffer->info[i]); __asm ("" : "+g" (category)); category; })) &

Comment 12 Jakub Jelinek 2012-10-19 08:40:55 UTC
Short testcase:
int bar (char);

void
foo (char *x, unsigned int y)
{
  unsigned int i;
  for (i = 0; i < y; i++)
    if (bar (x[i]) || ((1 << (x[i] & 0x7f)) & 0x2314))
      break;
}
gcc -c -O2 -march=z9-109 test.c
should assemble without errors with gcc-4.4.7-3.el6, should fail with gcc-4.4.7-2.el6.  With -march=z196 it should succeed with both.

Comment 13 Martin Stransky 2012-10-26 09:27:16 UTC
The workaround works, thanks!

Comment 16 errata-xmlrpc 2013-02-21 10:26:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0420.html