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

Side by Side Diff: bfd/elf-nacl.c

Issue 56023003: Drop SEC_HAS_CONTENTS condition from section classification for NaCl layout (Closed) Base URL: http://git.chromium.org/native_client/nacl-binutils.git@master
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Native Client support for ELF 1 /* Native Client support for ELF
2 Copyright 2012, 2013 Free Software Foundation, Inc. 2 Copyright 2012, 2013 Free Software Foundation, Inc.
3 3
4 This file is part of BFD, the Binary File Descriptor library. 4 This file is part of BFD, the Binary File Descriptor library.
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or 8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
(...skipping 26 matching lines...) Expand all
37 so we have to look through the sections. */ 37 so we have to look through the sections. */
38 unsigned int i; 38 unsigned int i;
39 for (i = 0; i < seg->count; ++i) 39 for (i = 0; i < seg->count; ++i)
40 if (seg->sections[i]->flags & SEC_CODE) 40 if (seg->sections[i]->flags & SEC_CODE)
41 return TRUE; 41 return TRUE;
42 } 42 }
43 return FALSE; 43 return FALSE;
44 } 44 }
45 45
46 /* Determine if this segment is eligible to receive the file and program 46 /* Determine if this segment is eligible to receive the file and program
47 headers. It must be read-only, non-executable, and have contents. 47 headers. It must be read-only and non-executable.
48 Its first section must start far enough past the page boundary to 48 Its first section must start far enough past the page boundary to
49 allow space for the headers. */ 49 allow space for the headers. */
50 static bfd_boolean 50 static bfd_boolean
51 segment_eligible_for_headers (struct elf_segment_map *seg, 51 segment_eligible_for_headers (struct elf_segment_map *seg,
52 bfd_vma minpagesize, bfd_vma sizeof_headers) 52 bfd_vma minpagesize, bfd_vma sizeof_headers)
53 { 53 {
54 bfd_boolean any_contents = FALSE;
55 unsigned int i; 54 unsigned int i;
56 if (seg->count == 0 || seg->sections[0]->lma % minpagesize < sizeof_headers) 55 if (seg->count == 0 || seg->sections[0]->lma % minpagesize < sizeof_headers)
57 return FALSE; 56 return FALSE;
58 for (i = 0; i < seg->count; ++i) 57 for (i = 0; i < seg->count; ++i)
59 { 58 {
60 if ((seg->sections[i]->flags & (SEC_CODE|SEC_READONLY)) != SEC_READONLY) 59 if ((seg->sections[i]->flags & (SEC_CODE|SEC_READONLY)) != SEC_READONLY)
61 return FALSE; 60 return FALSE;
62 if (seg->sections[i]->flags & SEC_HAS_CONTENTS)
63 any_contents = TRUE;
64 } 61 }
65 return any_contents; 62 return TRUE;
66 } 63 }
67 64
68 65
69 /* We permute the segment_map to get BFD to do the file layout we want: 66 /* We permute the segment_map to get BFD to do the file layout we want:
70 The first non-executable PT_LOAD segment appears first in the file 67 The first non-executable PT_LOAD segment appears first in the file
71 and contains the ELF file header and phdrs. */ 68 and contains the ELF file header and phdrs. */
72 bfd_boolean 69 bfd_boolean
73 nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info) 70 nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
74 { 71 {
75 struct elf_segment_map **m = &elf_tdata (abfd)->segment_map; 72 struct elf_segment_map **m = &elf_tdata (abfd)->segment_map;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 { 333 {
337 /* We don't have a proper way to report an error here. So 334 /* We don't have a proper way to report an error here. So
338 instead fudge things so that elf_write_shdrs_and_ehdr will 335 instead fudge things so that elf_write_shdrs_and_ehdr will
339 fail. */ 336 fail. */
340 elf_elfheader (abfd)->e_shoff = (file_ptr) -1; 337 elf_elfheader (abfd)->e_shoff = (file_ptr) -1;
341 } 338 }
342 339
343 free (fill); 340 free (fill);
344 } 341 }
345 } 342 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698