diff --git a/gas/ChangeLog b/gas/ChangeLog index 12ce987908..0157c69716 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2003-10-24 H.J. Lu + + * config/obj-elf.c (obj_elf_change_section): Allow SHF_ALLOC + for .interp, .strtab and .symtab. Use specified section + attributes. + 2003-10-22 Andreas Schwab H.J. Lu Jim Wilson diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index f0182a2cdf..c9fd1c72ab 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -641,6 +641,8 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push) if (ssect != NULL) { + bfd_boolean override = FALSE; + if (type == SHT_NULL) type = ssect->type; else if (type != ssect->type) @@ -669,7 +671,7 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push) } } - if (old_sec == NULL && (attr &~ ssect->attr) != 0) + if (old_sec == NULL && (attr & ~ssect->attr) != 0) { /* As a GNU extension, we permit a .note section to be allocatable. If the linker sees an allocatable .note @@ -682,13 +684,25 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push) something like .rodata.str. */ else if (ssect->suffix_length == -2 && name[ssect->prefix_length] == '.' - && (attr &~ ssect->attr &~ SHF_MERGE &~ SHF_STRINGS) == 0) + && (attr + & ~ssect->attr + & ~SHF_MERGE + & ~SHF_STRINGS) == 0) ; + /* .interp, .strtab and .symtab can have SHF_ALLOC. */ + else if (attr == SHF_ALLOC + && (strcmp (name, ".interp") == 0 + || strcmp (name, ".strtab") == 0 + || strcmp (name, ".symtab") == 0)) + override = TRUE; else - as_warn (_("setting incorrect section attributes for %s"), - name); + { + as_warn (_("setting incorrect section attributes for %s"), + name); + override = TRUE; + } } - if (old_sec == NULL) + if (!override && old_sec == NULL) attr |= ssect->attr; }