This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/10569: -z max-page-size may not work for linker scripts


On Thu, Aug 27, 2009 at 10:50 PM, Alan Modra<amodra@bigpond.net.au> wrote:
> On Thu, Aug 27, 2009 at 08:55:46PM -0700, H.J. Lu wrote:
>> On Thu, Aug 27, 2009 at 8:32 PM, H.J. Lu<hjl.tools@gmail.com> wrote:
>> > On Thu, Aug 27, 2009 at 8:14 PM, Alan Modra<amodra@bigpond.net.au> wrote:
>> >> I think this is the wrong place to call bfd_emul_set_maxpagesize
>> >> (and the current call in elf32.em is wrong too). ?You probably should
>> >> be calling bfd_emul_set_maxpagesize in open_output. ?Also,
>> >
>> > Will open_output be called before any linker scripts are processed?
>
> Depends on what you mean by processed. ?Yes, they are parsed and
> converted to internal format before open_output, but why does it
> matter? ?Nothing much depends on maxpagesize until
> lang_size_sections.

This linker script:

---
SECTIONS
{
  .text : {*(.text)}
  . = ALIGN(CONSTANT (MAXPAGESIZE));
  .data : {*(.data)}
  /DISCARD/ : {*(*)}
}
---

calls fold_name on MAXPAGESIZE before open_output is called.

>
> Perhaps even a nicer patch would be to put your
> bfd_emul_set_maxpagesize calls in a LD_EMUL_SET_OUTPUT_ARCH hook,
> which is called just after open_output.
>
>> >> bfd_emul_get_maxpagesize in fold_name shouldn't be using
>> >> default_target. ?Ditto for commonpagesize.
>> >>
>> >
>> > That is true. I will fix it.
>>
>> There is no easy fix. Should we just set max/common page sizes for
>> all enabled ELF targets?
>
> Why can't you use output_target?
>

We may set and get page sizes in linker. In linker script, we should use
emulation target, which may be different from output target, to get
page size, We need to set page size for emulation target in
gld${EMULATION_NAME}_handle_option. We also need to set page
size for output target in ldemul_set_output_arch.

OK to install?

Thanks.


H.J.
---
ld/

2009-08-28  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/10569
	* ldemul.c (ldemul_set_output_arch): Set maximum/common page
	 sizes on output target.

	* ldexp.c: Include "ldfile.h" and "ldemul.h".
	(fold_name): Use ldemul_choose_target instead of default_target
	to get maximum/common page sizes.

	* ldmain.c (main): Initialize config.maxpagesize and
	config.commonpagesize to (bfd_vma) -1.

	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Use
	ldemul_choose_target instead of default_target to set
	maximum/common page sizes.


ld/testsuite

2009-08-28  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/10569
	* ld-elf/commonpage2.d: New.
	* ld-elf/maxpage4.d: Likewise.
	* ld-elf/maxpage4.t: Likewise.

Attachment: ld-page-size-2.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]