Skip to content

Commit

Permalink
cmd/ld: add a text generation pass
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
aclements committed Dec 22, 2014
1 parent 6c78443 commit 326ceea
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cmd/5l/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/6l/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/8l/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/9l/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ needlib(char *name)

int nelfsym = 1;

void
gentext(void)
{
}

void
adddynrela(LSym *rel, LSym *s, Reloc *r)
{
Expand Down
1 change: 1 addition & 0 deletions src/cmd/ld/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/cmd/ld/pobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ main(int argc, char *argv[])
if(HEADTYPE == Hwindows)
dope();
addexport();
gentext(); // trampolines, call stubs, etc.
textaddress();
pclntab();
symtab();
Expand Down

0 comments on commit 326ceea

Please sign in to comment.