diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2016-12-10 09:14:29 +0000 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2016-12-10 09:44:09 +0000 |
| commit | 0bf262864c95e555fbd077b8f30e64652d9113a6 (patch) | |
| tree | 406f10fb08531733d18f2bf739e843e9573eb17a /x86_64-link.c | |
| parent | e0fe69050d2df59da7370875c4f5eb557618e20c (diff) | |
| download | tinycc-0bf262864c95e555fbd077b8f30e64652d9113a6.tar.gz tinycc-0bf262864c95e555fbd077b8f30e64652d9113a6.tar.bz2 | |
Fix PLT creation for i386
i386 target does not have PC relative loads. Its ABI therefore require
ebx register to points to the GOT when executing a PLT entry. This means
that PLT entry cannot be used transparently, the compiler needs to
expect execution of a PLT entry to be able to use one, that is a PLT
entry should only be created if the relocation explicitely asks for it
(eg. R_386_PLT32).
This patch creates a new target macro PCRELATIVE_DLLPLT to indicate
whether a target can do a PC relative load in PLT entry when building a
dynamic library. Executable do not normally pose a problem because they
are loaded at a fixed address and thus the absolute address of GOT can
be used.
Note that in such a case, if the compiler does not use a PLT aware
relocation for external access then the code relocation will fall on the
dynamic loader since there is no PLT entry to relocate too.
Diffstat (limited to 'x86_64-link.c')
| -rw-r--r-- | x86_64-link.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/x86_64-link.c b/x86_64-link.c index 8769b3a..25ae29c 100644 --- a/x86_64-link.c +++ b/x86_64-link.c @@ -15,6 +15,7 @@ #define ELF_PAGE_SIZE 0x200000 #define HAVE_SECTION_RELOC +#define PCRELATIVE_DLLPLT 1 #else /* !TARGET_DEFS_ONLY */ |
