This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: pseudo-relocations for pe targets


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

Attachment: pseudo-reloc.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]