From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21704 invoked by alias); 23 Apr 2004 19:15:01 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 21683 invoked from network); 23 Apr 2004 19:14:59 -0000 Received: from unknown (HELO sccrmhc13.comcast.net) (204.127.202.64) by sources.redhat.com with SMTP; 23 Apr 2004 19:14:59 -0000 Received: from lucon.org ([24.6.43.109]) by comcast.net (sccrmhc13) with ESMTP id <2004042319145701600cr7ipe>; Fri, 23 Apr 2004 19:14:57 +0000 Received: by lucon.org (Postfix, from userid 1000) id 1A7F764D13; Fri, 23 Apr 2004 12:14:55 -0700 (PDT) Date: Fri, 23 Apr 2004 20:27:00 -0000 From: "H. J. Lu" To: binutils@sources.redhat.com Subject: PATCH: Pass section name to elf_backend_section_flags Message-ID: <20040423191455.GA3925@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-04/txt/msg00646.txt.bz2 This patch removes one FIXME in ELF linker. H.J. ----- 2004-04-23 H.J. Lu * elf-bfd.h (elf_backend_section_flags): Also take section name. * elf64-alpha.c (elf64_alpha_section_flags): Updated. * elfxx-ia64.c (elfNN_ia64_section_flags): Likewise. * elf.c (_bfd_elf_make_section_from_shdr): Pass section name to elf_backend_section_flags. * elf32-sh64.c (elf_backend_section_flags): New. Defined. (sh64_elf_set_mach_from_flags): Remove the kludge for .cranges section. (sh64_elf_section_flags): New. Set SEC_DEBUGGING for .cranges section. --- bfd/elf-bfd.h.flags 2004-04-22 11:06:31.000000000 -0700 +++ bfd/elf-bfd.h 2004-04-23 11:32:09.000000000 -0700 @@ -597,7 +597,7 @@ struct elf_backend_data /* A function to convert machine dependent section header flags to BFD internal section header flags. */ bfd_boolean (*elf_backend_section_flags) - (flagword *, Elf_Internal_Shdr *); + (flagword *, Elf_Internal_Shdr *, const char *name); /* A function to handle unusual program segment types when creating BFD sections from ELF program segments. */ --- bfd/elf.c.flags 2004-04-22 16:25:06.000000000 -0700 +++ bfd/elf.c 2004-04-23 11:34:43.000000000 -0700 @@ -726,7 +726,7 @@ _bfd_elf_make_section_from_shdr (bfd *ab bed = get_elf_backend_data (abfd); if (bed->elf_backend_section_flags) - if (! bed->elf_backend_section_flags (&flags, hdr)) + if (! bed->elf_backend_section_flags (&flags, hdr, name)) return FALSE; if (! bfd_set_section_flags (abfd, newsect, flags)) --- bfd/elf32-sh64.c.flags 2004-03-26 08:36:25.000000000 -0800 +++ bfd/elf32-sh64.c 2004-04-23 12:11:05.000000000 -0700 @@ -89,6 +89,7 @@ static void sh64_find_section_for_addres #define elf_backend_final_write_processing sh64_elf_final_write_processing #define elf_backend_section_from_shdr sh64_backend_section_from_shdr #define elf_backend_special_sections sh64_elf_special_sections +#define elf_backend_section_flags sh64_elf_section_flags #define bfd_elf32_new_section_hook sh64_elf_new_section_hook @@ -149,7 +150,6 @@ static bfd_boolean sh64_elf_set_mach_from_flags (bfd *abfd) { flagword flags = elf_elfheader (abfd)->e_flags; - asection *cranges; switch (flags & EF_SH_MACH_MASK) { @@ -164,17 +164,16 @@ sh64_elf_set_mach_from_flags (bfd *abfd) return FALSE; } - /* We also need to set SEC_DEBUGGING on an incoming .cranges section. - We could have used elf_backend_section_flags if it had given us the - section name; the bfd_section member in the header argument is not - set at the point of the call. FIXME: Find out whether that is by - undocumented design or a bug. */ - cranges = bfd_get_section_by_name (abfd, SH64_CRANGES_SECTION_NAME); - if (cranges != NULL - && ! bfd_set_section_flags (abfd, cranges, - bfd_get_section_flags (abfd, cranges) - | SEC_DEBUGGING)) - return FALSE; + return TRUE; +} + +static bfd_boolean +sh64_elf_section_flags (flagword *flags, + Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED, + const char *name) +{ + if (strcmp (name, SH64_CRANGES_SECTION_NAME) == 0) + *flags |= SEC_DEBUGGING; return TRUE; } --- bfd/elf64-alpha.c.flags 2004-03-27 17:39:09.000000000 -0800 +++ bfd/elf64-alpha.c 2004-04-23 11:49:05.000000000 -0700 @@ -74,8 +74,6 @@ static bfd_boolean elf64_alpha_object_p PARAMS ((bfd *)); static bfd_boolean elf64_alpha_section_from_shdr PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); -static bfd_boolean elf64_alpha_section_flags - PARAMS ((flagword *, Elf_Internal_Shdr *)); static bfd_boolean elf64_alpha_fake_sections PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); static bfd_boolean elf64_alpha_create_got_section @@ -2313,9 +2311,8 @@ elf64_alpha_section_from_shdr (abfd, hdr /* Convert Alpha specific section flags to bfd internal section flags. */ static bfd_boolean -elf64_alpha_section_flags (flags, hdr) - flagword *flags; - Elf_Internal_Shdr *hdr; +elf64_alpha_section_flags (flagword *flags, Elf_Internal_Shdr *hdr, + const char *name ATTRIBUTE_UNUSED) { if (hdr->sh_flags & SHF_ALPHA_GPREL) *flags |= SEC_SMALL_DATA; --- bfd/elfxx-ia64.c.flags 2004-04-22 09:59:17.000000000 -0700 +++ bfd/elfxx-ia64.c 2004-04-23 11:46:50.000000000 -0700 @@ -195,8 +195,6 @@ static bfd_boolean is_unwind_section_nam PARAMS ((bfd *abfd, const char *)); static bfd_boolean elfNN_ia64_section_from_shdr PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); -static bfd_boolean elfNN_ia64_section_flags - PARAMS ((flagword *, Elf_Internal_Shdr *)); static bfd_boolean elfNN_ia64_fake_sections PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)); static void elfNN_ia64_final_write_processing @@ -1279,9 +1277,8 @@ elfNN_ia64_section_from_shdr (abfd, hdr, flag. */ static bfd_boolean -elfNN_ia64_section_flags (flags, hdr) - flagword *flags; - Elf_Internal_Shdr *hdr; +elfNN_ia64_section_flags (flagword *flags, Elf_Internal_Shdr *hdr, + const char *name ATTRIBUTE_UNUSED) { if (hdr->sh_flags & SHF_IA_64_SHORT) *flags |= SEC_SMALL_DATA;