From 326ceeabc46db98cccfbde80fde562c0fb3325c3 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 17 Dec 2014 12:13:47 -0500 Subject: [PATCH] cmd/ld: add a text generation pass This will be used by ppc64 to add call stubs to the .text section. ARM needs a similar pass to generate veneers for arm->thumb transitions. Change-Id: Iaee74036e60643a56fab15b564718f359c5910eb Reviewed-on: https://go-review.googlesource.com/2004 Reviewed-by: Russ Cox --- src/cmd/5l/asm.c | 5 +++++ src/cmd/6l/asm.c | 5 +++++ src/cmd/8l/asm.c | 5 +++++ src/cmd/9l/asm.c | 5 +++++ src/cmd/ld/lib.h | 1 + src/cmd/ld/pobj.c | 1 + 6 files changed, 22 insertions(+) diff --git a/src/cmd/5l/asm.c b/src/cmd/5l/asm.c index 9c1c04e2d4db59..017d3f4357fd4d 100644 --- a/src/cmd/5l/asm.c +++ b/src/cmd/5l/asm.c @@ -69,6 +69,11 @@ static void addpltsym(Link*, LSym*); static void addgotsym(Link*, LSym*); static void addgotsyminternal(Link*, LSym*); +void +gentext(void) +{ +} + // Preserve highest 8 bits of a, and do addition to lower 24-bit // of a and b; used to adjust ARM branch intruction's target static int32 diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c index 18b5aa31198121..41c9cc84c64bf0 100644 --- a/src/cmd/6l/asm.c +++ b/src/cmd/6l/asm.c @@ -73,6 +73,11 @@ int nelfsym = 1; static void addpltsym(LSym*); static void addgotsym(LSym*); +void +gentext(void) +{ +} + void adddynrela(LSym *rela, LSym *s, Reloc *r) { diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c index 98c04240374fd4..8b91c0971a28a1 100644 --- a/src/cmd/8l/asm.c +++ b/src/cmd/8l/asm.c @@ -69,6 +69,11 @@ int nelfsym = 1; static void addpltsym(Link*, LSym*); static void addgotsym(Link*, LSym*); +void +gentext(void) +{ +} + void adddynrela(LSym *rela, LSym *s, Reloc *r) { diff --git a/src/cmd/9l/asm.c b/src/cmd/9l/asm.c index f9e2810ade6ca9..7814edd525e2f0 100644 --- a/src/cmd/9l/asm.c +++ b/src/cmd/9l/asm.c @@ -65,6 +65,11 @@ needlib(char *name) int nelfsym = 1; +void +gentext(void) +{ +} + void adddynrela(LSym *rel, LSym *s, Reloc *r) { diff --git a/src/cmd/ld/lib.h b/src/cmd/ld/lib.h index 067ffa0bcc4f8a..17483e0b4c95e2 100644 --- a/src/cmd/ld/lib.h +++ b/src/cmd/ld/lib.h @@ -227,6 +227,7 @@ vlong entryvalue(void); void errorexit(void); void follow(void); void genasmsym(void (*put)(LSym*, char*, int, vlong, vlong, int, LSym*)); +void gentext(void); void growdatsize(vlong *datsizep, LSym *s); char* headstr(int v); int headtype(char *name); diff --git a/src/cmd/ld/pobj.c b/src/cmd/ld/pobj.c index 63460df30afa9e..b86ddfe0fe3d92 100644 --- a/src/cmd/ld/pobj.c +++ b/src/cmd/ld/pobj.c @@ -184,6 +184,7 @@ main(int argc, char *argv[]) if(HEADTYPE == Hwindows) dope(); addexport(); + gentext(); // trampolines, call stubs, etc. textaddress(); pclntab(); symtab();