From ea8f8eab209f0cc042c791b73e38484298bfdcf7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 24 Oct 2003 15:41:23 +0000 Subject: [PATCH] 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. --- gas/ChangeLog | 6 ++++++ gas/config/obj-elf.c | 24 +++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 12ce9879088..0157c697161 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 f0182a2cdf4..c9fd1c72abb 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; } -- 2.30.2