summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-02-27 15:45:06 -0500
committermidipix <writeonce@midipix.org>2019-03-03 10:16:55 -0500
commit8f6b012b22ff372e782b6e49b4451411524e28f2 (patch)
treed22a2cb62548b12202bd5e5e6760a6b56b2a4caa /gcc/config
parent7c3694d44f6b88ed950f7d78a60c7c738d66a99b (diff)
downloadcbb-gcc-4.6.4-8f6b012b22ff372e782b6e49b4451411524e28f2.tar.bz2
cbb-gcc-4.6.4-8f6b012b22ff372e782b6e49b4451411524e28f2.tar.xz
midipix targets: .gotrefs: allow linker to sort entries by target section.
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/midipix.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c
index 01f40c5a5..896e3bef2 100644
--- a/gcc/config/i386/midipix.c
+++ b/gcc/config/i386/midipix.c
@@ -580,6 +580,8 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p)
const char * name;
const char * ptrsize;
const char * secname;
+ const char * sortname;
+ char namebuf[2048];
/* filter out c++ constructors */
if (flag_assume_static_linking)
@@ -637,12 +639,6 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p)
fprintf (asm_out_file,HOST_WIDE_INT_PRINT_DEC,INTVAL(xoff));
}
- /* .gotrefs section */
- fputs("\n\n",asm_out_file);
- fputs(GAS_SECTION,asm_out_file);
- fputs(GOTREFS_SECTION_NAME,asm_out_file);
- fputs("\n",asm_out_file);
-
/* back reference: section name */
if (!in_section)
gcc_unreachable();
@@ -674,6 +670,24 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p)
gcc_unreachable();
}
+ if (!(sortname = strchr(secname,'$'))) {
+ sortname = secname;
+ } else if (sortname-secname >= sizeof(namebuf)) {
+ gcc_unreachable();
+ } else {
+ memcpy(namebuf,secname,sortname-secname);
+ namebuf[sortname-secname] = 0;
+ sortname = namebuf;
+ }
+
+ /* .gotrefs section */
+ fputs("\n\n",asm_out_file);
+ fputs(GAS_SECTION,asm_out_file);
+ fputs(GOTREFS_SECTION_NAME,asm_out_file);
+ fputs("$",asm_out_file);
+ fputs(sortname,asm_out_file);
+ fputs("\n",asm_out_file);
+
/* back reference: section rva */
fputs("\t.rva",asm_out_file);
fprintf(asm_out_file,"\t%s\n",secname);