[PATCH] D41207: Rename --icf-data and add a corresponding flag for functions

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 16:34:29 PST 2017


Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu added a comment.
>
> There exists -icf=all, -icf=safe and -icf=none to choose ICF levels, and this patch adds other flags (-ignore-{data,function}-address-equality) to control ICF levels. It doesn't seems like the new flags are in line with the existing options. I'd keep the existing notation which is -icf=<something>.
>
> If we use clang as a precedence, one candidate would be -icf=everything (just like -Weverything as opposed to -Wall) which would do more than -icf=all.

But with this patch the flags are not just about icf anymore.

One flag allows lld to ignore the pointer equality of functions. This
allows it to ICF two function so they now have the same address. It also
allows it to create a hack plt for a protected function from a .so so
that the main program and the .so don't agree on the address of that
function.

The other flag allows lld to ignore the pointer equality of read only
data. This allows it to ICF two constants. It also allows it create a
copy relocation to a read only data so that the main program and the
shared library don't agree on the address.

Cheers,
Rafael


More information about the llvm-commits mailing list