differences in IR and ELF?

I'm trying to create a GlobalVariable that is a ConstantArray. Id like
each element to be a pointer to other things in the program(global
variables, functions). So that they all have the same type Id like to
make the elements void pointers.

I think I am going about this wrong, heres how I am doing it:

void writeArray(Module &M, GlobalVariable *shadow, Function *val,
                      Function *func) {
               /* Build up contents */
               vector<Constant *> v_elements;
               Type *elm_type = Type::getInt32PtrTy(M.getContext());

               Constant *tmp = dyn_cast<Constant>(shadow);
               assert(tmp != NULL && "shadow");
               v_elements.push_back(ConstantExpr::getBitCast(tmp, elm_type));

               tmp = dyn_cast<Constant>(val);
               assert(tmp != NULL && "value");
               v_elements.push_back(ConstantExpr::getBitCast(tmp, elm_type));

               tmp = dyn_cast<Constant>(func);
               assert(tmp != NULL && "function");
               v_elements.push_back(ConstantExpr::getBitCast(tmp, elm_type));

               /* Create array */
               ArrayRef<Constant *> a_elements(v_elements);
               ArrayType *type = ArrayType::get(elm_type, 3);
               Constant *array = ConstantArray::get(type, a_elements);

               /* Make new GlobalVariable from array */
               GlobalVariable *global = new GlobalVariable(M, type, true,

        my_linkage, array,

        "my array");
               global->setSection(*my_section);
}

The IR looks like this:
@"my array" = constant [3 x i32*] [i32* bitcast (i32 (i32)** @"Shadow
Variable for ptr1" to i32*), i32* bitcast (i32 (i32)* @f2 to i32*),
i32* bitcast (i32 (i32)* @f1 to i32*)], section "my_section"
@"my array2" = constant [3 x i32*] [i32* bitcast (i32 (i32)** @"Shadow
Variable for ptr1" to i32*), i32* bitcast (i32 (i32)* @f1 to i32*),
i32* bitcast (i32 ()* @main to i32*)], section "my_section"

The ELF section is too large. It does not look like padding, it looks
like more are being created and I don't know why.

Hi,

How large is the section? How large should it be? Can you post an objdump -r
of it?

Cheers,

James

Contents of section my_section:
400890 c3666666 6666662e 0f1f8400 00000000 .ffffff…
4008a0 38106000 00000000 b0064000 00000000 8........@..... 4008b0 d0064000 00000000 0f1f8400 00000000 ..@............. 4008c0 38106000 00000000 d0064000 00000000 8.…@…
4008d0 30074000 00000000 0.@…

This seems too big and doesn’t make sense considering the IR.