Closed Bug 1378605 Opened 7 years ago Closed 7 years ago

Elfhack supports android/clang

Categories

(Core :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: m_kato, Unassigned)

References

Details

Attachments

(1 file)

When using android/clang, we cannot build elfhack tool.  Because build/unix/elfhack/inject/Makefile.in removes clang's options unfortunately by $(filter ..) from CFLAGS.

 0:10.71 In file included from /mozilla/objdir-android/build/unix/elfhack/inject/arm.c:5:
 0:10.71 In file included from /home/makoto/bin/android-ndk-r15b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/stdint.h:63:
 0:10.71 In file included from /usr/include/stdint.h:25:
 0:10.71 /usr/include/features.h:364:12: fatal error: 'sys/cdefs.h' file not found
 0:10.71 #  include <sys/cdefs.h>
 0:10.71            ^~~~~~~~~~~~~


When resolving this build error, elfhack throws assertion for libplugin-container.so that is generated by clang.

 0:04.64 elfhack: /mozilla/mobile/build/unix/elfhack/elf.cpp:264: Elf::Elf(std::ifstream &): Assertion `segment->getFileSize() == phdr.p_filesz - gold_adjustment' failed.
 0:04.64 Traceback (most recent call last):
 0:04.64   File "/mozilla/mobile/toolkit/mozapps/installer/packager.py", line 326, in <module>
 0:04.64     main()
 0:04.64   File "/mozilla/mobile/toolkit/mozapps/installer/packager.py", line 320, in main
 0:04.64     copier.copy(args.destination)
 0:04.64   File "/mozilla/mobile/python/mozbuild/mozpack/copier.py", line 399, in copy
 0:04.64     copy_results.append((destfile, f.copy(destfile, skip_if_older)))
 0:04.64   File "/mozilla/mobile/python/mozbuild/mozpack/files.py", line 287, in copy
 0:04.64     elfhack(dest)
 0:04.64   File "/mozilla/mobile/python/mozbuild/mozpack/executables.py", line 124, in elfhack
 0:04.64     errors.fatal('Error executing ' + ' '.join(cmd))
 0:04.64   File "/mozilla/mobile/python/mozbuild/mozpack/errors.py", line 103, in fatal
 0:04.64     self._handle(self.FATAL, msg)
 0:04.64   File "/mozilla/mobile/python/mozbuild/mozpack/errors.py", line 98, in _handle
 0:04.64     raise ErrorMessage(msg)
 0:04.64 mozpack.errors.ErrorMessage: Error: Error executing /mozilla/objdir-android/build/unix/elfhack/elfhack ../../../dist/geckoview/lib/armeabi-v7a/libplugin-container.so
Attached file libplugin-container.so
I think some of the elfhack fixes that have been done for lld over the past few months have fixed this as well.  I no longer see the error messages from comment 0 when using --enable-elf-hack with local patches (none of which touch build/unix/elfhack/) and running `mach package`.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: