[m-rev.] preliminary review: Removing dead code at link time.
Julien Fischer
jfischer at opturion.com
Fri Aug 8 11:57:46 AEST 2014
On Fri, 8 Aug 2014, Peter Wang wrote:
>>> We enable `--split-sections' when building the runtime and standard
>>> library.
>>>
>>> On Linux/x86-64, `hello' goes from 4.1 MiB to 663 KiB in size
>>> and `mercury_compile' goes from 16 MiB to 13 MiB.
>>> (both statically linked to the Mercury libraries and stripped)
>>>
>>> configure.ac:
>>> scripts/Mercury.config.in:
>>> Set CFLAGS_FOR_SPLIT_SECTIONS for gcc or clang. gcc has
>>> supported `-ffunction-sections -fdata-sections' since at least
>>> 2.95.3, and clang as of 2010, so probably long enough.
>>>
>>> Set LD_GC_SECTIONS_FLAG after testing if "-Wl,--gc-sections"
>>> works.
>>> XXX -dead_strip on Darwin?
>>
>> I'll look into the Darwin side of things after you commit.
>
> Can you check if -ffunction-sections -fdata-sections
> does anything at all?
They don't appear to do anything; documentation says that they are only
meaningful for ELF object files.
Cheers,
Julien.
More information about the reviews
mailing list