diff options
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils-2.23.1/backport/0018-bfd.patch')
-rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.23.1/backport/0018-bfd.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.1/backport/0018-bfd.patch b/meta/recipes-devtools/binutils/binutils-2.23.1/backport/0018-bfd.patch new file mode 100644 index 0000000000..a29f424abf --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.1/backport/0018-bfd.patch | |||
@@ -0,0 +1,78 @@ | |||
1 | From 6a7ec91db1a2a7d60d225ee613c9ebaf1e222acd Mon Sep 17 00:00:00 2001 | ||
2 | From: Roland McGrath <roland@gnu.org> | ||
3 | Date: Wed, 21 Nov 2012 20:14:41 +0000 | ||
4 | Subject: [PATCH 18/27] bfd/ * elf-nacl.c | ||
5 | (segment_nonexecutable_and_has_contents): Renamed to | ||
6 | ... (segment_eligible_for_headers): ... this. | ||
7 | Take new arguments MAXPAGESIZE and | ||
8 | SIZEOF_HEADERS. Return false if the first section's | ||
9 | start address doesn't leave space for the headers. | ||
10 | (nacl_modify_segment_map): Update caller. | ||
11 | |||
12 | --- | ||
13 | bfd/ChangeLog | 8 ++++++++ | ||
14 | bfd/elf-nacl.c | 14 ++++++++++++-- | ||
15 | 2 files changed, 20 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/bfd/ChangeLog b/bfd/ChangeLog | ||
18 | index 59c36a7..cf65838 100644 | ||
19 | --- a/bfd/ChangeLog | ||
20 | +++ b/bfd/ChangeLog | ||
21 | @@ -1,3 +1,11 @@ | ||
22 | +2012-11-21 Roland McGrath <mcgrathr@google.com> | ||
23 | + | ||
24 | + * elf-nacl.c (segment_nonexecutable_and_has_contents): Renamed to ... | ||
25 | + (segment_eligible_for_headers): ... this. Take new arguments | ||
26 | + MAXPAGESIZE and SIZEOF_HEADERS. Return false if the first section's | ||
27 | + start address doesn't leave space for the headers. | ||
28 | + (nacl_modify_segment_map): Update caller. | ||
29 | + | ||
30 | 2012-11-19 Joey Ye <joey.ye@arm.com> | ||
31 | |||
32 | * elf32-arm.c (elf32_arm_final_link_relocate, | ||
33 | diff --git a/bfd/elf-nacl.c b/bfd/elf-nacl.c | ||
34 | index 842e367..04659e7 100644 | ||
35 | --- a/bfd/elf-nacl.c | ||
36 | +++ b/bfd/elf-nacl.c | ||
37 | @@ -42,11 +42,18 @@ segment_executable (struct elf_segment_map *seg) | ||
38 | return FALSE; | ||
39 | } | ||
40 | |||
41 | +/* Determine if this segment is eligible to receive the file and program | ||
42 | + headers. It must be non-executable and have contents. Its first | ||
43 | + section must start far enough past the page boundary to allow space | ||
44 | + for the headers. */ | ||
45 | static bfd_boolean | ||
46 | -segment_nonexecutable_and_has_contents (struct elf_segment_map *seg) | ||
47 | +segment_eligible_for_headers (struct elf_segment_map *seg, | ||
48 | + bfd_vma maxpagesize, bfd_vma sizeof_headers) | ||
49 | { | ||
50 | bfd_boolean any_contents = FALSE; | ||
51 | unsigned int i; | ||
52 | + if (seg->count == 0 || seg->sections[0]->lma % maxpagesize < sizeof_headers) | ||
53 | + return FALSE; | ||
54 | for (i = 0; i < seg->count; ++i) | ||
55 | { | ||
56 | if (seg->sections[i]->flags & SEC_CODE) | ||
57 | @@ -68,6 +75,8 @@ nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info) | ||
58 | struct elf_segment_map **first_load = NULL; | ||
59 | struct elf_segment_map **last_load = NULL; | ||
60 | bfd_boolean moved_headers = FALSE; | ||
61 | + int sizeof_headers = bfd_sizeof_headers (abfd, info); | ||
62 | + bfd_vma maxpagesize = get_elf_backend_data (abfd)->maxpagesize; | ||
63 | |||
64 | if (info != NULL && info->user_phdrs) | ||
65 | /* The linker script used PHDRS explicitly, so don't change what the | ||
66 | @@ -93,7 +102,8 @@ nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info) | ||
67 | /* Now that we've noted the first PT_LOAD, we're looking for | ||
68 | the first non-executable PT_LOAD with a nonempty p_filesz. */ | ||
69 | else if (!moved_headers | ||
70 | - && segment_nonexecutable_and_has_contents (seg)) | ||
71 | + && segment_eligible_for_headers (seg, maxpagesize, | ||
72 | + sizeof_headers)) | ||
73 | { | ||
74 | /* This is the one we were looking for! | ||
75 | |||
76 | -- | ||
77 | 1.7.9.5 | ||
78 | |||