Displaying 20 results from an estimated 400 matches similar to: "[LLVMdev] constructing global array of pointers?"
2011 Nov 24
1
[LLVMdev] 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,
2011 Nov 24
0
[LLVMdev] differences in IR and ELF?
Contents of section my_section:
400890 c3666666 6666662e 0f1f8400 00000000 .ffffff.........
4008a0 38106000 00000000 b0064000 00000000 8.`....... at .....
4008b0 d0064000 00000000 0f1f8400 00000000 .. at .............
4008c0 38106000 00000000 d0064000 00000000 8.`....... at .....
4008d0 30074000 00000000 0. at .....
This seems too big and doesn't make sense
2011 Oct 20
3
[LLVMdev] common type at compile time?
I'm trying to create a ConstantArray(whose contents will be of types
Function*, GlobalVariable *) so I can immediately create a new
GlobalVariable(that will be in its own section). I'm doing this so I
have these address stored. In order to create this ConstantArray I
need a valid ArrayType, but I'm not sure what to use for the element
type.
I want this to be done at compile time, so I
2011 Oct 20
0
[LLVMdev] common type at compile time?
On 10/20/11 10:43 AM, ret val wrote:
> I'm trying to create a ConstantArray(whose contents will be of types
> Function*, GlobalVariable *) so I can immediately create a new
> GlobalVariable(that will be in its own section). I'm doing this so I
> have these address stored. In order to create this ConstantArray I
> need a valid ArrayType, but I'm not sure what to use for
2011 Oct 20
2
[LLVMdev] common type at compile time?
I'm a bit confused. For the Type did you mean something like:
ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4);
This does not work, it gives me ""Wrong type in array element
initializer" at runtime.
Also it doesn't look like ConstantExpr inherits ConstantArray, so I'm
not sure how I could use this instead.
Thanks
On Thu, Oct 20, 2011 at
2011 Oct 20
0
[LLVMdev] common type at compile time?
On 10/20/11 11:34 AM, ret val wrote:
> I'm a bit confused. For the Type did you mean something like:
> ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4);
I assume that creates an ArrayType of 4 elements whose elements are
pointers to 8-bit values. If so, then this is what I meant.
> This does not work, it gives me ""Wrong type in array
2019 Feb 22
1
Create the GlobalVariable which have extern in one header file
I have changed it to ExternalLinkage. Now, in LLVM IR, it looks like that:
@DATA_TABLE = external global [0 x i8*], section "data_section", align 16 #0
@DATA_TABLE.1 = global [10 x i8*] [i8* inttoptr (i64 53415718 to i8*), i8* bitcast (void (%class.Hello*)* @_ZN5Hello5ptofnEv to i8*),...], section "data_section", align 16 #0
In my uses:
%arrayidx = getelementptr inbounds [0 x
2012 Oct 17
0
[LLVMdev] R_ARM_ABS32 disassembly with integrated-as
Hi Jim,
The diff below is not intended to be a patch, but a starting point.
It is the shortest path (I hope) to getting LLVM to emit ARM mapping
symbols to the ELF without changing any shared interfaces. Could you
have a look at the FIXME comments and offer some pointers on how to
get this code out of MCELFStreamer?
Thanks,
Greg
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp
2014 Mar 11
2
[LLVMdev] [RFC] Section Declarations in LLVM IR
Hi all,
I'd like to propose that LLVM IR have a mechanism to describe sections in a
more explicit way than we can today.
Currently, we provide an attribute called "section" on GlobalVariables and
Functions. This attribute will choose which section the Value will end up
in.
However, it does not describe the attributes of the section.
Without a way of describing the section, we try
2010 Oct 01
0
[LLVMdev] ARM/MC/ELF questions on .ARM.attributes section
> 1. What is the preferred method in MC to jump back to a prior section
> already defined? (Or is this not supported?)
SetSection in the MCStreamer if you really want to change the current
section, but maybe all that you need is to setSection in the Symbol?
Similar to what is done in MCELFStreamer::EmitCommonSymbol if the
binding is local.
> 2. It looks like the "correct" way
2011 Nov 13
0
[LLVMdev] setSection not working?
I created a GlobalVariable from a ConstantArray. I then used to the
setSection() method on my GlobalVariable. Looking at the ELF file it
does not look like it is where I specified. I gave "new
StringRef("my_map")" to the method.
Is there more that needs to be done? In case it matters this is ToT on Linux.
Thank you
2012 Dec 19
2
[LLVMdev] GetElementPtrConstantExpr
Ok, now it's arising another problem. IR code that I obtain is the
following:
i8* bitcast ([5 x i8] c"hello\00" to i8*)
generated from instructions:
ConstantExpr::getBitCast (ConstantDataArray::getString (getGlobalContext
(), "hello"), PointerType::get (Type::getInt8Ty (getGlobalContext ()), 0))
but the LLC tool says: invalid cast opcode for cast from '[5 x i8]'
2012 Dec 19
0
[LLVMdev] GetElementPtrConstantExpr
On 19/12/12 10:25, Alessio Giovanni Baroni wrote:
> Ok, now it's arising another problem. IR code that I obtain is the following:
>
> i8* bitcast ([5 x i8] c"hello\00" to i8*)
You need to put your "hello" in a (constant) global variable. You can then
bitcast the address of the global to i8*. I suggest you compile some C code
that makes use of the address of a
2020 Mar 27
2
[lld] RFC: Allow custom sections to be under GNU_RELRO
Peter,
Thanks for the great feedback!
> The first is the use of a custom suffix, all other linker conventions,
that I know of, use prefixes as these are much easier and faster to match
against names.
> This can be important in large programs compiled -ffunction-sections as
there can be millions of sections to match.
I understand the reason of having these conventions in linkers. On the
2016 Dec 28
1
llvm pass
I want to insert new alloca Instruction after existing alloca Instruction
in llvm pass so what attribute to be passed at last in following
newallocaI = new AllocaInst(llvm::Type::getInt32PtrTy(context,0), //type
0, // ArraySize
8, // Alignment
2019 Feb 22
2
Create the GlobalVariable which have extern in one header file
Hi
Good day. I am facing issue with creating a GlobalVariable. I already have an extern for that global in a header file to use it in the following way
extern const void* DATA_TABLE[];
And with a LLVM PASS, I am trying to create this array with the same name and with initializer. So, I have following:
GlobalVariable *gvar_data = new GlobalVariable(
M, blockItems->getType(), true,
2012 Dec 18
0
[LLVMdev] GetElementPtrConstantExpr
Alessio Giovanni Baroni <alessiogiovanni.baroni at gmail.com> writes:
> Because I need to convert an [4 x i8] type to i8* in the instantiation of a
> GlobalVariable.
> I have the follow declaration: %xxx = type { i8* } and I must emit the
> following variable:
> @yyy = linkonce_odr constant %xxx { [4 x i8] c"hello\00" }, but it's wrong.
>
> How do I do?
2007 Sep 20
0
[LLVMdev] Valgrind Help Needed
On Sep 19, 2007, at 4:48 PM, Bill Wendling wrote:
> Hi all,
>
> This program:
>
> @protocol CPTransferThreadObserving;
>
> @interface CPMode {}
> @end
>
> @implementation CPMode
> -(void) copyInBackgroundAndNotifyUsingPorts {
> id client;
> [client setProtocolForProxy:
> @protocol(CPTransferThreadObserving)];
> }
> @end
>
>
2011 Oct 26
3
[LLVMdev] Use still stuck around after Def is destroyed:
I made a GlobalVariable that is of type ConstantArray. For one of it's
elements I assigned it the ConstantExpr::getBitCast of another
GlobalVariable(the "shadow pointer" mentioned). This gives me:
While deleting: i32 (i32)** %Shadow Variable for ptr1
Use still stuck around after Def is destroyed:i8* bitcast (i32
(i32)** @"Shadow Variable for ptr1" to i8*)
2011 Oct 26
0
[LLVMdev] Use still stuck around after Def is destroyed:
On Oct 26, 2011, at 12:18 PM, ret val wrote:
> I made a GlobalVariable that is of type ConstantArray. For one of it's
> elements I assigned it the ConstantExpr::getBitCast of another
> GlobalVariable(the "shadow pointer" mentioned). This gives me:
>
> While deleting: i32 (i32)** %Shadow Variable for ptr1
> Use still stuck around after Def is