Update CFLAGS and LDFLAGS.

Replace -fomit-frame-pointer (which is considered unsafe) with -g.
Together with the FEATURES="splitdebug compressdebug" we get useful
debug symbols without performance penalty.

Separate the --as-needed argument to make sure libtool recognizes it properly
(as it is already done in the Gentoo default profile).

Fix the link-optimization flag: 01 -> O1
Merge changes from upstream
Merge comments from upstream.