def METHOD_NAME(ctx, is_library):
    if is_library:
        return []
    runtimes = [ctx.attr.link_extra_lib]
    if ctx.fragments.cpp.custom_malloc != None:
        runtimes.append(ctx.attr._default_malloc)
    else:
        runtimes.append(ctx.attr.malloc)
    return runtimes