RFA: pseudo-relocations for pe targets
Kai Tietz
ktietz70@googlemail.com
Tue Nov 11 22:40:00 GMT 2008
2008/11/11 Kai Tietz <ktietz70@googlemail.com>:
> 2008/11/11 Kai Tietz <Kai.Tietz@onevision.com>:
>>
>> About this I thought too. I'll modify the patch accordingly to this and
>> re-post it here (plus a pseudo-reloc.c variant for test).
>>
>
> Here comes the changed version plus the pseudo-reloc.c file.
>
> Is the patch ok for apply on trunk?
I noticed that I sent an older pseudo-reloc.c file, so I attached the
current one.
I test it on w64 by the following test files:
a.c: (compiled by gcc -mdll -o a.dll a.c)
#include <stdio.h>
typedef struct abc {
int a;
int b;
int c;
} abc;
__declspec(dllexport) abc my_abc = { 1,2,3 };
__declspec(dllexport) int my_a = 2;
__declspec(dllexport) void show_a(void)
{
printf ("In dll: %d %p, %d %p\n", my_a, &my_a, my_abc.b, &my_abc.b);
}
b.c: (compiled by gcc -o b.exe b.c a.dll -Wl,--enable-auto-import)
#include <stdio.h>
typedef struct abc {
int a;
int b;
int c;
} abc;
extern abc my_abc;
extern int my_a;
extern void show_a(void);
int main()
{
show_a();
printf ("In Exe: %d %p, %d %p\n", my_a, &my_a, my_abc.b, &my_abc.b);
return 1;
}
Result on execution on w64:
$ ./b.exe
In dll: 2 000000006608200C, 2 0000000066082004
In Exe: 2 000000006608200C, 2 0000000066082004
Kai
--
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pseudo-reloc.c
URL: <https://sourceware.org/pipermail/binutils/attachments/20081111/b6d064a8/attachment.c>
More information about the Binutils
mailing list