Statically linking a small piece of C into every GHC generated binary

2011-07-19 Thread Johan Tibell
Hi, I'm trying to add support for the POPCNT instruction, which exists on some modern CPUs (e.g. Nehalem). The idea is to add a popCnt# primop which would generate a POPCNT instruction when compiling with -msse4.2. If the user didn't specified -msse4.2, the primop should fall back to some other im

Re: Statically linking a small piece of C into every GHC generated binary

2011-07-19 Thread Johan Tibell
On Tue, Jul 19, 2011 at 6:02 PM, Johan Tibell wrote: > I've implemented the primop but run into some difficulty: to use the > above fallback I need the code to be statically linked into every > binary. I'm not quite sure how to achieve that. If dynamic linking doesn't hurt performance (too much).

Re: Statically linking a small piece of C into every GHC generated binary

2011-07-19 Thread Niklas Larsson
2011/7/19 Johan Tibell : > On Tue, Jul 19, 2011 at 6:02 PM, Johan Tibell wrote: >> I've implemented the primop but run into some difficulty: to use the >> above fallback I need the code to be statically linked into every >> binary. I'm not quite sure how to achieve that. > > If dynamic linking doe