diff --git a/mozglue/linker/moz.build b/mozglue/linker/moz.build index 4dc6ac0dd1d5..5204347c3bd1 100644 --- a/mozglue/linker/moz.build +++ b/mozglue/linker/moz.build @@ -21,17 +21,7 @@ DEFINES['IMPL_MFBT'] = True DisableStlWrapping() -# Avoid building the linker tests if building with icecc since it doesn't deal -# well with .incbin. -# -# A better solution would be to set ICECC=no in the environment before building -# these objects to force the local build, but moz.build lacks such a capability -# at the moment. -# -# TODO: Remove this when https://github.com/icecc/icecream/pull/463 is merged -# and in a release. -if not CONFIG['CXX_IS_ICECREAM']: - TEST_DIRS += ['tests'] +TEST_DIRS += ['tests'] if CONFIG['CC_TYPE'] in ('clang', 'gcc'): CXXFLAGS += ['-Wno-error=shadow'] diff --git a/mozglue/linker/tests/TestZip.cpp b/mozglue/linker/tests/TestZip.cpp index ac5372a11365..a2d2b10bdd5d 100644 --- a/mozglue/linker/tests/TestZip.cpp +++ b/mozglue/linker/tests/TestZip.cpp @@ -11,37 +11,14 @@ Logging Logging::Singleton; -/** - * ZIP_DATA(FOO, "foo") defines the variables FOO and FOO_SIZE. - * The former contains the content of the "foo" file in the same directory - * as this file, and FOO_SIZE its size. - */ -/* clang-format off */ -#define ZIP_DATA(name, file) \ - __asm__(".global " #name "\n" \ - ".data\n" \ - ".balign 16\n" \ - #name ":\n" \ - " .incbin \"" SRCDIR "/" file "\"\n" \ - ".L" #name "_END:\n" \ - " .size " #name ", .L" #name "_END-" #name \ - "\n" \ - ".global " #name "_SIZE\n" \ - ".data\n" \ - ".balign 4\n" \ - #name "_SIZE:\n" \ - " .int .L" #name "_END-" #name "\n"); \ - extern const unsigned char name[]; \ - extern const unsigned int name##_SIZE -/* clang-format on */ - /** * test.zip is a basic test zip file with a central directory. It contains * four entries, in the following order: * "foo", "bar", "baz", "qux". * The entries are going to be read out of order. */ -ZIP_DATA(TEST_ZIP, "test.zip"); +extern const unsigned char TEST_ZIP[]; +extern const unsigned int TEST_ZIP_SIZE; const char* test_entries[] = {"baz", "foo", "bar", "qux"}; /** @@ -58,7 +35,8 @@ const char* test_entries[] = {"baz", "foo", "bar", "qux"}; * zipalign if it had a data descriptor originally. * - Fourth entry is a file "d", STOREd. */ -ZIP_DATA(NO_CENTRAL_DIR_ZIP, "no_central_dir.zip"); +extern const unsigned char NO_CENTRAL_DIR_ZIP[]; +extern const unsigned int NO_CENTRAL_DIR_ZIP_SIZE; const char* no_central_dir_entries[] = {"a", "b", "c", "d"}; TEST(Zip, TestZip) diff --git a/mozglue/linker/tests/TestZipData.S b/mozglue/linker/tests/TestZipData.S new file mode 100644 index 000000000000..5fbb82545197 --- /dev/null +++ b/mozglue/linker/tests/TestZipData.S @@ -0,0 +1,17 @@ +.macro zip_data name, path + .global \name + .data + .balign 16 + \name: + .incbin "\path" + .L\name\()_END: + .size \name, .L\name\()_END-\name + .global \name\()_SIZE + .data + .balign 4 + \name\()_SIZE: + .int .L\name\()_END-\name +.endm + +zip_data TEST_ZIP, "test.zip" +zip_data NO_CENTRAL_DIR_ZIP, "no_central_dir.zip" diff --git a/mozglue/linker/tests/moz.build b/mozglue/linker/tests/moz.build index 29b0e6e428ce..f2470dbbbeb0 100644 --- a/mozglue/linker/tests/moz.build +++ b/mozglue/linker/tests/moz.build @@ -11,9 +11,13 @@ UNIFIED_SOURCES += [ 'TestZip.cpp', ] +SOURCES += [ + 'TestZipData.S', +] + LOCAL_INCLUDES += ['..'] if CONFIG['CC_TYPE'] in ('clang', 'gcc'): CXXFLAGS += ['-Wno-error=shadow'] -DEFINES['SRCDIR'] = '"%s"' % SRCDIR +ASFLAGS += ['-I', SRCDIR]