mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-07 02:06:49 +00:00
put macsbug name in separate section so it can be stripped out - and hack ld so that it won't be stripped out by -gc-sections
This commit is contained in:
parent
c95a59f75e
commit
70be98cb62
@ -12688,6 +12688,23 @@ _bfd_elf_gc_mark (struct bfd_link_info *info,
|
||||
if (!_bfd_elf_gc_mark (info, group_sec, gc_mark_hook))
|
||||
return FALSE;
|
||||
|
||||
{ /* keep macsbug sections */
|
||||
asection *next_sec = sec->next;
|
||||
if(next_sec)
|
||||
{
|
||||
const char *p = sec->name, *q = next_sec->name;
|
||||
|
||||
while(*p && *q && *p == *q)
|
||||
p++, q++;
|
||||
|
||||
if(*p == 0 && strcmp(q, ".macsbug") == 0)
|
||||
if(!next_sec->gc_mark)
|
||||
if (!_bfd_elf_gc_mark (info, next_sec, gc_mark_hook))
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Look through the section relocs. */
|
||||
ret = TRUE;
|
||||
eh_frame = elf_eh_frame_section (sec->owner);
|
||||
|
@ -6724,7 +6724,8 @@ m68k_write_macsbug_name(FILE *file, const char *name)
|
||||
int len = strlen(name);
|
||||
if(len > 255)
|
||||
len = 255;
|
||||
|
||||
if(flag_function_sections)
|
||||
fprintf(file, "\t.section .text.%s.macsbug,\"ax\",@progbits\n",name);
|
||||
fprintf(file, "# macsbug symbol\n");
|
||||
if(!retro68_hack_asm_rts_counter)
|
||||
fprintf(file, "\trts\n");
|
||||
@ -6735,6 +6736,8 @@ m68k_write_macsbug_name(FILE *file, const char *name)
|
||||
|
||||
ASM_OUTPUT_ASCII(file, name, len);
|
||||
fprintf(file, "\t.align 2,0\n\t.short 0\n");
|
||||
if(flag_function_sections)
|
||||
fprintf(file, "\t.section .text.%s,\"ax\",@progbits\n",name);
|
||||
}
|
||||
|
||||
static tree
|
||||
|
@ -994,9 +994,9 @@ extern int m68k_sched_indexed_address_bypass_p (rtx_insn *, rtx_insn *);
|
||||
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
|
||||
do \
|
||||
{ \
|
||||
m68k_write_macsbug_name(FILE, FNAME); \
|
||||
if (!flag_inhibit_size_directive) \
|
||||
ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
|
||||
m68k_write_macsbug_name(FILE, FNAME); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user