diff options
author | Ian Lance Taylor <ian@airs.com> | 1993-09-16 18:26:36 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1993-09-16 18:26:36 +0000 |
commit | 13998021224dd1c88142928ffa39cd94cd134f76 (patch) | |
tree | 0165a5dad0e3d802deada527a55d18fed9240a7d /gas/config | |
parent | 48d10a2545e1fe5d677bf5f4ce1f1784ee606a5a (diff) | |
download | gdb-13998021224dd1c88142928ffa39cd94cd134f76.zip gdb-13998021224dd1c88142928ffa39cd94cd134f76.tar.gz gdb-13998021224dd1c88142928ffa39cd94cd134f76.tar.bz2 |
* tc.h: Declare tc_gen_reloc differently depending upong
RELOC_EXPANSION_POSSIBLE.
* config/obj-elf.c (obj_elf_section): Only set flags when first
creating the section.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/obj-elf.c | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 11c5499..603c707 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -31,6 +31,8 @@ static void obj_elf_ident PARAMS ((int)); static void obj_elf_weak PARAMS ((int)); static void obj_elf_local PARAMS ((int)); static void obj_elf_common PARAMS ((int)); +static void obj_elf_data PARAMS ((int)); +static void obj_elf_text PARAMS ((int)); const pseudo_typeS obj_pseudo_table[] = { @@ -52,6 +54,10 @@ const pseudo_typeS obj_pseudo_table[] = {"4byte", cons, 4}, {"8byte", cons, 8}, + /* We need to trap the section changing calls to handle .previous. */ + {"data", obj_elf_data, 0}, + {"text", obj_elf_text, 0}, + {NULL} /* end sentinel */ }; @@ -280,12 +286,13 @@ obj_elf_section (xxx) { char *string; asection *sec; + int new_sec; /* Initialize this with inclusive-or of all flags that can be cleared by attributes, but not set by them. Also include flags that won't get set properly in the assembler, but which the user/compiler shouldn't be expected to set. */ - flagword flags = SEC_READONLY | SEC_ALLOC | SEC_RELOC; + flagword flags = SEC_READONLY | SEC_ALLOC | SEC_RELOC | SEC_LOAD; /* Initialize this with the default flags to be used if none are specified. */ flagword default_flags = 0; @@ -307,7 +314,8 @@ obj_elf_section (xxx) *p = c; input_line_pointer = p; } - if (!strcmp (string, ".rodata")) + if (!strcmp (string, ".rodata") + || !strcmp (string, ".rodata1")) default_flags = SEC_ALLOC | SEC_READONLY | SEC_RELOC | SEC_LOAD; else if (!strcmp (string, ".init") || !strcmp (string, ".fini")) @@ -348,7 +356,7 @@ obj_elf_section (xxx) bit = BIT; inv = NEG; goto match; } CHECK ("write", SEC_READONLY, 1); - CHECK ("alloc", SEC_ALLOC, 0); + CHECK ("alloc", SEC_ALLOC | SEC_LOAD, 0); CHECK ("execinstr", SEC_CODE, 1); CHECK ("progbits", SEC_LOAD, 1); #undef CHECK @@ -376,16 +384,35 @@ obj_elf_section (xxx) if (!string) return; - sec = bfd_get_section_by_name (stdoutput, string); - if (sec == 0) - { - sec = subseg_new (string, 0); - bfd_set_section_flags (stdoutput, sec, flags); - sec->output_section = sec; - } previous_section = now_seg; previous_subsection = now_subseg; - subseg_set (sec, 0); + + new_sec = bfd_get_section_by_name (stdoutput, string) == NULL; + sec = subseg_new (string, 0); + if (new_sec) + bfd_set_section_flags (stdoutput, sec, flags); +} + +/* Change to the .data section. */ + +static void +obj_elf_data (i) + int i; +{ + previous_section = now_seg; + previous_subsection = now_subseg; + s_data (i); +} + +/* Change to the .text section. */ + +static void +obj_elf_text (i) + int i; +{ + previous_section = now_seg; + previous_subsection = now_subseg; + s_text (i); } void |