Results of the FreeBSD Ports build with CC=clang

-O4: You could patch the packages, although I'm slightly hesitant to
suggest that... anyone have any better suggestions?

This is tricky. I wonder if there is some magic that the clang driver
can do for -O4 when the linker doesn't support LTO?


Issue is that second -O4 is being picked up and the first one is not ignored.
So you have duplicate optimization arguments being passed along with greater than 4.
Either it should be duplicate error or second one should be ignored that is probably what gcc is doing.
cc -O2 -pipe -fno-strict-aliasing -O4 -I/src -DVAD1 -std=gnu99 -fstack-protector -c sp_enc.c

cc -O2 -pipe -fno-strict-aliasing -O6 -Wall -W -pedantic -c stmpclean.c
clang-cc: for the -O option: : '6' invalid optimization level! *** Error code 1