Closed Bug 1540079 Opened 6 months ago Closed 6 months ago

Firefox NSPR build on Solaris SPARC need to include os_SunOS_sparcv9.s

Categories

(Firefox Build System :: General, defect)

Other
Other
defect
Not set

Tracking

(firefox68 fixed)

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: petr.sumbera, Assigned: petr.sumbera)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0

Steps to reproduce:

Build on Solaris sparc fails with:

gmake[1]: Entering directory '/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/security/nss/cmd/modutil/modutil_modutil'
security/nss/cmd/modutil/modutil
/usr/bin/g++ -o ../../../../../dist/bin/modutil -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wc++1z-compat -Wduplicated-cond -Wimplicit-fallthrough -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wformat -Wformat-overflow=2 -fno-sized-deallocation -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O -fno-omit-frame-pointer -funwind-tables @/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/security/nss/cmd/modutil/modutil_modutil/modutil.list -lpthread -fstack-protector-strong -Wl,-z,text -L/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/dist/bin -pie ../../../../../config/external/nspr/pr/libnspr4.so ../../../../../config/external/nspr/libc/libplc4.so ../../../../../config/external/nspr/ds/libplds4.so ../../../lib/nss/nss_nss3/libnss3.so ../../../lib/util/util_nssutil3/libnssutil3.so ../../../lib/smime/smime_smime3/libsmime3.so ../../../lib/ssl/ssl_ssl3/libssl3.so -lsocket
-lpthread -lz
Undefined first referenced
symbol in file
_MD_AtomicAdd ../../../../../config/external/nspr/pr/libnspr4.so
_MD_AtomicSet ../../../../../config/external/nspr/pr/libnspr4.so
_MD_AtomicIncrement ../../../../../config/external/nspr/pr/libnspr4.so
_MD_AtomicDecrement ../../../../../config/external/nspr/pr/libnspr4.so
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
gmake[1]: *** [/builds/psumbera/FIREFOX-TRUNK/config/rules.mk:527: ../../../../../dist/bin/modutil] Error 1

This is due not included os_SunOS_sparcv9.s assembler file which defines _MD_Atomic*.

With following change:

--- a/config/external/nspr/pr/moz.build Mon Mar 25 07:27:45 2019 -0700
+++ b/config/external/nspr/pr/moz.build Fri Mar 29 02:43:46 2019 -0700
@@ -73,6 +73,8 @@
SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s']
elif CONFIG['CPU_ARCH'] == 'x86':
SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86.s']

  • elif CONFIG['CPU_ARCH'] == 'sparc64':
  •    SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s']
    

elif CONFIG['OS_TARGET'] == 'WINNT':
OS_LIBS += [
'advapi32',

It fails like this:

gmake[1]: Entering directory '/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/config/external/nspr/pr'
/usr/bin/gcc -std=gnu99 -o os_SunOS_sparcv9.o -fPIC -Wa,--noexecstack -include /builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/mozilla-config.h -DMOZILLA_CLIENT -g -c /builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s
/builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s: Assembler messages:
/builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:41: Error: Unknown opcode: entry(_MD_AtomicIncrement)' /builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:54: Error: Unknown opcode:set_size(_MD_AtomicIncrement)'
/builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:85: Error: Unknown opcode: entry(_MD_AtomicDecrement)' /builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:98: Error: Unknown opcode:set_size(_MD_AtomicDecrement)'
/builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:128: Error: Unknown opcode: entry(_MD_AtomicSet)' /builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:140: Error: Unknown opcode:set_size(_MD_AtomicSet)'
/builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:156: Error: Unknown opcode: entry(_MD_AtomicAdd)' /builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/src/md/unix/os_SunOS_sparcv9.s:169: Error: Unknown opcode:set_size(_MD_AtomicAdd)'
gmake[1]: *** [/builds/psumbera/FIREFOX-TRUNK/config/rules.mk:764: os_SunOS_sparcv9.o] Error 1
gmake[1]: Leaving directory '/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/config/external/nspr/pr'
gmake: *** [/builds/psumbera/FIREFOX-TRUNK/config/rules.mk:400: default] Error 2

The reason is that NSPR build system uses Solaris linker:

/usr/ccs/bin/as -o os_SunOS_sparcv9.o -K PIC -P -D_ASM -D__STDC__=0 -xarch=v9 /builds2/psumbera/userland-glib/components/nspr/nspr-4.19/nspr/pr/src/md/unix/os_SunOS_sparcv9.s

Where Solaris bundled GCC now for some use GNU as.

Probably the best fix is to modify moz.build somehow so that final backend.mk includes:

AS=/usr/ccs/bin/as
AS_DASH_C_FLAG=
COMPUTED_ASFLAGS += -K PIC -P -D_ASM -D__STDC__=0 -xarch=v9

Other possibility I use now is to modify os_SunOS_sparcv9.s so that it can be processed by GNU assembler (but this would need to be fixed in NSPR upstream which might be complicated - if it's expected to build with Solaris Studio compiler too).

Is it's possible to change AS, AS_DASH_C_FLAG and COMPUTED_ASFLAGS in config/external/nspr/pr/moz.build somehow? Thank you!

Flags: needinfo?(mh+mozilla)
Component: Untriaged → General
OS: Unspecified → Other
Product: Firefox → Firefox Build System
Hardware: Unspecified → Other

What are the values of those variables before you modify them? Does it work if you rename the .s file to .S (caps)?

Flags: needinfo?(mh+mozilla)

(In reply to Mike Hommey [:glandium] from comment #4)

What are the values of those variables before you modify them?

Not sure how to find out.

Does it work if you rename the .s file to .S (caps)?

No difference.

--

I can add in moz.build following:

ASFLAGS = ['AAA']

And I see in obj-sparc64-sun-solaris2.11/config/external/nspr/pr/backend.mk:

COMPUTED_ASFLAGS += -fPIC -Wa,--noexecstack -include /builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/mozilla-config.h -DMOZILLA_CLIENT -g AAA

(it's not cleared it, just added at the end)

gmake[1]: Entering directory '/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/config/external/nspr/pr'
config/external/nspr/pr/os_SunOS_sparcv9.o
/usr/bin/gcc -std=gnu99 -o os_SunOS_sparcv9.o -DDEBUG=1 -D_NSPR_BUILD_ -D_PR_INET6 -DHAVE_FCNTL_FILE_LOCKING -D_PR_HAVE_OFF64_T -DHAVE_SOCKLEN_T -DSOLARIS -D_PR_PTHREADS -fPIC -Wa,--noexecstack -include /builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/mozilla-config.h -DMOZILLA_CLIENT -g -I/builds/psumbera/FIREFOX-TRUNK/config/external/nspr -I/builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/include -I/builds/psumbera/FIREFOX-TRUNK/nsprpub/pr/include/private AAA -c /builds/psumbera/FIREFOX-TRUNK/config/external/nspr/pr/../../../../nsprpub/pr/src/md/unix/os_SunOS_sparcv9.S

--

I cannot add AS at all:

0:25.72 The error occurred while processing the following file:
0:25.72
0:25.72 /builds/psumbera/FIREFOX-TRUNK/config/external/nspr/pr/moz.build
0:25.72
0:25.72 The error was triggered on line 78 of this file:
0:25.72
0:25.72 AS = ['BBB']
0:25.72
0:25.72 The underlying problem is an attempt to write a reserved UPPERCASE variable that does not exist.
0:25.72
0:25.72 The variable write causing the error is:
0:25.72
0:25.72 AS
0:25.72
0:25.72 Please change the file to not use this variable.
0:25.72
0:25.72 For reference, the set of valid variables is:
0:25.72
0:25.72 A11Y_MANIFESTS, ANDROID_INSTRUMENTATION_MANIFESTS, ASFLAGS, ASM_FLAGS, BROWSER_CHROME_MANIFESTS, CFLAGS, CMFLAGS, CMMFLAGS, COMPILE_FLAGS, CONFIGURE_DEFINE_FILES, CONFIGURE_SUBST_FILES, CPP_UNIT_TESTS, CRAMTEST_MANIFESTS, CRASHTEST_MANIFESTS, CXXFLAGS, DEFFILE, DEFINES, DELAYLOAD_DLLS, DIRS, DIST_INSTALL, DIST_SUBDIR, EXPORTS, EXTRA_DSO_LDOPTS, FILES_PER_UNIFIED_FILE, FINAL_LIBRARY, FINAL_TARGET, FINAL_TARGET_FILES, FINAL_TARGET_PP_FILES, FIREFOX_UI_FUNCTIONAL_MANIFESTS, FIREFOX_UI_UPDATE_MANIFESTS, FORCE_SHARED_LIB, FORCE_STATIC_LIB, GENERATED_EVENTS_WEBIDL_FILES, GENERATED_FILES, GENERATED_WEBIDL_FILES, GN_DIRS, GYP_DIRS, HAS_MISC_RULE, HOST_CFLAGS, HOST_COMPILE_FLAGS, HOST_CXXFLAGS, HOST_DEFINES, HOST_LIBRARY_NAME, HOST_OS_LIBS, HOST_PROGRAM, HOST_RUST_LIBRARY_FEATURES, HOST_RUST_PROGRAMS, HOST_SIMPLE_PROGRAMS, HOST_SOURCES, HOST_USE_LIBS, IPDL_SOURCES, IS_FRAMEWORK, IS_RUST_LIBRARY, JAR_MANIFESTS, LDFLAGS, LIBRARY_DEFINES, LIBRARY_NAME, LINK_FLAGS, LOCALIZED_FILES, LOCALIZED_GENERATED_FILES, LOCALIZED_PP_FILES, LOCAL_INCLUDES, MARIONETTE_GPU_MANIFESTS, MARIONETTE_LAYOUT_MANIFESTS, MARIONETTE_UNIT_MANIFESTS, METRO_CHROME_MANIFESTS, MOCHITEST_CHROME_MANIFESTS, MOCHITEST_MANIFESTS, NO_COMPONENTS_MANIFEST, NO_EXPAND_LIBS, NO_PGO, OBJDIR_FILES, OBJDIR_PP_FILES, OS_LIBS, PREPROCESSED_IPDL_SOURCES, PREPROCESSED_TEST_WEBIDL_FILES, PREPROCESSED_WEBIDL_FILES, PROGRAM, PUPPETEER_FIREFOX_MANIFESTS, PYTHON_UNITTEST_MANIFESTS, RCFILE, RCINCLUDE, REFTEST_MANIFESTS, RESFILE, RUST_LIBRARY_FEATURES, RUST_LIBRARY_OUTPUT_CATEGORY, RUST_LIBRARY_TARGET_DIR, RUST_PROGRAMS, RUST_TESTS, RUST_TEST_FEATURES, SHARED_LIBRARY_NAME, SHARED_LIBRARY_OUTPUT_CATEGORY, SIMPLE_PROGRAMS, SONAME, SOURCES, SPHINX_PYTHON_PACKAGE_DIRS, SPHINX_TREES, STATIC_LIBRARY_NAME, SYMBOLS_FILE, TEST_HARNESS_FILES, TEST_WEBIDL_FILES, UNIFIED_SOURCES, USE_EXTENSION_MANIFEST, USE_LIBS, USE_NASM, USE_STATIC_LIBS, USE_YASM, WEBIDL_EXAMPLE_INTERFACES, WEBIDL_FILES, WEBRTC_SIGNALLING_TEST_MANIFESTS, WIN32_EXE_LDFLAGS, XPCOM_MANIFESTS, XPCSHELL_TESTS_MANIFESTS, XPIDL_MODULE, XPIDL_SOURCES, XPI_NAME

Flags: needinfo?(mh+mozilla)

(In reply to Petr Sumbera from comment #5)

(In reply to Mike Hommey [:glandium] from comment #4)

What are the values of those variables before you modify them?

Not sure how to find out.

make -C directory echo-variable-AS echo-variable-ASFLAGS etc.

Does it work if you rename the .s file to .S (caps)?

No difference.

Something doesn't add up to me. Presumably, ENTRY is defined in sys/asm_linkage.h. Why does the error suggest it's not expanded? Likewise for SET_SIZE. We do have .S (caps) files with includes that work. (and .S vs .s is the differentiator for preprocessed vs. non-preprocessed)

Flags: needinfo?(mh+mozilla)

(In reply to Mike Hommey [:glandium] from comment #6)

make -C directory echo-variable-AS echo-variable-ASFLAGS etc.

$ gmake -C obj-sparc64-sun-solaris2.11/config/external/nspr/pr echo-variable-AS echo-variable-ASFLAGS echo-variable-AS_DASH_C_FLAG
gmake: Entering directory '/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/config/external/nspr/pr'
/usr/bin/gcc -std=gnu99
-fPIC -Wa,--noexecstack -include /builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/mozilla-config.h -DMOZILLA_CLIENT -g
-c
gmake: Leaving directory '/builds/psumbera/FIREFOX-TRUNK/obj-sparc64-sun-solaris2.11/config/external/nspr/pr'

But how to change these?

Does it work if you rename the .s file to .S (caps)?

No difference.

Something doesn't add up to me. Presumably, ENTRY is defined in sys/asm_linkage.h. Why does the error suggest it's not expanded? Likewise for SET_SIZE. We do have .S (caps) files with includes that work. (and .S vs .s is the differentiator for preprocessed vs. non-preprocessed)

There is actually some difference between '.s' and '.S'. With capital S there are several more errors. And it turned out that it includes sys/stack.h which contains:

#if !defined(_ASM)

#include <sys/types.h>

#endif

--

So after adding -D_ASM it compiles even with gcc. And to avoid need to change .s to .S we can use -x assembler-with-cpp.

I will send review request shortly. Thank you for your help!

Keywords: checkin-needed

Pushed by ncsoregi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7295967255ec
Firefox NSPR build on Solaris SPARC need to include os_SunOS_sparcv9.s r=glandium

Keywords: checkin-needed
Status: UNCONFIRMED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Assignee: nobody → petr.sumbera
You need to log in before you can comment on or make changes to this bug.