Closed Bug 638149 Opened 9 years ago Closed 9 years ago

Need a way to disable -dead_strip on OS X


(Firefox Build System :: General, defect)

Not set


(Not tracked)



(Reporter: espindola, Assigned: espindola)



(Whiteboard: fixed-in-bs)


(1 file, 2 obsolete files)

The current OS X linker crashes if using both LTO and -dead_strip, so we need a way to disable -dead_strip.
I'd rather not add more configure options. Can you just detect that you're using LTO and not use dead strip in that case?
Not sure if in a reliable way. There are many ways to enable it. With clang you can use -O4, -flto or -emit-llvm. GCC has -flto and I think -fwhopr.

For clang the most reliable is probably to test the type of file the compiler produces, but gcc uses native files with extra sections containing the IL. Should I just ignore newer GCCs on OS X for now?

Another option would be adding a test that crashes -dead_strip, but I never managed to get a small enough test to include in a configure.

I will also try xcode 4 to see if that linker is fixed. If it is, it might not be worth it to add the option.
Unfortunately the linker in xcode4 still fails :-(
Attached patch alternative patch (obsolete) — Splinter Review
This patch adds a macro for checking for LTO and uses that to disable -dead_stip. It currently only handles LLVM based compilers, but could be extended if anyone is interested in trying gcc.
Attachment #516302 - Attachment is obsolete: true
Attachment #516506 - Flags: review?(ted.mielczarek)
Comment on attachment 516506 [details] [diff] [review]
alternative patch

Funky, but sounds ok. Can we call it MOZ_LLVM_LTO_ENABLED or something like that? MOZ_CHECK_LLVM_LTO ? Also, is there an existing autoconf macro to get the assembly output from a compile? I guess it's hard to say since we're using such an ancient autoconf...
Attachment #516506 - Flags: review?(ted.mielczarek) → review+
Assignee: nobody → respindola
This is avoiding a bug in the linker, so I assume it could also hit gcc's lto. In which case they just have to extend this macro.

I can only do copy-and-paste programming with m4, so I don't know if there is an autoconf macro available, but I didn't notice one in the existing configure source code.
Okay. That's fine.
Sorry, the previous patch was missing a change to js/src/aclocal.m4
Attachment #516506 - Attachment is obsolete: true
Attachment #523933 - Flags: review?(ted.mielczarek)
Attachment #523933 - Flags: review?(ted.mielczarek) → review+
Keywords: checkin-needed
Whiteboard: not-ready
Keywords: checkin-needed
Whiteboard: fixed-in-bs
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
Blocks: 653246
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.