Displaying 6 results from an estimated 6 matches for "prefix_ptr".
2017 Mar 06
4
[BUG Report] -dead_strip, strips prefix data unconditionally on macOS
...bugging.
declare i32 @printf(i8*, ...)
; define a main function.
define i32 @main() prefix i32 123 {
; obtain a i32 pointer to the main function.
; the prefix data is right before that pointer.
%main = bitcast i32 ()* @main to i32*
; use the gep, to cmpute the start of the prefix data.
%prefix_ptr = getelementptr inbounds i32, i32* %main, i32 -1
; and load it.
%prefix_val = load i32, i32* %prefix_ptr
; print that value.
%ret = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str2, i32 0, i32 0), i32 %prefix_val)
; similarly let's do the same with...
2017 Mar 07
2
[BUG Report] -dead_strip, strips prefix data unconditionally on macOS
...getelementptr (%struct.prefix,
> %struct.prefix* bitcast (i32 ()* @main to %struct.prefix*), i32 -1, i32 0)
> >
> > declare i32 @printf(i8*, ...)
> >
> > define i32 @main() prefix %struct.prefix { i32 123 } {
> > %main = bitcast i32 ()* @main to i32*
> > %prefix_ptr = getelementptr inbounds i32, i32* %main, i32 -1
> > %prefix_val = load i32, i32* %prefix_ptr
> > %ret = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x
> i8], [8 x i8]* @.str, i32 0, i32 0), i32 %prefix_val)
> > ret i32 0
> > }
> >
> >
>...
2017 Mar 07
4
[BUG Report] -dead_strip, strips prefix data unconditionally on macOS
...t; @main.dsp = alias i32, i32* getelementptr (%struct.prefix, %struct.prefix*
> bitcast (i32 ()* @main to %struct.prefix*), i32 -1, i32 0)
>
> declare i32 @printf(i8*, ...)
>
> define i32 @main() prefix %struct.prefix { i32 123 } {
> %main = bitcast i32 ()* @main to i32*
> %prefix_ptr = getelementptr inbounds i32, i32* %main, i32 -1
> %prefix_val = load i32, i32* %prefix_ptr
> %ret = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8],
> [8 x i8]* @.str, i32 0, i32 0), i32 %prefix_val)
> ret i32 0
> }
>
>
> generates the following for m...
2017 Mar 07
2
[BUG Report] -dead_strip, strips prefix data unconditionally on macOS
...; > define i32 @main() prefix i32 123 {
> > ; obtain a i32 pointer to the main function.
> > ; the prefix data is right before that pointer.
> > %main = bitcast i32 ()* @main to i32*
> >
> > ; use the gep, to cmpute the start of the prefix data.
> > %prefix_ptr = getelementptr inbounds i32, i32* %main, i32 -1
> > ; and load it.
> > %prefix_val = load i32, i32* %prefix_ptr
> >
> > ; print that value.
> > %ret = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x
> i8], [8 x i8]* @.str2, i32 0, i32 0), i32 %...
2017 Mar 06
6
[BUG Report] -dead_strip, strips prefix data unconditionally on macOS
...on.
>> define i32 @main() prefix i32 123 {
>> ; obtain a i32 pointer to the main function.
>> ; the prefix data is right before that pointer.
>> %main = bitcast i32 ()* @main to i32*
>>
>> ; use the gep, to cmpute the start of the prefix data.
>> %prefix_ptr = getelementptr inbounds i32, i32* %main, i32 -1
>> ; and load it.
>> %prefix_val = load i32, i32* %prefix_ptr
>>
>> ; print that value.
>> %ret = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x
>> i8], [8 x i8]* @.str2, i32 0, i32 0), i32 %p...
2017 Mar 07
2
[BUG Report] -dead_strip, strips prefix data unconditionally on macOS
...> ; define a main function.
> define i32 @main() prefix i32 123 {
> ; obtain a i32 pointer to the main function.
> ; the prefix data is right before that pointer.
> %main = bitcast i32 ()* @main to i32*
>
> ; use the gep, to cmpute the start of the prefix data.
> %prefix_ptr = getelementptr inbounds i32, i32* %main, i32 -1
> ; and load it.
> %prefix_val = load i32, i32* %prefix_ptr
>
> ; print that value.
> %ret = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str2, i32 0, i32 0), i32 %prefix_val)
>
> ; si...