Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: bfd/elf32-hppa.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bfd/elf32-h8300.c ('k') | bfd/elf32-i370.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* BFD back-end for HP PA-RISC ELF files. 1 /* BFD back-end for HP PA-RISC ELF files.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6 Original code by 6 Original code by
7 Center for Software Science 7 Center for Software Science
8 Department of Computer Science 8 Department of Computer Science
9 University of Utah 9 University of Utah
10 Largely rewritten by Alan Modra <alan@linuxcare.com.au> 10 Largely rewritten by Alan Modra <alan@linuxcare.com.au>
11 Naming cleanup by Carlos O'Donell <carlos@systemhalted.org> 11 Naming cleanup by Carlos O'Donell <carlos@systemhalted.org>
12 TLS support written by Randolph Chung <tausq@debian.org> 12 TLS support written by Randolph Chung <tausq@debian.org>
13 13
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 htab = hppa_link_hash_table (info); 998 htab = hppa_link_hash_table (info);
999 if (htab == NULL) 999 if (htab == NULL)
1000 return FALSE; 1000 return FALSE;
1001 if (htab->splt != NULL) 1001 if (htab->splt != NULL)
1002 return TRUE; 1002 return TRUE;
1003 1003
1004 /* Call the generic code to do most of the work. */ 1004 /* Call the generic code to do most of the work. */
1005 if (! _bfd_elf_create_dynamic_sections (abfd, info)) 1005 if (! _bfd_elf_create_dynamic_sections (abfd, info))
1006 return FALSE; 1006 return FALSE;
1007 1007
1008 htab->splt = bfd_get_section_by_name (abfd, ".plt"); 1008 htab->splt = bfd_get_linker_section (abfd, ".plt");
1009 htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt"); 1009 htab->srelplt = bfd_get_linker_section (abfd, ".rela.plt");
1010 1010
1011 htab->sgot = bfd_get_section_by_name (abfd, ".got"); 1011 htab->sgot = bfd_get_linker_section (abfd, ".got");
1012 htab->srelgot = bfd_get_section_by_name (abfd, ".rela.got"); 1012 htab->srelgot = bfd_get_linker_section (abfd, ".rela.got");
1013 1013
1014 htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss"); 1014 htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
1015 htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss"); 1015 htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
1016 1016
1017 /* hppa-linux needs _GLOBAL_OFFSET_TABLE_ to be visible from the main 1017 /* hppa-linux needs _GLOBAL_OFFSET_TABLE_ to be visible from the main
1018 application, because __canonicalize_funcptr_for_compare needs it. */ 1018 application, because __canonicalize_funcptr_for_compare needs it. */
1019 eh = elf_hash_table (info)->hgot; 1019 eh = elf_hash_table (info)->hgot;
1020 eh->forced_local = 0; 1020 eh->forced_local = 0;
1021 eh->other = STV_DEFAULT; 1021 eh->other = STV_DEFAULT;
1022 return bfd_elf_link_record_dynamic_symbol (info, eh); 1022 return bfd_elf_link_record_dynamic_symbol (info, eh);
1023 } 1023 }
1024 1024
1025 /* Copy the extra info we tack onto an elf_link_hash_entry. */ 1025 /* Copy the extra info we tack onto an elf_link_hash_entry. */
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 1891
1892 /* If we didn't find any dynamic relocs in read-only sections, then 1892 /* If we didn't find any dynamic relocs in read-only sections, then
1893 we'll be keeping the dynamic relocs and avoiding the copy reloc. */ 1893 we'll be keeping the dynamic relocs and avoiding the copy reloc. */
1894 if (hdh_p == NULL) 1894 if (hdh_p == NULL)
1895 { 1895 {
1896 eh->non_got_ref = 0; 1896 eh->non_got_ref = 0;
1897 return TRUE; 1897 return TRUE;
1898 } 1898 }
1899 } 1899 }
1900 1900
1901 if (eh->size == 0)
1902 {
1903 (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
1904 eh->root.root.string);
1905 return TRUE;
1906 }
1907
1908 /* We must allocate the symbol in our .dynbss section, which will 1901 /* We must allocate the symbol in our .dynbss section, which will
1909 become part of the .bss section of the executable. There will be 1902 become part of the .bss section of the executable. There will be
1910 an entry for this symbol in the .dynsym section. The dynamic 1903 an entry for this symbol in the .dynsym section. The dynamic
1911 object will contain position independent code, so all references 1904 object will contain position independent code, so all references
1912 from the dynamic object to this symbol will go through the global 1905 from the dynamic object to this symbol will go through the global
1913 offset table. The dynamic linker will use the .dynsym entry to 1906 offset table. The dynamic linker will use the .dynsym entry to
1914 determine the address it must put in the global offset table, so 1907 determine the address it must put in the global offset table, so
1915 both the dynamic object and the regular object will refer to the 1908 both the dynamic object and the regular object will refer to the
1916 same memory location for the variable. */ 1909 same memory location for the variable. */
1917 1910
1918 htab = hppa_link_hash_table (info); 1911 htab = hppa_link_hash_table (info);
1919 if (htab == NULL) 1912 if (htab == NULL)
1920 return FALSE; 1913 return FALSE;
1921 1914
1922 /* We must generate a COPY reloc to tell the dynamic linker to 1915 /* We must generate a COPY reloc to tell the dynamic linker to
1923 copy the initial value out of the dynamic object and into the 1916 copy the initial value out of the dynamic object and into the
1924 runtime process image. */ 1917 runtime process image. */
1925 if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0) 1918 if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0 && eh->size != 0)
1926 { 1919 {
1927 htab->srelbss->size += sizeof (Elf32_External_Rela); 1920 htab->srelbss->size += sizeof (Elf32_External_Rela);
1928 eh->needs_copy = 1; 1921 eh->needs_copy = 1;
1929 } 1922 }
1930 1923
1931 sec = htab->sdynbss; 1924 sec = htab->sdynbss;
1932 1925
1933 return _bfd_elf_adjust_dynamic_copy (eh, sec); 1926 return _bfd_elf_adjust_dynamic_copy (eh, sec);
1934 } 1927 }
1935 1928
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2225 2218
2226 dynobj = htab->etab.dynobj; 2219 dynobj = htab->etab.dynobj;
2227 if (dynobj == NULL) 2220 if (dynobj == NULL)
2228 abort (); 2221 abort ();
2229 2222
2230 if (htab->etab.dynamic_sections_created) 2223 if (htab->etab.dynamic_sections_created)
2231 { 2224 {
2232 /* Set the contents of the .interp section to the interpreter. */ 2225 /* Set the contents of the .interp section to the interpreter. */
2233 if (info->executable) 2226 if (info->executable)
2234 { 2227 {
2235 » sec = bfd_get_section_by_name (dynobj, ".interp"); 2228 » sec = bfd_get_linker_section (dynobj, ".interp");
2236 if (sec == NULL) 2229 if (sec == NULL)
2237 abort (); 2230 abort ();
2238 sec->size = sizeof ELF_DYNAMIC_INTERPRETER; 2231 sec->size = sizeof ELF_DYNAMIC_INTERPRETER;
2239 sec->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; 2232 sec->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
2240 } 2233 }
2241 2234
2242 /* Force millicode symbols local. */ 2235 /* Force millicode symbols local. */
2243 elf_link_hash_traverse (&htab->etab, 2236 elf_link_hash_traverse (&htab->etab,
2244 clobber_millicode_symbols, 2237 clobber_millicode_symbols,
2245 info); 2238 info);
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 if (! info->callbacks->undefined_symbol 3727 if (! info->callbacks->undefined_symbol
3735 (info, eh_name (eh), input_bfd, 3728 (info, eh_name (eh), input_bfd,
3736 input_section, rela->r_offset, FALSE)) 3729 input_section, rela->r_offset, FALSE))
3737 return FALSE; 3730 return FALSE;
3738 warned_undef = TRUE; 3731 warned_undef = TRUE;
3739 } 3732 }
3740 } 3733 }
3741 hh = hppa_elf_hash_entry (eh); 3734 hh = hppa_elf_hash_entry (eh);
3742 } 3735 }
3743 3736
3744 if (sym_sec != NULL && elf_discarded_section (sym_sec)) 3737 if (sym_sec != NULL && discarded_section (sym_sec))
3745 RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, 3738 RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
3746 » » » » » rela, relend, 3739 » » » » » rela, 1, relend,
3747 » » » » » elf_hppa_howto_table + r_type, 3740 » » » » » elf_hppa_howto_table + r_type, 0,
3748 contents); 3741 contents);
3749 3742
3750 if (info->relocatable) 3743 if (info->relocatable)
3751 continue; 3744 continue;
3752 3745
3753 /* Do any required modifications to the relocation value, and 3746 /* Do any required modifications to the relocation value, and
3754 determine what types of dynamic info we need to output, if 3747 determine what types of dynamic info we need to output, if
3755 any. */ 3748 any. */
3756 plabel = 0; 3749 plabel = 0;
3757 switch (r_type) 3750 switch (r_type)
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
4506 return FALSE; 4499 return FALSE;
4507 4500
4508 dynobj = htab->etab.dynobj; 4501 dynobj = htab->etab.dynobj;
4509 4502
4510 sgot = htab->sgot; 4503 sgot = htab->sgot;
4511 /* A broken linker script might have discarded the dynamic sections. 4504 /* A broken linker script might have discarded the dynamic sections.
4512 Catch this here so that we do not seg-fault later on. */ 4505 Catch this here so that we do not seg-fault later on. */
4513 if (sgot != NULL && bfd_is_abs_section (sgot->output_section)) 4506 if (sgot != NULL && bfd_is_abs_section (sgot->output_section))
4514 return FALSE; 4507 return FALSE;
4515 4508
4516 sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); 4509 sdyn = bfd_get_linker_section (dynobj, ".dynamic");
4517 4510
4518 if (htab->etab.dynamic_sections_created) 4511 if (htab->etab.dynamic_sections_created)
4519 { 4512 {
4520 Elf32_External_Dyn *dyncon, *dynconend; 4513 Elf32_External_Dyn *dyncon, *dynconend;
4521 4514
4522 if (sdyn == NULL) 4515 if (sdyn == NULL)
4523 abort (); 4516 abort ();
4524 4517
4525 dyncon = (Elf32_External_Dyn *) sdyn->contents; 4518 dyncon = (Elf32_External_Dyn *) sdyn->contents;
4526 dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); 4519 dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
4700 #undef TARGET_BIG_SYM 4693 #undef TARGET_BIG_SYM
4701 #define TARGET_BIG_SYM bfd_elf32_hppa_nbsd_vec 4694 #define TARGET_BIG_SYM bfd_elf32_hppa_nbsd_vec
4702 #undef TARGET_BIG_NAME 4695 #undef TARGET_BIG_NAME
4703 #define TARGET_BIG_NAME "elf32-hppa-netbsd" 4696 #define TARGET_BIG_NAME "elf32-hppa-netbsd"
4704 #undef ELF_OSABI 4697 #undef ELF_OSABI
4705 #define ELF_OSABI ELFOSABI_NETBSD 4698 #define ELF_OSABI ELFOSABI_NETBSD
4706 #undef elf32_bed 4699 #undef elf32_bed
4707 #define elf32_bed elf32_hppa_netbsd_bed 4700 #define elf32_bed elf32_hppa_netbsd_bed
4708 4701
4709 #include "elf32-target.h" 4702 #include "elf32-target.h"
OLDNEW
« no previous file with comments | « bfd/elf32-h8300.c ('k') | bfd/elf32-i370.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698