[cfe-commits] [PATCH] Recognize 'amd64' as an alias for 'x86_64' on FreeBSD

Dimitry Andric dimitry at andric.com
Tue May 24 02:50:55 PDT 2011

On FreeBSD, the arch in the arch-vendor-os triple is usually 'amd64'
instead of 'x86_64', e.g. amd64-unknown-freebsd9.0.

If somebody uses such a triple, the code in Clang::AddX86TargetArgs()
does not recognize the arch, so the default CPU name is not set to
x86-64, and interesting things can then happen.

In my case, clang assumed an incorrect 16-byte alignment for some global
structs, and started accessing them with SSE movaps instructions,
leading to bus errors at runtime, because the structs were really 8-byte

I would like to propose the attached patch, which makes clang recognize
both 'amd64' and 'x86_64', at least for FreeBSD.  Maybe this can also be
used for other operating systems, if that is desirable.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: freebsd-target-cpu-1.diff
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110524/20e1d6b1/attachment.ksh>

More information about the cfe-commits mailing list