Get rid of CT_CC_FILE.
/trunk/scripts/build/cc/gcc.sh | 52 26 26 0 ++++++++++++++++++++++++------------------------
/trunk/scripts/crosstool.sh | 1 0 1 0 -
2 files changed, 26 insertions(+), 27 deletions(-)
1 Original patch from Gentoo:
2 gentoo/src/patchsets/binutils/2.19/63_all_binutils-2.19-pt-pax-flags-20081101.patch
4 diff -durN binutils-2.19.orig/bfd/elf-bfd.h binutils-2.19/bfd/elf-bfd.h
5 --- binutils-2.19.orig/bfd/elf-bfd.h 2008-08-21 01:28:58.000000000 +0200
6 +++ binutils-2.19/bfd/elf-bfd.h 2008-11-23 16:31:09.000000000 +0100
8 /* Segment flags for the PT_GNU_STACK segment. */
9 unsigned int stack_flags;
11 + /* Segment flags for the PT_PAX_FLAGS segment. */
12 + unsigned int pax_flags;
14 /* Symbol version definitions in external objects. */
15 Elf_Internal_Verdef *verdef;
17 diff -durN binutils-2.19.orig/bfd/elf.c binutils-2.19/bfd/elf.c
18 --- binutils-2.19.orig/bfd/elf.c 2008-10-09 14:18:23.000000000 +0200
19 +++ binutils-2.19/bfd/elf.c 2008-11-23 16:31:09.000000000 +0100
21 case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
22 case PT_GNU_STACK: pt = "STACK"; break;
23 case PT_GNU_RELRO: pt = "RELRO"; break;
24 + case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
25 default: pt = NULL; break;
30 return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
33 + return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
36 /* Check for any processor-specific program segment types. */
37 bed = get_elf_backend_data (abfd);
38 @@ -3404,6 +3408,11 @@
43 + /* We need a PT_PAX_FLAGS segment. */
47 for (s = abfd->sections; s != NULL; s = s->next)
49 if ((s->flags & SEC_LOAD) != 0
50 @@ -3983,6 +3992,20 @@
55 + amt = sizeof (struct elf_segment_map);
56 + m = bfd_zalloc (abfd, amt);
60 + m->p_type = PT_PAX_FLAGS;
61 + m->p_flags = elf_tdata (abfd)->pax_flags;
62 + m->p_flags_valid = 1;
69 elf_tdata (abfd)->segment_map = mfirst;
72 6. PT_TLS segment includes only SHF_TLS sections.
73 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
74 8. PT_DYNAMIC should not contain empty sections at the beginning
75 - (with the possible exception of .dynamic). */
76 + (with the possible exception of .dynamic).
77 + 9. PT_PAX_FLAGS segments does not include any sections. */
78 #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
79 ((((segment->p_paddr \
80 ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
82 && (section->flags & SEC_ALLOC) != 0) \
83 || IS_NOTE (segment, section)) \
84 && segment->p_type != PT_GNU_STACK \
85 + && segment->p_type != PT_PAX_FLAGS \
86 && (segment->p_type != PT_TLS \
87 || (section->flags & SEC_THREAD_LOCAL)) \
88 && (segment->p_type == PT_LOAD \
89 diff -durN binutils-2.19.orig/bfd/elflink.c binutils-2.19/bfd/elflink.c
90 --- binutils-2.19.orig/bfd/elflink.c 2008-08-22 10:32:39.000000000 +0200
91 +++ binutils-2.19/bfd/elflink.c 2008-11-23 16:31:09.000000000 +0100
92 @@ -5397,16 +5397,30 @@
95 bed = get_elf_backend_data (output_bfd);
96 + elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
99 + elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
100 + else if (info->noexecheap)
101 + elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
104 - elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
106 + elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
107 + elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
109 else if (info->noexecstack)
110 - elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
112 + elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
113 + elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
118 asection *notesec = NULL;
121 + elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
122 for (inputobj = info->input_bfds;
124 inputobj = inputobj->link_next)
125 @@ -5419,7 +5433,11 @@
128 if (s->flags & SEC_CODE)
131 + elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
132 + elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
137 else if (bed->default_execstack)
138 diff -durN binutils-2.19.orig/binutils/readelf.c binutils-2.19/binutils/readelf.c
139 --- binutils-2.19.orig/binutils/readelf.c 2008-09-17 11:00:44.000000000 +0200
140 +++ binutils-2.19/binutils/readelf.c 2008-11-23 16:31:09.000000000 +0100
141 @@ -2505,6 +2505,7 @@
142 return "GNU_EH_FRAME";
143 case PT_GNU_STACK: return "GNU_STACK";
144 case PT_GNU_RELRO: return "GNU_RELRO";
145 + case PT_PAX_FLAGS: return "PAX_FLAGS";
148 if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
149 diff -durN binutils-2.19.orig/include/bfdlink.h binutils-2.19/include/bfdlink.h
150 --- binutils-2.19.orig/include/bfdlink.h 2008-08-17 05:12:50.000000000 +0200
151 +++ binutils-2.19/include/bfdlink.h 2008-11-23 16:31:09.000000000 +0100
153 /* TRUE if PT_GNU_RELRO segment should be created. */
154 unsigned int relro: 1;
156 + /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
158 + unsigned int execheap: 1;
160 + /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
162 + unsigned int noexecheap: 1;
164 /* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
165 unsigned int warn_shared_textrel: 1;
167 diff -durN binutils-2.19.orig/include/elf/common.h binutils-2.19/include/elf/common.h
168 --- binutils-2.19.orig/include/elf/common.h 2008-08-04 01:20:42.000000000 +0200
169 +++ binutils-2.19/include/elf/common.h 2008-11-23 16:31:09.000000000 +0100
171 #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
172 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
173 #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
174 +#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */
176 /* Program segment permissions, in program header p_flags field. */
179 #define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
180 #define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
182 +/* Flags to control PaX behavior. */
184 +#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
185 +#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
186 +#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
187 +#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
188 +#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
189 +#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
190 +#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
191 +#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
192 +#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
193 +#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
194 +#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
195 +#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
197 /* Values for section header, sh_type field. */
199 #define SHT_NULL 0 /* Section header table entry unused */
200 diff -durN binutils-2.19.orig/ld/emultempl/elf32.em binutils-2.19/ld/emultempl/elf32.em
201 --- binutils-2.19.orig/ld/emultempl/elf32.em 2008-11-23 16:30:36.000000000 +0100
202 +++ binutils-2.19/ld/emultempl/elf32.em 2008-11-23 16:31:09.000000000 +0100
203 @@ -2146,6 +2146,16 @@
204 link_info.noexecstack = TRUE;
205 link_info.execstack = FALSE;
207 + else if (strcmp (optarg, "execheap") == 0)
209 + link_info.execheap = TRUE;
210 + link_info.noexecheap = FALSE;
212 + else if (strcmp (optarg, "noexecheap") == 0)
214 + link_info.noexecheap = TRUE;
215 + link_info.execheap = FALSE;
219 if test -n "$COMMONPAGESIZE"; then
220 @@ -2229,6 +2239,8 @@
222 -z execstack Mark executable as requiring executable stack\n"));
224 + -z execheap\t\tMark executable as requiring executable heap\n"));
225 + fprintf (file, _("\
226 -z initfirst Mark DSO to be initialized first at runtime\n"));
228 -z interpose Mark object to interpose all DSOs but executable\n"));
229 @@ -2252,6 +2264,8 @@
230 -z nodump Mark DSO not available to dldump\n"));
232 -z noexecstack Mark executable as not requiring executable stack\n"));
233 + fprintf (file, _("\
234 + -z noexecheap\tMark executable as not requiring executable heap\n"));
237 if test -n "$COMMONPAGESIZE"; then
238 diff -durN binutils-2.19.orig/ld/ldgram.y binutils-2.19/ld/ldgram.y
239 --- binutils-2.19.orig/ld/ldgram.y 2008-07-06 15:38:36.000000000 +0200
240 +++ binutils-2.19/ld/ldgram.y 2008-11-23 16:31:09.000000000 +0100
241 @@ -1112,6 +1112,8 @@
242 $$ = exp_intop (0x6474e550);
243 else if (strcmp (s, "PT_GNU_STACK") == 0)
244 $$ = exp_intop (0x6474e551);
245 + else if (strcmp (s, "PT_PAX_FLAGS") == 0)
246 + $$ = exp_intop (0x65041580);