[Bug ld/18173] New: Output Section LMA Alignment

2015-03-28 Thread sven.koehler at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18173

Bug ID: 18173
   Summary: Output Section LMA Alignment
   Product: binutils
   Version: 2.25
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: sven.koehler at gmail dot com

With a linker script, it is currently not possible to specify the alignment of
the LMA of an output section. Consider the following example:

.data : ALIGN(8) {
  ...
} >RAM AT>ROM

That will align the VMA of the section on a 8byte boundary, regardless of
alignment of the input sections (which could be less) but not the LMA.

Then we have ALIGN_WITH_INPUT, which cannot be combined with ALIGN(x). It will
align the VMA to the alignment of the input section (which may be less than 8)
and will increase the LMA by the same amount that the VMA was increased to
achieve the alignment. There are two problem:
(1) If the misalignment of VMA and LMA was different, we still end up with an
unaligned LMA.
(2) Even if VMA and LMA are equally misaligned, then there is no way to have a
minimum alignment of, as there is no way to combine ALIGN_WITH_INPUT with
ALIGN(8)

On some platforms however, such as ARM, it is somewhat important to have both
VMA and LMA aligned to a certain boundary to efficiently copy the section from
LMA to VMA. As shown above, ALIGN(x) and ALIGN_WITH_INPUT don't help.

What would help:
(1) If the misalignment of VMA and LMA could be assumed to be equal, then
ALIGN(x) in combination with ALIGN_WITH_INPUT would help.
But I have to say that the name of ALIGN_WITH_INPUT is a bit misleading, as
it's actually about keeping padding between VMA and LMA equal. Also, unlike
ALIGN(x), ALIGN_WITH_INPUT is actually about the LMA, not the VMA.

(2) Add something like ALIGNLMA(x) in addition to ALIGN(x), where the former is
about LMA alignment and the latter is about VMA alignment.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/18174] New: Improve documentation on Forced Output Section Alignment

2015-03-28 Thread sven.koehler at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18174

Bug ID: 18174
   Summary: Improve documentation on Forced Output Section
Alignment
   Product: binutils
   Version: 2.25
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: sven.koehler at gmail dot com

I'm referring to 
https://sourceware.org/binutils/docs-2.25/ld/Forced-Output-Alignment.html

The documentation given there is insufficient. An Output Section has two
addresses, the LMA and the VMA. It should be made clear ALIGN(x) effects the
VMA, and the VMA only. I believe, this might have been different in earlier
versions of binutils, where the LMA was also affected. If so, that should be
documented as well. The effect of ALIGN(x) on VMA and LMA can currently only be
understood by intense testing.

Also, ALIGN_WITH_INPUT keeps the difference between LMA and VMA intact, as the
documentation states. But again without a lot of testing, it's not clear what's
going on. It would be better to describe ALIGN_WITH_INPUT in a way that makes
clear what the effect on VMA and LMA is:
1) the VMA is aligned in the usual way (to the strictest alignment of the input
sections)
2) the LMA is not aligned, but instead padded (!) with the same amount that
added to the VMA to achieve the section's VMA alignment.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/18176] New: Large file size due to padding for PT_GNU_RELRO segment

2015-03-28 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18176

Bug ID: 18176
   Summary: Large file size due to padding for PT_GNU_RELRO
segment
   Product: binutils
   Version: 2.26 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: hjl.tools at gmail dot com

Created attachment 8215
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8215&action=edit
A testcase

When a padding in file is used to align PT_GNU_RELRO segment, the maximum
padding size is maximum page size minus 1, which may lead to large file
size:

[hjl@gnu-tools-1 relro]$ make
as   -o x.o x.s
./ld -z relro -T ld.t -z max-page-size=0x20 -z common-page-size=0x1000
-shared -o x.so x.o
ls -l x.so
-rwxrwxr-x 1 hjl hjl 2419808 Mar 28 20:17 x.so
[hjl@gnu-tools-1 relro]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/18176] Large file size due to padding for PT_GNU_RELRO segment

2015-03-28 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18176

H.J. Lu  changed:

   What|Removed |Added

 Target||x86_64-pc-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils