elf64-ppc.c (130562) | elf64-ppc.c (209867) |
---|---|
1/* PowerPC64-specific support for 64-bit ELF. 2 Copyright 1999, 2000, 2001, 2002, 2003, 2004 3 Free Software Foundation, Inc. 4 Written by Linus Nordberg, Swox AB <info@swox.com>, 5 based on elf32-ppc.c by Ian Lance Taylor. 6 Largely rewritten by Alan Modra <amodra@bigpond.net.au> 7 8 This file is part of BFD, the Binary File Descriptor library. --- 3254 unchanged lines hidden (view full) --- 3263 htab->got = bfd_get_section_by_name (htab->elf.dynobj, ".got"); 3264 if (!htab->got) 3265 abort (); 3266 } 3267 3268 flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY 3269 | SEC_LINKER_CREATED); 3270 | 1/* PowerPC64-specific support for 64-bit ELF. 2 Copyright 1999, 2000, 2001, 2002, 2003, 2004 3 Free Software Foundation, Inc. 4 Written by Linus Nordberg, Swox AB <info@swox.com>, 5 based on elf32-ppc.c by Ian Lance Taylor. 6 Largely rewritten by Alan Modra <amodra@bigpond.net.au> 7 8 This file is part of BFD, the Binary File Descriptor library. --- 3254 unchanged lines hidden (view full) --- 3263 htab->got = bfd_get_section_by_name (htab->elf.dynobj, ".got"); 3264 if (!htab->got) 3265 abort (); 3266 } 3267 3268 flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY 3269 | SEC_LINKER_CREATED); 3270 |
3271 got = bfd_make_section (abfd, ".got"); | 3271 got = bfd_make_section_anyway (abfd, ".got"); |
3272 if (!got 3273 || !bfd_set_section_flags (abfd, got, flags) 3274 || !bfd_set_section_alignment (abfd, got, 3)) 3275 return FALSE; 3276 | 3272 if (!got 3273 || !bfd_set_section_flags (abfd, got, flags) 3274 || !bfd_set_section_alignment (abfd, got, 3)) 3275 return FALSE; 3276 |
3277 relgot = bfd_make_section (abfd, ".rela.got"); | 3277 relgot = bfd_make_section_anyway (abfd, ".rela.got"); |
3278 if (!relgot 3279 || ! bfd_set_section_flags (abfd, relgot, flags | SEC_READONLY) 3280 || ! bfd_set_section_alignment (abfd, relgot, 3)) 3281 return FALSE; 3282 3283 ppc64_elf_tdata (abfd)->got = got; 3284 ppc64_elf_tdata (abfd)->relgot = relgot; 3285 return TRUE; --- 2742 unchanged lines hidden (view full) --- 6028 the GOT. */ 6029 s->contents = bfd_zalloc (dynobj, s->_raw_size); 6030 if (s->contents == NULL) 6031 return FALSE; 6032 } 6033 6034 for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) 6035 { | 3278 if (!relgot 3279 || ! bfd_set_section_flags (abfd, relgot, flags | SEC_READONLY) 3280 || ! bfd_set_section_alignment (abfd, relgot, 3)) 3281 return FALSE; 3282 3283 ppc64_elf_tdata (abfd)->got = got; 3284 ppc64_elf_tdata (abfd)->relgot = relgot; 3285 return TRUE; --- 2742 unchanged lines hidden (view full) --- 6028 the GOT. */ 6029 s->contents = bfd_zalloc (dynobj, s->_raw_size); 6030 if (s->contents == NULL) 6031 return FALSE; 6032 } 6033 6034 for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) 6035 { |
6036 /* Skip this BFD if it is not ELF */ 6037 if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) 6038 continue; 6039 |
|
6036 s = ppc64_elf_tdata (ibfd)->got; 6037 if (s != NULL && s != htab->got) 6038 { 6039 s->_cooked_size = 0; 6040 if (s->_raw_size == 0) 6041 _bfd_strip_section_from_output (info, s); 6042 else 6043 { --- 1157 unchanged lines hidden (view full) --- 7201 { 7202 stub_sec->contents = bfd_zalloc (htab->stub_bfd, size); 7203 if (stub_sec->contents == NULL) 7204 return FALSE; 7205 } 7206 stub_sec->_cooked_size = 0; 7207 } 7208 | 6040 s = ppc64_elf_tdata (ibfd)->got; 6041 if (s != NULL && s != htab->got) 6042 { 6043 s->_cooked_size = 0; 6044 if (s->_raw_size == 0) 6045 _bfd_strip_section_from_output (info, s); 6046 else 6047 { --- 1157 unchanged lines hidden (view full) --- 7205 { 7206 stub_sec->contents = bfd_zalloc (htab->stub_bfd, size); 7207 if (stub_sec->contents == NULL) 7208 return FALSE; 7209 } 7210 stub_sec->_cooked_size = 0; 7211 } 7212 |
7209 if (htab->plt != NULL) | 7213 if (htab->glink != NULL && htab->glink->contents != NULL) |
7210 { 7211 unsigned int indx; 7212 bfd_vma plt0; 7213 7214 /* Build the .glink plt call stub. */ 7215 plt0 = (htab->plt->output_section->vma 7216 + htab->plt->output_offset 7217 - (htab->glink->output_section->vma --- 1777 unchanged lines hidden (view full) --- 8995 = PLT_ENTRY_SIZE; 8996 } 8997 8998 /* We need to handle writing out multiple GOT sections ourselves, 8999 since we didn't add them to DYNOBJ. */ 9000 while ((dynobj = dynobj->link_next) != NULL) 9001 { 9002 asection *s; | 7214 { 7215 unsigned int indx; 7216 bfd_vma plt0; 7217 7218 /* Build the .glink plt call stub. */ 7219 plt0 = (htab->plt->output_section->vma 7220 + htab->plt->output_offset 7221 - (htab->glink->output_section->vma --- 1777 unchanged lines hidden (view full) --- 8999 = PLT_ENTRY_SIZE; 9000 } 9001 9002 /* We need to handle writing out multiple GOT sections ourselves, 9003 since we didn't add them to DYNOBJ. */ 9004 while ((dynobj = dynobj->link_next) != NULL) 9005 { 9006 asection *s; |
9007 9008 if (bfd_get_flavour (dynobj) != bfd_target_elf_flavour) 9009 continue; 9010 |
|
9003 s = ppc64_elf_tdata (dynobj)->got; 9004 if (s != NULL 9005 && s->_raw_size != 0 9006 && s->output_section != bfd_abs_section_ptr 9007 && !bfd_set_section_contents (output_bfd, s->output_section, 9008 s->contents, s->output_offset, 9009 s->_raw_size)) 9010 return FALSE; --- 14 unchanged lines hidden --- | 9011 s = ppc64_elf_tdata (dynobj)->got; 9012 if (s != NULL 9013 && s->_raw_size != 0 9014 && s->output_section != bfd_abs_section_ptr 9015 && !bfd_set_section_contents (output_bfd, s->output_section, 9016 s->contents, s->output_offset, 9017 s->_raw_size)) 9018 return FALSE; --- 14 unchanged lines hidden --- |