cleanup PT_GNU_STACK size handling
Nathan Sidwell
nathan_sidwell@mentor.com
Tue Oct 16 14:45:00 GMT 2012
In working on a uclinux port, I came across the hacks that are in the current 5
uclinux backends of bfd (bfin, frv, lm32, sh, tic6x).
The kernel relies on a non-zero memsz in a PT_GNU_STACK segment to know how much
stack to allocate.
They all have the same set of overrides
* modify_program_headers, munge the hdrs, updating a PT_GNU_STACK segment.
* always_size_sections, looking for __stacksize variable and defaulting or
setting it, if it is unset.
* copy_private_data, propagating a PT_GNU_STACK segment size
That's quite a bunch of duplicated code, and I find the way of overriding the
default via '--defsym __stacksize=VALUE' rather unpleasant. Actually, it
doesn't work, because such a defsym gets a type NOTYPE and the check in
always_size_sections for 'h->type == STT_OBJECT' fails. One ends up with a
duplicate symbol error. I have no idea how long that's been broken.
Anyway, this patch removes all that duplicate code and adds a new way of setting
the stack size. I found the handling of the EXEC flag on PT_GNU_STACK somewhat
random too, and have tried to clean that up and contain it in one place.
*) a new elf linker option '-z stack-size=VALUE'. This is available to all elf
backends. This is passed via a new field in link_info. We distinguish between
'user said zero' and 'use the default', by using the value -1 for the former and
zero for the latter. This is a little ugly, but seemed to be the best way to
ensure default initialize to zero did the right thing.
*) a new elf backend default, elf_backend_stack_align, to set the default
alignment. I defaulted this to 16.
*) In bfd_elf_map_sections_to_segments, when creating the PT_GNU_STACK segment,
we copy the backends alignment, and the link info's stack size.
*) In assign_file_positions_for_non_load_sections, we set the p_memsz value for
a PT_GNU_STACK segment.
*) In copy_elf_program_header we propagate the memsz field likewise. This and
the previous 3 changes allow removal of the uclinux backend's overriding of
modify_program_headers and copy_private_data.
*) Add a new function 'bfd_elf_stack_segment_size' to elflink.c. This sets the
linkinfo size from __stacksize or default, unless it was specified by the user
already. It'd be nice to get rid of the __stacksize handling (given it doesn't
apparently work), but I thought that might be a change too far. Rather than
unconditionally set __stacksize, we only set it if it is undefined (i.e. it's
referenced from somewhere). It is an error to define __stacksize and use '-z
stack-size='
*) Modify bfd_elf_size_dynamic_sections. First, move the handling of
PT_GNU_STACK segment flags to after the backend's size_sections hook has been
called. The logic there's been rewritten to avoid things like creating a
PT_GNU_STACK for -z noexecstack with no size specified. We set the segment
flags if it needs to be executable, or the size is non-zero.
Then I changed all the uclinux backends to remove the now unneeded hooks, and
have the always_size_sections hook call the new bfd_elf_stack_segment_size helper.
I tested this on i686-pc-linux-gnu and all the above mentioned uclinux backends.
There was one progression (ld-sh/fdpic-stack-size, the above-mentioned problem
with '--defsym __stacksize') The new tests pass. I manually checked that
objcopy et all preserved PT_GNU_STACK memsz, but my dejagnu-fu was insufficient
to automate that.
Comments? Ok?
nathan
--
Nathan Sidwell
-------------- next part --------------
2012-10-15 Nathan Sidwell <nathan@codesourcery.com>
bfd/
* bfd-in.h (bfd_elf_stack_segment_size): Declare.
* bfd-in2.h: Rebuilt.
* elfxx-target.h (elf_backend_stack_align): New.
(elfNN_bed): Add it.
* elf-bfd.h (struct elf_backend_data): Add stack_align field.
* elf.c (bfd_elf_map_sections_to_segments): Pay attention to
stack_align and stacksize for PT_GNU_STACK segment.
(assign_file_positions_for_non_load_sections): Set p_memsz for
PT_GNU_STACK segment.
(copy_elf_program_header): Copy PT_GNU_STACK size.
* elflink.c (bfd_elf_stack_segment_size): New function, taken from
uclinux backends.
(bfd_elf_size_dynamic_sections): Determine
PT_GNU_STACK requirements after calling backend. Pay attention to
stacksize.
* elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call
bfd_elf_stack_segment_size.
(elf32_bfinfdpic_modify_program_headers): Delete.
(elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK
here.
(elf_backend_stack_align): Override.
(elf_backend_modify_program_headers): Don't override.
* elf32-frv.c (frvfdpic_always_size_sections): Call
bfd_elf_stack_segment_size.
(elf32_frvfdpic_modify_program_headers): Delete.
(elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK
here.
(elf_backend_stack_align): Override.
(elf_backend_modify_program_headers): Don't override.
* elf32-lm32.c (lm32_elf_always_size_sections): Leave
PT_GNU_STACK creation to underlying elf support. Check
__stacksize here for backwards compatibility, and set it if
needed.
(lm32_elf_modify_segment_map): Delete.
(lm32_elf_modify_program_headers): Delete.
(elf_backend_stack_align): Override.
(elf_backend_modify_segment_map): Don't override.
(elf_backend_modify_program_headers): Don't override.
* elf32-sh.c (sh_elf_always_size_sections): Call
bfd_elf_stack_segment_size.
(sh_elf_modify_program_headers): Delete.
(sh_elf_copy_private_data): Don't copy PT_GNU_STACK
here.
(elf_backend_stack_align): Override.
(elf_backend_modify_program_headers): Don't override.
* elf32-tic6x.c (elf32_tic6x_always_size_sections): Call
bfd_elf_stack_segment_size.
(elf32_tic6x_modify_program_headers): Delete.
(elf32_tic6x_copy_private_data): Delete.
(elf_backend_stack_align): Override.
(bfd_elf32_bfd_copy_private_bfd_data): Don't override.
(elf_backend_modify_program_headers): Don't override.
include/
* bfdlink.h (struct bfd_link_info): Add stacksize option.
ld/
* ld.texinfo (stack-size): New option.
* emultempl/elf32.em: Add stack-size option.
ld/testsuite/
* ld-elf/binutils.exp: Add -z stack-size=0.
* ld-elf/elf.exp: Add stack-exec and stack-size tests.
* ld-elf/orphan-region.d: Add stack-size and no-exec
options. Remove xfail.
* ld-elf/stack-exec.rd: New.
* ld-elf/stack-size.rd: New.
* ld-elf/stack.s: New.
* ld-scripts/empty-aligned.d: Add stack-size and no-exec options.
* ld-sh/fdpic-stack-set.d: New.
* ld-tic6x/shlib-1.rd: Remove __stacksize symbol.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1.rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
* ld-tic6x/static-app-1.rd: Likewise.
* ld-tic6x/static-app-1b.rd: Likewise.
* ld-tic6x/static-app-1r.rd: Likewise.
* ld-tic6x/static-app-1rb.rd: Likewise.
Index: bfd/bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.168
diff -c -3 -p -r1.168 bfd-in.h
*** bfd/bfd-in.h 13 Aug 2012 14:52:34 -0000 1.168
--- bfd/bfd-in.h 16 Oct 2012 13:34:18 -0000
*************** extern struct bfd_link_needed_list *bfd_
*** 648,653 ****
--- 648,655 ----
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_get_bfd_needed_list
(bfd *, struct bfd_link_needed_list **);
+ extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
+ const char *, bfd_vma);
extern bfd_boolean bfd_elf_size_dynamic_sections
(bfd *, const char *, const char *, const char *, const char *, const char *,
const char * const *, struct bfd_link_info *, struct bfd_section **);
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.586
diff -c -3 -p -r1.586 bfd-in2.h
*** bfd/bfd-in2.h 13 Sep 2012 11:09:02 -0000 1.586
--- bfd/bfd-in2.h 16 Oct 2012 13:34:20 -0000
*************** extern struct bfd_link_needed_list *bfd_
*** 655,660 ****
--- 655,662 ----
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_get_bfd_needed_list
(bfd *, struct bfd_link_needed_list **);
+ extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
+ const char *, bfd_vma);
extern bfd_boolean bfd_elf_size_dynamic_sections
(bfd *, const char *, const char *, const char *, const char *, const char *,
const char * const *, struct bfd_link_info *, struct bfd_section **);
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.347
diff -c -3 -p -r1.347 elf-bfd.h
*** bfd/elf-bfd.h 19 Sep 2012 00:53:27 -0000 1.347
--- bfd/elf-bfd.h 16 Oct 2012 13:34:21 -0000
*************** struct elf_backend_data
*** 1285,1290 ****
--- 1285,1293 ----
/* This is non-zero if static TLS segments require a special alignment. */
unsigned static_tls_alignment;
+ /* Alignment for the PT_GNU_STACK segment. */
+ unsigned stack_align;
+
/* This is TRUE if the linker should act like collect and gather
global constructors and destructors by name. This is TRUE for
MIPS ELF because the Irix 5 tools can not handle the .init
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.571
diff -c -3 -p -r1.571 elf.c
*** bfd/elf.c 7 Oct 2012 23:59:26 -0000 1.571
--- bfd/elf.c 16 Oct 2012 13:34:24 -0000
*************** _bfd_elf_map_sections_to_segments (bfd *
*** 4137,4144 ****
m->next = NULL;
m->p_type = PT_GNU_STACK;
m->p_flags = elf_tdata (abfd)->stack_flags;
m->p_flags_valid = 1;
!
*pm = m;
pm = &m->next;
}
--- 4137,4151 ----
m->next = NULL;
m->p_type = PT_GNU_STACK;
m->p_flags = elf_tdata (abfd)->stack_flags;
+ m->p_align = bed->stack_align;
m->p_flags_valid = 1;
! m->p_align_valid = m->p_align != 0;
! if (info->stacksize > 0)
! {
! m->p_size = info->stacksize;
! m->p_size_valid = 1;
! }
!
*pm = m;
pm = &m->next;
}
*************** assign_file_positions_for_non_load_secti
*** 5019,5024 ****
--- 5026,5036 ----
p->p_type = PT_NULL;
}
}
+ else if (p->p_type == PT_GNU_STACK)
+ {
+ if (m->p_size_valid)
+ p->p_memsz = m->p_size;
+ }
else if (m->count != 0)
{
if (p->p_type != PT_LOAD
*************** copy_elf_program_header (bfd *ibfd, bfd
*** 6163,6174 ****
map->p_align_valid = 1;
map->p_vaddr_offset = 0;
! if (map->p_type == PT_GNU_RELRO)
{
/* The PT_GNU_RELRO segment may contain the first a few
bytes in the .got.plt section even if the whole .got.plt
section isn't in the PT_GNU_RELRO segment. We won't
! change the size of the PT_GNU_RELRO segment. */
map->p_size = segment->p_memsz;
map->p_size_valid = 1;
}
--- 6175,6189 ----
map->p_align_valid = 1;
map->p_vaddr_offset = 0;
! if (map->p_type == PT_GNU_RELRO
! || map->p_type == PT_GNU_STACK)
{
/* The PT_GNU_RELRO segment may contain the first a few
bytes in the .got.plt section even if the whole .got.plt
section isn't in the PT_GNU_RELRO segment. We won't
! change the size of the PT_GNU_RELRO segment.
! Similarly, PT_GNU_STACK size is significant on uclinux
! systems. */
map->p_size = segment->p_memsz;
map->p_size_valid = 1;
}
Index: bfd/elf32-bfin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-bfin.c,v
retrieving revision 1.59
diff -c -3 -p -r1.59 elf32-bfin.c
*** bfd/elf32-bfin.c 13 Jul 2012 14:22:46 -0000 1.59
--- bfd/elf32-bfin.c 16 Oct 2012 13:34:25 -0000
*************** static bfd_boolean
*** 4311,4345 ****
elf32_bfinfdpic_always_size_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
! if (!info->relocatable)
! {
! struct elf_link_hash_entry *h;
!
! /* Force a PT_GNU_STACK segment to be created. */
! if (! elf_tdata (output_bfd)->stack_flags)
! elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
!
! /* Define __stacksize if it's not defined yet. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! if (! h || h->root.type != bfd_link_hash_defined
! || h->type != STT_OBJECT
! || !h->def_regular)
! {
! struct bfd_link_hash_entry *bh = NULL;
!
! if (!(_bfd_generic_link_add_one_symbol
! (info, output_bfd, "__stacksize",
! BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
! (const char *) NULL, FALSE,
! get_elf_backend_data (output_bfd)->collect, &bh)))
! return FALSE;
!
! h = (struct elf_link_hash_entry *) bh;
! h->def_regular = 1;
! h->type = STT_OBJECT;
! }
! }
return TRUE;
}
--- 4311,4320 ----
elf32_bfinfdpic_always_size_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
! if (!info->relocatable
! && !bfd_elf_stack_segment_size (output_bfd, info,
! "__stacksize", DEFAULT_STACK_SIZE))
! return FALSE;
return TRUE;
}
*************** bfinfdpic_elf_discard_info (bfd *ibfd,
*** 4460,4510 ****
}
static bfd_boolean
- elf32_bfinfdpic_modify_program_headers (bfd *output_bfd,
- struct bfd_link_info *info)
- {
- struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
- /* objcopy and strip preserve what's already there using
- elf32_bfinfdpic_copy_private_bfd_data (). */
- if (! info)
- return TRUE;
-
- for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
- if (m->p_type == PT_GNU_STACK)
- break;
-
- if (m)
- {
- struct elf_link_hash_entry *h;
-
- /* Obtain the pointer to the __stacksize symbol. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, FALSE);
- if (h)
- {
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- BFD_ASSERT (h->root.type == bfd_link_hash_defined);
- }
-
- /* Set the header p_memsz from the symbol value. We
- intentionally ignore the symbol section. */
- if (h && h->root.type == bfd_link_hash_defined)
- p->p_memsz = h->root.u.def.value;
- else
- p->p_memsz = DEFAULT_STACK_SIZE;
-
- p->p_align = 8;
- }
-
- return TRUE;
- }
-
- static bfd_boolean
elf32_bfinfdpic_finish_dynamic_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
--- 4435,4440 ----
*************** bfin_elf_copy_private_bfd_data (bfd *ibf
*** 5017,5024 ****
static bfd_boolean
elf32_bfinfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
- unsigned i;
-
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
--- 4947,4952 ----
*************** elf32_bfinfdpic_copy_private_bfd_data (b
*** 5030,5060 ****
|| ! elf_tdata (obfd) || ! elf_tdata (obfd)->phdr)
return TRUE;
- /* Copy the stack size. */
- for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
- if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
- for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
- if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
- /* Rewrite the phdrs, since we're only called after they
- were first written. */
- if (bfd_seek (obfd, (bfd_signed_vma) get_elf_backend_data (obfd)
- ->s->sizeof_ehdr, SEEK_SET) != 0
- || get_elf_backend_data (obfd)->s
- ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
- elf_elfheader (obfd)->e_phnum) != 0)
- return FALSE;
- break;
- }
-
- break;
- }
-
return TRUE;
}
--- 4958,4963 ----
*************** struct bfd_elf_special_section const elf
*** 5802,5807 ****
--- 5705,5711 ----
#define elf_backend_final_write_processing \
elf32_bfin_final_write_processing
#define elf_backend_reloc_type_class elf32_bfin_reloc_type_class
+ #define elf_backend_stack_align 8
#define elf_backend_can_gc_sections 1
#define elf_backend_special_sections elf32_bfin_special_sections
#define elf_backend_can_refcount 1
*************** struct bfd_elf_special_section const elf
*** 5837,5845 ****
#undef elf_backend_always_size_sections
#define elf_backend_always_size_sections \
elf32_bfinfdpic_always_size_sections
- #undef elf_backend_modify_program_headers
- #define elf_backend_modify_program_headers \
- elf32_bfinfdpic_modify_program_headers
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data \
elf32_bfinfdpic_copy_private_bfd_data
--- 5741,5746 ----
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.78
diff -c -3 -p -r1.78 elf32-frv.c
*** bfd/elf32-frv.c 13 Jul 2012 14:22:46 -0000 1.78
--- bfd/elf32-frv.c 16 Oct 2012 13:34:27 -0000
*************** static bfd_boolean
*** 5494,5529 ****
elf32_frvfdpic_always_size_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
! if (!info->relocatable)
! {
! struct elf_link_hash_entry *h;
!
! /* Force a PT_GNU_STACK segment to be created. */
! if (! elf_tdata (output_bfd)->stack_flags)
! elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
!
! /* Define __stacksize if it's not defined yet. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! if (! h || h->root.type != bfd_link_hash_defined
! || h->type != STT_OBJECT
! || !h->def_regular)
! {
! struct bfd_link_hash_entry *bh = NULL;
!
! if (!(_bfd_generic_link_add_one_symbol
! (info, output_bfd, "__stacksize",
! BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
! (const char *) NULL, FALSE,
! get_elf_backend_data (output_bfd)->collect, &bh)))
! return FALSE;
!
! h = (struct elf_link_hash_entry *) bh;
! h->def_regular = 1;
! h->type = STT_OBJECT;
! /* This one must NOT be hidden. */
! }
! }
return TRUE;
}
--- 5494,5503 ----
elf32_frvfdpic_always_size_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
! if (!info->relocatable
! && !bfd_elf_stack_segment_size (output_bfd, info,
! "__stacksize", DEFAULT_STACK_SIZE))
! return FALSE;
return TRUE;
}
*************** elf32_frvfdpic_relax_section (bfd *abfd
*** 5720,5770 ****
return TRUE;
}
- static bfd_boolean
- elf32_frvfdpic_modify_program_headers (bfd *output_bfd,
- struct bfd_link_info *info)
- {
- struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
- /* objcopy and strip preserve what's already there using
- elf32_frvfdpic_copy_private_bfd_data (). */
- if (! info)
- return TRUE;
-
- for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
- if (m->p_type == PT_GNU_STACK)
- break;
-
- if (m)
- {
- struct elf_link_hash_entry *h;
-
- /* Obtain the pointer to the __stacksize symbol. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, FALSE);
- if (h)
- {
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- BFD_ASSERT (h->root.type == bfd_link_hash_defined);
- }
-
- /* Set the header p_memsz from the symbol value. We
- intentionally ignore the symbol section. */
- if (h && h->root.type == bfd_link_hash_defined)
- p->p_memsz = h->root.u.def.value;
- else
- p->p_memsz = DEFAULT_STACK_SIZE;
-
- p->p_align = 8;
- }
-
- return TRUE;
- }
-
/* Fill in code and data in dynamic sections. */
static bfd_boolean
--- 5694,5699 ----
*************** frv_elf_arch_extension_p (flagword base,
*** 6431,6438 ****
static bfd_boolean
elf32_frvfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
- unsigned i;
-
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
--- 6360,6365 ----
*************** elf32_frvfdpic_copy_private_bfd_data (bf
*** 6444,6474 ****
|| ! elf_tdata (obfd) || ! elf_tdata (obfd)->phdr)
return TRUE;
- /* Copy the stack size. */
- for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
- if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
- for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
- if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
- /* Rewrite the phdrs, since we're only called after they
- were first written. */
- if (bfd_seek (obfd, (bfd_signed_vma) get_elf_backend_data (obfd)
- ->s->sizeof_ehdr, SEEK_SET) != 0
- || get_elf_backend_data (obfd)->s
- ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
- elf_elfheader (obfd)->e_phnum) != 0)
- return FALSE;
- break;
- }
-
- break;
- }
-
return TRUE;
}
--- 6371,6376 ----
*************** elf32_frv_grok_psinfo (bfd *abfd, Elf_In
*** 6920,6925 ****
--- 6822,6828 ----
#define elf_backend_object_p elf32_frv_object_p
#define elf_backend_add_symbol_hook elf32_frv_add_symbol_hook
+ #define elf_backend_stack_align 8
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
*************** elf32_frv_grok_psinfo (bfd *abfd, Elf_In
*** 6964,6972 ****
#undef elf_backend_always_size_sections
#define elf_backend_always_size_sections \
elf32_frvfdpic_always_size_sections
- #undef elf_backend_modify_program_headers
- #define elf_backend_modify_program_headers \
- elf32_frvfdpic_modify_program_headers
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data \
elf32_frvfdpic_copy_private_bfd_data
--- 6867,6872 ----
Index: bfd/elf32-lm32.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-lm32.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 elf32-lm32.c
*** bfd/elf32-lm32.c 2 Sep 2012 12:17:26 -0000 1.16
--- bfd/elf32-lm32.c 16 Oct 2012 13:34:28 -0000
*************** lm32_elf_copy_indirect_symbol (struct bf
*** 2615,2749 ****
}
static bfd_boolean
! lm32_elf_always_size_sections (bfd *output_bfd,
! struct bfd_link_info *info)
{
if (!info->relocatable)
{
! struct elf_link_hash_entry *h;
- /* Force a PT_GNU_STACK segment to be created. */
- if (! elf_tdata (output_bfd)->stack_flags)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
-
- /* Define __stacksize if it's not defined yet. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, FALSE);
- if (! h || h->root.type != bfd_link_hash_defined
- || h->type != STT_OBJECT
- || !h->def_regular)
- {
- struct bfd_link_hash_entry *bh = NULL;
-
- if (!(_bfd_generic_link_add_one_symbol
- (info, output_bfd, "__stacksize",
- BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
- (const char *) NULL, FALSE,
- get_elf_backend_data (output_bfd)->collect, &bh)))
- return FALSE;
-
- h = (struct elf_link_hash_entry *) bh;
- h->def_regular = 1;
- h->type = STT_OBJECT;
- /* This one must NOT be hidden. */
- }
- }
-
- return TRUE;
- }
-
- static bfd_boolean
- lm32_elf_modify_segment_map (bfd *output_bfd,
- struct bfd_link_info *info)
- {
- struct elf_segment_map *m;
-
- /* objcopy and strip preserve what's already there using elf32_lm32fdpic_copy_
- private_bfd_data (). */
- if (! info)
- return TRUE;
-
- for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_GNU_STACK)
- break;
-
- if (m)
- {
asection *sec = bfd_get_section_by_name (output_bfd, ".stack");
- struct elf_link_hash_entry *h;
-
if (sec)
! {
! /* Obtain the pointer to the __stacksize symbol. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! while (h->root.type == bfd_link_hash_indirect
! || h->root.type == bfd_link_hash_warning)
! h = (struct elf_link_hash_entry *)h->root.u.i.link;
! BFD_ASSERT (h->root.type == bfd_link_hash_defined);
!
! /* Set the section size from the symbol value. We
! intentionally ignore the symbol section. */
! if (h->root.type == bfd_link_hash_defined)
! sec->size = h->root.u.def.value;
! else
! sec->size = DEFAULT_STACK_SIZE;
!
! /* Add the stack section to the PT_GNU_STACK segment,
! such that its size and alignment requirements make it
! to the segment. */
! m->sections[m->count] = sec;
! m->count++;
! }
! }
!
! return TRUE;
! }
!
! static bfd_boolean
! lm32_elf_modify_program_headers (bfd *output_bfd,
! struct bfd_link_info *info)
! {
! struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
! struct elf_segment_map *m;
! Elf_Internal_Phdr *p;
!
! if (! info)
! return TRUE;
!
! for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
! if (m->p_type == PT_GNU_STACK)
! break;
!
! if (m)
! {
! struct elf_link_hash_entry *h;
!
! /* Obtain the pointer to the __stacksize symbol. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! if (h)
! {
! while (h->root.type == bfd_link_hash_indirect
! || h->root.type == bfd_link_hash_warning)
! h = (struct elf_link_hash_entry *) h->root.u.i.link;
! BFD_ASSERT (h->root.type == bfd_link_hash_defined);
! }
!
! /* Set the header p_memsz from the symbol value. We
! intentionally ignore the symbol section. */
! if (h && h->root.type == bfd_link_hash_defined)
! p->p_memsz = h->root.u.def.value;
! else
! p->p_memsz = DEFAULT_STACK_SIZE;
!
! p->p_align = 8;
}
return TRUE;
}
-
static bfd_boolean
lm32_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
--- 2615,2636 ----
}
static bfd_boolean
! lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
{
if (!info->relocatable)
{
! if (!bfd_elf_stack_segment_size (output_bfd, info,
! "__stacksize", DEFAULT_STACK_SIZE))
! return FALSE;
asection *sec = bfd_get_section_by_name (output_bfd, ".stack");
if (sec)
! sec->size = info->stacksize >= 0 ? info->stacksize : 0;
}
return TRUE;
}
static bfd_boolean
lm32_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
*************** lm32_elf_fdpic_copy_private_bfd_data (bf
*** 2822,2827 ****
--- 2709,2715 ----
#define elf_backend_rela_normal 1
#define elf_backend_object_p lm32_elf_object_p
#define elf_backend_final_write_processing lm32_elf_final_write_processing
+ #define elf_backend_stack_align 8
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
#define elf_backend_gc_mark_hook lm32_elf_gc_mark_hook
*************** lm32_elf_fdpic_copy_private_bfd_data (bf
*** 2857,2866 ****
#undef elf_backend_always_size_sections
#define elf_backend_always_size_sections lm32_elf_always_size_sections
- #undef elf_backend_modify_segment_map
- #define elf_backend_modify_segment_map lm32_elf_modify_segment_map
- #undef elf_backend_modify_program_headers
- #define elf_backend_modify_program_headers lm32_elf_modify_program_headers
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data lm32_elf_fdpic_copy_private_bfd_data
--- 2745,2750 ----
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.182
diff -c -3 -p -r1.182 elf32-sh.c
*** bfd/elf32-sh.c 2 Sep 2012 12:17:26 -0000 1.182
--- bfd/elf32-sh.c 16 Oct 2012 13:34:30 -0000
*************** sh_elf_always_size_sections (bfd *output
*** 3314,3399 ****
{
sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, info->shared);
! if (sh_elf_hash_table (info)->fdpic_p && !info->relocatable)
! {
! struct elf_link_hash_entry *h;
!
! /* Force a PT_GNU_STACK segment to be created. */
! if (! elf_tdata (output_bfd)->stack_flags)
! elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
!
! /* Define __stacksize if it's not defined yet. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! if (! h || h->root.type != bfd_link_hash_defined
! || h->type != STT_OBJECT
! || !h->def_regular)
! {
! struct bfd_link_hash_entry *bh = NULL;
!
! if (!(_bfd_generic_link_add_one_symbol
! (info, output_bfd, "__stacksize",
! BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
! (const char *) NULL, FALSE,
! get_elf_backend_data (output_bfd)->collect, &bh)))
! return FALSE;
!
! h = (struct elf_link_hash_entry *) bh;
! h->def_regular = 1;
! h->type = STT_OBJECT;
! }
! }
! return TRUE;
! }
!
! #if !defined INCLUDE_SHMEDIA && !defined SH_TARGET_ALREADY_DEFINED
!
! static bfd_boolean
! sh_elf_modify_program_headers (bfd *output_bfd, struct bfd_link_info *info)
! {
! struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
! struct elf_segment_map *m;
! Elf_Internal_Phdr *p;
!
! /* objcopy and strip preserve what's already there using
! sh_elf_copy_private_bfd_data (). */
! if (! info)
! return TRUE;
!
! for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
! if (m->p_type == PT_GNU_STACK)
! break;
!
! if (m)
! {
! struct elf_link_hash_entry *h;
!
! /* Obtain the pointer to the __stacksize symbol. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! if (h)
! {
! while (h->root.type == bfd_link_hash_indirect
! || h->root.type == bfd_link_hash_warning)
! h = (struct elf_link_hash_entry *) h->root.u.i.link;
! BFD_ASSERT (h->root.type == bfd_link_hash_defined);
! }
!
! /* Set the header p_memsz from the symbol value. We
! intentionally ignore the symbol section. */
! if (h && h->root.type == bfd_link_hash_defined)
! p->p_memsz = h->root.u.def.value;
! else
! p->p_memsz = DEFAULT_STACK_SIZE;
!
! p->p_align = 8;
! }
!
return TRUE;
}
- #endif
-
/* Set the sizes of the dynamic sections. */
static bfd_boolean
--- 3314,3326 ----
{
sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, info->shared);
! if (sh_elf_hash_table (info)->fdpic_p && !info->relocatable
! && !bfd_elf_stack_segment_size (output_bfd, info,
! "__stacksize", DEFAULT_STACK_SIZE))
! return FALSE;
return TRUE;
}
/* Set the sizes of the dynamic sections. */
static bfd_boolean
*************** sh_elf_copy_private_data (bfd * ibfd, bf
*** 6683,6720 ****
if (! is_sh_elf (ibfd) || ! is_sh_elf (obfd))
return TRUE;
- /* Copy the stack size. */
- if (elf_tdata (ibfd)->phdr && elf_tdata (obfd)->phdr
- && fdpic_object_p (ibfd) && fdpic_object_p (obfd))
- {
- unsigned i;
-
- for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
- if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
- for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
- if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
- /* Rewrite the phdrs, since we're only called after they
- were first written. */
- if (bfd_seek (obfd,
- (bfd_signed_vma) get_elf_backend_data (obfd)
- ->s->sizeof_ehdr, SEEK_SET) != 0
- || get_elf_backend_data (obfd)->s
- ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
- elf_elfheader (obfd)->e_phnum) != 0)
- return FALSE;
- break;
- }
-
- break;
- }
- }
-
return sh_elf_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags);
}
#endif /* not sh_elf_copy_private_data */
--- 6610,6615 ----
*************** sh_elf_encode_eh_address (bfd *abfd,
*** 7587,7592 ****
--- 7482,7488 ----
#define elf_backend_encode_eh_address \
sh_elf_encode_eh_address
+ #define elf_backend_stack_align 8
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
#define elf_backend_want_got_plt 1
*************** sh_elf_encode_eh_address (bfd *abfd,
*** 7649,7657 ****
#define TARGET_LITTLE_SYM bfd_elf32_shfd_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-sh-fdpic"
- #undef elf_backend_modify_program_headers
- #define elf_backend_modify_program_headers \
- sh_elf_modify_program_headers
#undef elf32_bed
#define elf32_bed elf32_sh_fd_bed
--- 7545,7550 ----
Index: bfd/elf32-tic6x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-tic6x.c,v
retrieving revision 1.33
diff -c -3 -p -r1.33 elf32-tic6x.c
*** bfd/elf32-tic6x.c 2 Sep 2012 12:17:26 -0000 1.33
--- bfd/elf32-tic6x.c 16 Oct 2012 13:34:31 -0000
*************** elf32_tic6x_size_dynamic_sections (bfd *
*** 3520,3598 ****
static bfd_boolean
elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
{
! if (elf32_tic6x_using_dsbt (output_bfd) && !info->relocatable)
! {
! struct elf_link_hash_entry *h;
!
! /* Force a PT_GNU_STACK segment to be created. */
! if (! elf_tdata (output_bfd)->stack_flags)
! elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
!
! /* Define __stacksize if it's not defined yet. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! if (! h || h->root.type != bfd_link_hash_defined
! || h->type != STT_OBJECT
! || !h->def_regular)
! {
! struct bfd_link_hash_entry *bh = NULL;
!
! if (!(_bfd_generic_link_add_one_symbol
! (info, output_bfd, "__stacksize",
! BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
! (const char *) NULL, FALSE,
! get_elf_backend_data (output_bfd)->collect, &bh)))
! return FALSE;
!
! h = (struct elf_link_hash_entry *) bh;
! h->def_regular = 1;
! h->type = STT_OBJECT;
! }
! }
! return TRUE;
! }
!
! static bfd_boolean
! elf32_tic6x_modify_program_headers (bfd *output_bfd,
! struct bfd_link_info *info)
! {
! struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
! struct elf_segment_map *m;
! Elf_Internal_Phdr *p;
!
! /* objcopy and strip preserve what's already there using
! elf32_tic6x_copy_private_bfd_data (). */
! if (! info)
! return TRUE;
!
! for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
! if (m->p_type == PT_GNU_STACK)
! break;
!
! if (m)
! {
! struct elf_link_hash_entry *h;
!
! /* Obtain the pointer to the __stacksize symbol. */
! h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
! FALSE, FALSE, FALSE);
! if (h)
! {
! while (h->root.type == bfd_link_hash_indirect
! || h->root.type == bfd_link_hash_warning)
! h = (struct elf_link_hash_entry *) h->root.u.i.link;
! BFD_ASSERT (h->root.type == bfd_link_hash_defined);
! }
!
! /* Set the header p_memsz from the symbol value. We
! intentionally ignore the symbol section. */
! if (h && h->root.type == bfd_link_hash_defined)
! p->p_memsz = h->root.u.def.value;
! else
! p->p_memsz = DEFAULT_STACK_SIZE;
!
! p->p_align = 8;
! }
return TRUE;
}
--- 3520,3529 ----
static bfd_boolean
elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
{
! if (elf32_tic6x_using_dsbt (output_bfd) && !info->relocatable
! && !bfd_elf_stack_segment_size (output_bfd, info,
! "__stacksize", DEFAULT_STACK_SIZE))
! return FALSE;
return TRUE;
}
*************** elf32_tic6x_merge_private_bfd_data (bfd
*** 4020,4068 ****
return TRUE;
}
- static bfd_boolean
- elf32_tic6x_copy_private_data (bfd * ibfd, bfd * obfd)
- {
- _bfd_elf_copy_private_bfd_data (ibfd, obfd);
-
- if (! is_tic6x_elf (ibfd) || ! is_tic6x_elf (obfd))
- return TRUE;
-
- /* Copy the stack size. */
- if (elf_tdata (ibfd)->phdr && elf_tdata (obfd)->phdr
- && elf32_tic6x_using_dsbt (ibfd) && elf32_tic6x_using_dsbt (obfd))
- {
- unsigned i;
-
- for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
- if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
- for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
- if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
- {
- memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
- /* Rewrite the phdrs, since we're only called after they
- were first written. */
- if (bfd_seek (obfd,
- (bfd_signed_vma) get_elf_backend_data (obfd)
- ->s->sizeof_ehdr, SEEK_SET) != 0
- || get_elf_backend_data (obfd)->s
- ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
- elf_elfheader (obfd)->e_phnum) != 0)
- return FALSE;
- break;
- }
-
- break;
- }
- }
-
- return TRUE;
- }
-
/* Add a new unwind edit to the list described by HEAD, TAIL. If TINDEX is zero,
adds the edit to the start of the list. (The list must be built in order of
ascending TINDEX: the function's callers are primarily responsible for
--- 3951,3956 ----
*************** elf32_tic6x_set_osabi (bfd *abfd, struct
*** 4484,4495 ****
#define ELF_MAXPAGESIZE 0x1000
#define bfd_elf32_bfd_reloc_type_lookup elf32_tic6x_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup elf32_tic6x_reloc_name_lookup
- #define bfd_elf32_bfd_copy_private_bfd_data elf32_tic6x_copy_private_data
#define bfd_elf32_bfd_merge_private_bfd_data elf32_tic6x_merge_private_bfd_data
#define bfd_elf32_mkobject elf32_tic6x_mkobject
#define bfd_elf32_bfd_link_hash_table_create elf32_tic6x_link_hash_table_create
#define bfd_elf32_bfd_link_hash_table_free elf32_tic6x_link_hash_table_free
#define bfd_elf32_new_section_hook elf32_tic6x_new_section_hook
#define elf_backend_can_gc_sections 1
#define elf_backend_default_use_rela_p 1
#define elf_backend_may_use_rel_p 1
--- 4372,4383 ----
#define ELF_MAXPAGESIZE 0x1000
#define bfd_elf32_bfd_reloc_type_lookup elf32_tic6x_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup elf32_tic6x_reloc_name_lookup
#define bfd_elf32_bfd_merge_private_bfd_data elf32_tic6x_merge_private_bfd_data
#define bfd_elf32_mkobject elf32_tic6x_mkobject
#define bfd_elf32_bfd_link_hash_table_create elf32_tic6x_link_hash_table_create
#define bfd_elf32_bfd_link_hash_table_free elf32_tic6x_link_hash_table_free
#define bfd_elf32_new_section_hook elf32_tic6x_new_section_hook
+ #define elf_backend_stack_align 8
#define elf_backend_can_gc_sections 1
#define elf_backend_default_use_rela_p 1
#define elf_backend_may_use_rel_p 1
*************** elf32_tic6x_set_osabi (bfd *abfd, struct
*** 4509,4516 ****
#define elf_backend_fake_sections elf32_tic6x_fake_sections
#define elf_backend_gc_sweep_hook elf32_tic6x_gc_sweep_hook
#define elf_backend_gc_mark_extra_sections elf32_tic6x_gc_mark_extra_sections
- #define elf_backend_modify_program_headers \
- elf32_tic6x_modify_program_headers
#define elf_backend_create_dynamic_sections \
elf32_tic6x_create_dynamic_sections
#define elf_backend_adjust_dynamic_symbol \
--- 4397,4402 ----
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.454
diff -c -3 -p -r1.454 elflink.c
*** bfd/elflink.c 19 Sep 2012 00:53:28 -0000 1.454
--- bfd/elflink.c 16 Oct 2012 13:34:35 -0000
*************** _bfd_elf_size_group_sections (struct bfd
*** 5567,5572 ****
--- 5567,5628 ----
return TRUE;
}
+ /* Set a default stack segment size. The value in INFO wins. If it
+ is unset, LEGACY_SYMBOL's value is used, and if that symbol is
+ undefined it is initialized. */
+
+ bfd_boolean
+ bfd_elf_stack_segment_size (bfd *output_bfd,
+ struct bfd_link_info *info,
+ const char *legacy_symbol,
+ bfd_vma default_size)
+ {
+ struct elf_link_hash_entry *h = 0;
+
+ /* Look for legacy symbol. */
+ if (legacy_symbol)
+ h = elf_link_hash_lookup (elf_hash_table (info), legacy_symbol,
+ FALSE, FALSE, FALSE);
+ if (h && h->root.type == bfd_link_hash_defined && h->def_regular
+ && (h->type == STT_NOTYPE || h->type == STT_OBJECT))
+ {
+ /* The symbol has no type if specified on the command line */
+ h->type = STT_OBJECT;
+ if (info->stacksize)
+ (*_bfd_error_handler) (_("%B: stack size specified and %s set"),
+ output_bfd, legacy_symbol);
+ else if (h->root.u.def.section != bfd_abs_section_ptr)
+ (*_bfd_error_handler) (_("%B: %s not absolute"),
+ output_bfd, legacy_symbol);
+ else
+ info->stacksize = h->root.u.def.value;
+ }
+
+ if (!info->stacksize)
+ /* If the user didn't set a size, or explicitly inhibit the
+ size, set it now. */
+ info->stacksize = default_size;
+
+ /* Provide the legacy symbol, if it is referenced. */
+ if (h && h->root.type == bfd_link_hash_undefined)
+ {
+ struct bfd_link_hash_entry *bh = NULL;
+
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, output_bfd, legacy_symbol,
+ BSF_GLOBAL, bfd_abs_section_ptr,
+ info->stacksize >= 0 ? info->stacksize : 0,
+ (const char *) NULL, FALSE,
+ get_elf_backend_data (output_bfd)->collect, &bh)))
+ return FALSE;
+
+ h = (struct elf_link_hash_entry *) bh;
+ h->def_regular = 1;
+ h->type = STT_OBJECT;
+ }
+ return TRUE;
+ }
+
/* Set up the sizes and contents of the ELF dynamic sections. This is
called by the ELF linker emulation before_allocation routine. We
must set the sizes of the sections before the linker sets the
*************** bfd_elf_size_dynamic_sections (bfd *outp
*** 5596,5638 ****
return TRUE;
bed = get_elf_backend_data (output_bfd);
- if (info->execstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
- else if (info->noexecstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
- else
- {
- bfd *inputobj;
- asection *notesec = NULL;
- int exec = 0;
-
- for (inputobj = info->input_bfds;
- inputobj;
- inputobj = inputobj->link_next)
- {
- asection *s;
-
- if (inputobj->flags
- & (DYNAMIC | EXEC_P | BFD_PLUGIN | BFD_LINKER_CREATED))
- continue;
- s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
- if (s)
- {
- if (s->flags & SEC_CODE)
- exec = PF_X;
- notesec = s;
- }
- else if (bed->default_execstack)
- exec = PF_X;
- }
- if (notesec)
- {
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | exec;
- if (exec && info->relocatable
- && notesec->output_section != bfd_abs_section_ptr)
- notesec->output_section->flags |= SEC_CODE;
- }
- }
/* Any syms created from now on start with -1 in
got.refcount/offset and plt.refcount/offset. */
--- 5652,5657 ----
*************** bfd_elf_size_dynamic_sections (bfd *outp
*** 5651,5656 ****
--- 5670,5726 ----
&& ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
return FALSE;
+ /* Determine any GNU_STACK segment requirements, after the backend
+ has had a chance to set a default segment size. */
+ {
+ bfd *inputobj;
+ int exec = 0;
+
+ /* Check for explicit exec stack setting. */
+ if (!info->noexecstack)
+ {
+ if (info->execstack
+ || (info->stacksize > 0 && bed->default_execstack))
+ exec = PF_X;
+
+ /* See if an input note section speficies exec stack. */
+ for (inputobj = info->input_bfds;
+ inputobj;
+ inputobj = inputobj->link_next)
+ {
+ asection *s;
+
+ if (inputobj->flags
+ & (DYNAMIC | EXEC_P | BFD_PLUGIN | BFD_LINKER_CREATED))
+ continue;
+ s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
+ if (s)
+ {
+ if (s->flags & SEC_CODE || bed->default_execstack)
+ /* For default_execstack to trigger without an explicit
+ stack size, there must be an input note section. */
+ exec = PF_X;
+
+ /* Propagate to output note section, if relocatable. */
+ if (exec && info->relocatable && !info->noexecstack
+ && s->output_section != bfd_abs_section_ptr)
+ {
+ s->output_section->flags |= SEC_CODE;
+ break;
+ }
+
+ if (s->flags & SEC_CODE)
+ break;
+ }
+ }
+ }
+
+ /* If the stack size is non-zero, or it's executable, we want a
+ stack segment. */
+ if (exec || info->stacksize > 0)
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | exec;
+ }
+
dynobj = elf_hash_table (info)->dynobj;
if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created)
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.129
diff -c -3 -p -r1.129 elfxx-target.h
*** bfd/elfxx-target.h 23 Jan 2012 06:16:37 -0000 1.129
--- bfd/elfxx-target.h 16 Oct 2012 13:34:35 -0000
***************
*** 109,114 ****
--- 109,117 ----
#ifndef elf_backend_default_execstack
#define elf_backend_default_execstack 1
#endif
+ #ifndef elf_backend_stack_align
+ #define elf_backend_stack_align 16
+ #endif
#define bfd_elfNN_bfd_debug_info_start bfd_void
#define bfd_elfNN_bfd_debug_info_end bfd_void
*************** static struct elf_backend_data elfNN_bed
*** 770,775 ****
--- 773,779 ----
elf_backend_obj_attrs_order,
elf_backend_obj_attrs_handle_unknown,
elf_backend_static_tls_alignment,
+ elf_backend_stack_align,
elf_backend_collect,
elf_backend_type_change_ok,
elf_backend_may_use_rel_p,
Index: include/bfdlink.h
===================================================================
RCS file: /cvs/src/src/include/bfdlink.h,v
retrieving revision 1.95
diff -c -3 -p -r1.95 bfdlink.h
*** include/bfdlink.h 9 Apr 2012 16:27:18 -0000 1.95
--- include/bfdlink.h 16 Oct 2012 13:34:39 -0000
*************** struct bfd_link_info
*** 416,421 ****
--- 416,425 ----
/* Separator between archive and filename in linker script filespecs. */
char path_separator;
+ /* Default stack size. Zero means default (often zero itself), -1
+ means explicitly zero-sized. */
+ bfd_signed_vma stacksize;
+
/* Function callbacks. */
const struct bfd_link_callbacks *callbacks;
Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.285
diff -c -3 -p -r1.285 ld.texinfo
*** ld/ld.texinfo 16 Sep 2012 22:21:00 -0000 1.285
--- ld/ld.texinfo 16 Oct 2012 13:34:43 -0000
*************** Set the emulation maximum page size to @
*** 1093,1098 ****
--- 1093,1103 ----
@item common-page-size=@var{value}
Set the emulation common page size to @var{value}.
+ @item stack-size=@var{value}
+ Specify a stack size for in an ELF @code{PT_GNU_STACK} segment.
+ Specifying zero will override any default non-zero sized
+ @code{PT_GNU_STACK} segment creation.
+
@end table
Other keywords are ignored for Solaris compatibility.
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.229
diff -c -3 -p -r1.229 elf32.em
*** ld/emultempl/elf32.em 13 Jul 2012 13:20:27 -0000 1.229
--- ld/emultempl/elf32.em 16 Oct 2012 13:34:44 -0000
*************** fragment <<EOF
*** 2276,2281 ****
--- 2276,2292 ----
einfo (_("%P%F: invalid common page size \`%s'\n"),
optarg + 17);
}
+ else if (CONST_STRNEQ (optarg, "stack-size="))
+ {
+ char *end;
+ link_info.stacksize = strtoul (optarg + 11, &end, 0);
+ if (*end || link_info.stacksize < 0)
+ einfo (_("%P%F: invalid stack size \`%s'\n"), optarg + 11);
+ if (!link_info.stacksize)
+ /* Use -1 for explicit no-stack, because zero means
+ 'default' */
+ link_info.stacksize = -1;
+ }
else if (strcmp (optarg, "execstack") == 0)
{
link_info.execstack = TRUE;
Index: ld/testsuite/ld-elf/binutils.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/binutils.exp,v
retrieving revision 1.20
diff -c -3 -p -r1.20 binutils.exp
*** ld/testsuite/ld-elf/binutils.exp 13 Aug 2012 14:52:52 -0000 1.20
--- ld/testsuite/ld-elf/binutils.exp 16 Oct 2012 13:34:44 -0000
*************** proc binutils_test { prog_name ld_option
*** 60,66 ****
return
}
! if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } {
if { [string match "*not supported*" $link_output]
|| [string match "*unrecognized option*" $link_output]
|| [string match "*-z relro ignored*" $link_output] } {
--- 60,66 ----
return
}
! if { ![ld_simple_link $ld tmpdir/$test "$ld_options -z stack-size=0 tmpdir/$test.o"] } {
if { [string match "*not supported*" $link_output]
|| [string match "*unrecognized option*" $link_output]
|| [string match "*-z relro ignored*" $link_output] } {
Index: ld/testsuite/ld-elf/elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/elf.exp,v
retrieving revision 1.38
diff -c -3 -p -r1.38 elf.exp
*** ld/testsuite/ld-elf/elf.exp 31 Aug 2012 02:52:14 -0000 1.38
--- ld/testsuite/ld-elf/elf.exp 16 Oct 2012 13:34:44 -0000
*************** if { [check_gc_sections_available] && ![
*** 126,131 ****
--- 126,140 ----
}
}
+ if { [istarget *-*-*linux*] } {
+ run_ld_link_tests {
+ {"stack exec" "-z execstack" "" {stack.s}
+ {{readelf {-Wl} stack-exec.rd}} "stack-exec.exe"}
+ {"stack size" "-z stack-size=0x123400" "" {stack.s}
+ {{readelf {-Wl} stack-size.rd}} "stack-size.exe"}
+ }
+ }
+
set LDFLAGS $old_ldflags
# The following tests require running the executable generated by ld.
Index: ld/testsuite/ld-elf/orphan-region.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/orphan-region.d,v
retrieving revision 1.5
diff -c -3 -p -r1.5 orphan-region.d
*** ld/testsuite/ld-elf/orphan-region.d 11 Oct 2010 09:12:25 -0000 1.5
--- ld/testsuite/ld-elf/orphan-region.d 16 Oct 2012 13:34:44 -0000
***************
*** 1,11 ****
#source: orphan-region.s
! #ld: -T orphan-region.ld -N
#readelf: -S -l --wide
#xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
#xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-*
! #xfail: spu-*-* hppa*64*-*-* frv-*-*
# if not using elf32.em, you don't get fancy orphan handling
! # spu twiddles LOAD range, hppa64 adds PHDR, frv-linux adds GNU_STACK
#...
\[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t]+0*40000000[ \t]+.*
--- 1,11 ----
#source: orphan-region.s
! #ld: -T orphan-region.ld -N -z stack-size=0 -z noexecstack
#readelf: -S -l --wide
#xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
#xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-*
! #xfail: spu-*-* hppa*64*-*-*
# if not using elf32.em, you don't get fancy orphan handling
! # spu twiddles LOAD range, hppa64 adds PHDR
#...
\[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t]+0*40000000[ \t]+.*
Index: ld/testsuite/ld-elf/stack-exec.rd
===================================================================
RCS file: ld/testsuite/ld-elf/stack-exec.rd
diff -N ld/testsuite/ld-elf/stack-exec.rd
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-elf/stack-exec.rd 16 Oct 2012 13:34:44 -0000
***************
*** 0 ****
--- 1,3 ----
+ #...
+ GNU_STACK 0x0+00000 0x0+000000 0x0+000000 0x0+000 0x.+0000 RWE 0x[0-9a-f]+
+ #pass
Index: ld/testsuite/ld-elf/stack-size.rd
===================================================================
RCS file: ld/testsuite/ld-elf/stack-size.rd
diff -N ld/testsuite/ld-elf/stack-size.rd
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-elf/stack-size.rd 16 Oct 2012 13:34:44 -0000
***************
*** 0 ****
--- 1,3 ----
+ #...
+ GNU_STACK 0x0+00000 0x0+000000 0x0+000000 0x0+000 0x123400 RW. 0x[0-9a-f]+
+ #pass
Index: ld/testsuite/ld-elf/stack.s
===================================================================
RCS file: ld/testsuite/ld-elf/stack.s
diff -N ld/testsuite/ld-elf/stack.s
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-elf/stack.s 16 Oct 2012 13:34:44 -0000
***************
*** 0 ****
--- 1,10 ----
+ .text
+ .globl start
+ .globl _start
+ start:
+ _start:
+ nop
+ nop
+ nop
+ nop
+
Index: ld/testsuite/ld-scripts/empty-aligned.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/empty-aligned.d,v
retrieving revision 1.6
diff -c -3 -p -r1.6 empty-aligned.d
*** ld/testsuite/ld-scripts/empty-aligned.d 9 Sep 2009 12:13:42 -0000 1.6
--- ld/testsuite/ld-scripts/empty-aligned.d 16 Oct 2012 13:34:45 -0000
***************
*** 1,5 ****
#source: empty-aligned.s
! #ld: -T empty-aligned.t
#readelf: -l --wide
#xfail: "hppa64-*-*"
#notarget: frv-*-*linux*
--- 1,5 ----
#source: empty-aligned.s
! #ld: -T empty-aligned.t -z stack-size=0 -z noexecstack
#readelf: -l --wide
#xfail: "hppa64-*-*"
#notarget: frv-*-*linux*
Index: ld/testsuite/ld-sh/fdpic-stack-set.d
===================================================================
RCS file: ld/testsuite/ld-sh/fdpic-stack-set.d
diff -N ld/testsuite/ld-sh/fdpic-stack-set.d
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-sh/fdpic-stack-set.d 16 Oct 2012 13:34:45 -0000
***************
*** 0 ****
--- 1,19 ----
+ #source: fdpic-stack.s
+ #as: --isa=sh2a -big --fdpic
+ #ld: -EB -mshelf_fd -z stack-size=0x40000
+ #readelf: -l
+ #target: sh*-*-uclinux*
+
+ Elf file type is EXEC \(Executable file\)
+ Entry point 0x400074
+ There are 2 program headers, starting at offset 52
+
+ Program Headers:
+ [ \t]+Type[ \t]+Offset[ \t]+VirtAddr[ \t]+PhysAddr[ \t]+FileSiz MemSiz[ \t]+Flg Align
+ [ \t]+LOAD[ \t]+0x000000 0x00400000 0x00400000 0x00076 0x00076 R E 0x10000
+ [ \t]+GNU_STACK[ \t]+0x000000 0x00000000 0x00000000 0x00000 0x40000 RWE 0x8
+
+ Section to Segment mapping:
+ [ \t]+Segment Sections\.\.\.
+ [ \t]+00[ \t]+\.text
+ [ \t]+01[ \t]+
Index: ld/testsuite/ld-tic6x/shlib-1.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-1.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-1.rd
*** ld/testsuite/ld-tic6x/shlib-1.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-1.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 117,123 ****
.* 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
.* 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE
.* 00000000 0 NOTYPE WEAK DEFAULT UND b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2
.* 10000088 52 FUNC GLOBAL DEFAULT 9 sub0
--- 117,122 ----
Index: ld/testsuite/ld-tic6x/shlib-1b.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-1b.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-1b.rd
*** ld/testsuite/ld-tic6x/shlib-1b.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-1b.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 117,123 ****
.* 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
.* 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE
.* 00000000 0 NOTYPE WEAK DEFAULT UND b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2
.* 10000088 52 FUNC GLOBAL DEFAULT 9 sub0
--- 117,122 ----
Index: ld/testsuite/ld-tic6x/shlib-1r.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-1r.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-1r.rd
*** ld/testsuite/ld-tic6x/shlib-1r.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-1r.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 117,123 ****
.* 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
.* 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE
.* 00000000 0 NOTYPE WEAK DEFAULT UND b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2
.* 10000088 52 FUNC GLOBAL DEFAULT 9 sub0
--- 117,122 ----
Index: ld/testsuite/ld-tic6x/shlib-1rb.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-1rb.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-1rb.rd
*** ld/testsuite/ld-tic6x/shlib-1rb.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-1rb.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 117,123 ****
.* 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
.* 10000100 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE
.* 00000000 0 NOTYPE WEAK DEFAULT UND b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 1000012c 4 OBJECT GLOBAL DEFAULT 11 g2
.* 10000088 52 FUNC GLOBAL DEFAULT 9 sub0
--- 117,122 ----
Index: ld/testsuite/ld-tic6x/shlib-app-1.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-app-1.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-app-1.rd
*** ld/testsuite/ld-tic6x/shlib-app-1.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-app-1.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 122,128 ****
.* 100000ac 0 OBJECT LOCAL DEFAULT 11 _GLOBAL_OFFSET_TABLE_
.* 100000a0 0 NOTYPE LOCAL DEFAULT 11 __c6xabi_DSBT_BASE
.* 100000c0 4 OBJECT GLOBAL DEFAULT 12 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 00000000 0 OBJECT WEAK DEFAULT UND g2
.* 00000000 0 FUNC GLOBAL DEFAULT UND sub0
--- 122,127 ----
Index: ld/testsuite/ld-tic6x/shlib-app-1b.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-app-1b.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-app-1b.rd
*** ld/testsuite/ld-tic6x/shlib-app-1b.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-app-1b.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 122,128 ****
.* 100000ac 0 OBJECT LOCAL DEFAULT 11 _GLOBAL_OFFSET_TABLE_
.* 100000a0 0 NOTYPE LOCAL DEFAULT 11 __c6xabi_DSBT_BASE
.* 100000c0 4 OBJECT GLOBAL DEFAULT 12 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 00000000 0 OBJECT WEAK DEFAULT UND g2
.* 00000000 0 FUNC GLOBAL DEFAULT UND sub0
--- 122,127 ----
Index: ld/testsuite/ld-tic6x/shlib-app-1r.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-app-1r.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-app-1r.rd
*** ld/testsuite/ld-tic6x/shlib-app-1r.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-app-1r.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 112,117 ****
.* 100000ac 0 OBJECT LOCAL DEFAULT 10 _GLOBAL_OFFSET_TABLE_
.* 100000a0 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE
.* 100000c0 4 OBJECT GLOBAL DEFAULT 11 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 FUNC GLOBAL DEFAULT UND sub0
.* 100000c4 4 OBJECT GLOBAL DEFAULT 12 a
--- 112,116 ----
Index: ld/testsuite/ld-tic6x/shlib-app-1rb.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-app-1rb.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-app-1rb.rd
*** ld/testsuite/ld-tic6x/shlib-app-1rb.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-app-1rb.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 112,117 ****
.* 100000ac 0 OBJECT LOCAL DEFAULT 10 _GLOBAL_OFFSET_TABLE_
.* 100000a0 0 NOTYPE LOCAL DEFAULT 10 __c6xabi_DSBT_BASE
.* 100000c0 4 OBJECT GLOBAL DEFAULT 11 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 FUNC GLOBAL DEFAULT UND sub0
.* 100000c4 4 OBJECT GLOBAL DEFAULT 12 a
--- 112,116 ----
Index: ld/testsuite/ld-tic6x/shlib-noindex.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/shlib-noindex.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 shlib-noindex.rd
*** ld/testsuite/ld-tic6x/shlib-noindex.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/shlib-noindex.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 124,130 ****
.* 1000010c 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
.* 10000100 0 NOTYPE LOCAL DEFAULT 11 __c6xabi_DSBT_BASE
.* 00000000 0 NOTYPE WEAK DEFAULT UND b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 1000012c 4 OBJECT GLOBAL DEFAULT 12 g2
.* 10000088 52 FUNC GLOBAL DEFAULT 10 sub0
--- 124,129 ----
Index: ld/testsuite/ld-tic6x/static-app-1.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/static-app-1.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 static-app-1.rd
*** ld/testsuite/ld-tic6x/static-app-1.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/static-app-1.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 107,113 ****
.* 100000cc 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_
.* 100000c0 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE
.* 100000e8 4 OBJECT GLOBAL DEFAULT 9 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 100000e4 4 OBJECT GLOBAL DEFAULT 9 g2
.* 10000008 52 FUNC GLOBAL DEFAULT 7 sub0
--- 107,112 ----
Index: ld/testsuite/ld-tic6x/static-app-1b.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/static-app-1b.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 static-app-1b.rd
*** ld/testsuite/ld-tic6x/static-app-1b.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/static-app-1b.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 107,113 ****
.* 100000cc 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_
.* 100000c0 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE
.* 100000e8 4 OBJECT GLOBAL DEFAULT 9 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 100000e4 4 OBJECT GLOBAL DEFAULT 9 g2
.* 10000008 52 FUNC GLOBAL DEFAULT 7 sub0
--- 107,112 ----
Index: ld/testsuite/ld-tic6x/static-app-1r.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/static-app-1r.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 static-app-1r.rd
*** ld/testsuite/ld-tic6x/static-app-1r.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/static-app-1r.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 104,110 ****
.* 100000cc 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_
.* 100000c0 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE
.* 100000e8 4 OBJECT GLOBAL DEFAULT 9 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 100000e4 4 OBJECT GLOBAL DEFAULT 9 g2
.* 10000008 52 FUNC GLOBAL DEFAULT 7 sub0
--- 104,109 ----
Index: ld/testsuite/ld-tic6x/static-app-1rb.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-tic6x/static-app-1rb.rd,v
retrieving revision 1.5
diff -c -3 -p -r1.5 static-app-1rb.rd
*** ld/testsuite/ld-tic6x/static-app-1rb.rd 15 Jun 2012 15:13:41 -0000 1.5
--- ld/testsuite/ld-tic6x/static-app-1rb.rd 16 Oct 2012 13:34:46 -0000
*************** Symbol table '\.symtab' contains [0-9]+
*** 104,110 ****
.* 100000cc 0 OBJECT LOCAL DEFAULT 8 _GLOBAL_OFFSET_TABLE_
.* 100000c0 0 NOTYPE LOCAL DEFAULT 8 __c6xabi_DSBT_BASE
.* 100000e8 4 OBJECT GLOBAL DEFAULT 9 b
- .* 00020000 0 OBJECT GLOBAL DEFAULT ABS __stacksize
.* 00000000 0 NOTYPE WEAK DEFAULT UND g1
.* 100000e4 4 OBJECT GLOBAL DEFAULT 9 g2
.* 10000008 52 FUNC GLOBAL DEFAULT 7 sub0
--- 104,109 ----
More information about the Binutils
mailing list