[LLVMdev] Disabling special treatment of "malloc" function

Chris Smowton chris at smowton.net
Mon Sep 9 04:24:51 PDT 2013

On 08/09/13 16:36, Tim Northover wrote:
>> For now I've added a flag to MDA such that malloc clobbers rather than
>> resolving to undef; however I was wondering if there is a "proper" way to do
>> this with any compiler targeting LLVM?
> Clang has an option "-fno-builtin" that disables such assumptions (by
> adding the attribute "nobuiltin" to the relevant callsites by the
> looks of it). Is that useful to you?
That works; unfortunately I was using Dragonegg and would rather not 
switch at this point.

For the benefit of Googlers, it appears that Clang -fno-builtin leads to 
a call to TargetLibraryInfo::disableAllFunctions, but Dragonegg-3.2 
never calls it.

However Dragonegg-3.3 /does/ honour the GCC -fno-builtin flag (diff 
here: http://llvm.org/viewvc/llvm-project?view=revision&revision=179666).

This is a little blunt for my purposes -- I only need to disable malloc 
for this purpose, but it suffices.

(Side note: I hadn't realised a Dragonegg 3.3 release existed because 
http://dragonegg.llvm.org/ is out of date)


More information about the llvm-dev mailing list