Closed Bug 300047 Opened 19 years ago Closed 19 years ago

Use -dead_strip as a linker flag for mac builds

Categories

(Firefox Build System :: General, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bryner, Assigned: bryner)

References

Details

Attachments

(1 file, 1 obsolete file)

-dead_strip works similarly to MSVC's /OPT:REF in that it discards all functions
and data which are not reachable from the exported functions of a binary.  This
allows us to strip out some of the "extra" constructors and destructors that are
emitted for classes, as well as functions that are just never called.  In my
test, this yields a couple hundred KB savings for a static firefox-bin.
Attached patch patch (obsolete) — Splinter Review
Attachment #188638 - Flags: review?(pinkerton)
Comment on attachment 188638 [details] [diff] [review]
patch

looks good, can we add this to camino's LD_FLAGS somewhere? or is it a checkbox
we can flip in the project?
Attachment #188638 - Flags: review?(pinkerton) → review+
What does this do to C++ static ctors/dtors? We still have a few in the code.
No idea.
Let's get this in at the beginning of the gecko 1.8b4 cycle.
Comment on attachment 188638 [details] [diff] [review]
patch

I'd like to get this in after 1.1a2.
Attachment #188638 - Flags: approval1.8b4?
Attachment #188638 - Flags: approval1.8b4? → approval1.8b4+
checked in
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
What are the effects on code size? Also, did anyopne figure out comment #3?
Some tinderboxen have older toolchains that don't know about -dead_strip.  This
should be backed out until the tinders are ready.  Adjusting blocking.
Status: RESOLVED → REOPENED
Depends on: 299214
Resolution: FIXED → ---
Check that the linker flag is supported before enabling it
Attachment #188638 - Attachment is obsolete: true
Attachment #189251 - Flags: review?(joshmoz)
(In reply to comment #8)
> What are the effects on code size?

My optimized builds shrank from 24.4MB to 23.7MB with this patch. A nice result,
and no problems in my limited testing so far. (I built with -Os, disabled
SVG/canvas/mathml)
Comment on attachment 189251 [details] [diff] [review]
patch with configure check

r=pink
Attachment #189251 - Flags: review?(joshmoz) → review+
checked in. note that atlantia, which does firefox nightlies, has new enough
build tools to support this option.
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → FIXED
Depends on: 327092
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: