* Missing TO_ADDR
@ 2016-03-30 7:32 Alan Modra
2016-03-30 12:08 ` Dan
[not found] ` <1459339484.9097.134.camel@jericho>
0 siblings, 2 replies; 9+ messages in thread
From: Alan Modra @ 2016-03-30 7:32 UTC (permalink / raw)
To: binutils
Calculates the wrong end address on targets with octets_per_byte
not equal to one.
* ldlang.c (lang_size_sections_1): Correct code detecting a
backward non-overlapping move.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 235a246..b369f99 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5068,7 +5068,7 @@ lang_size_sections_1
create overlapping LMAs. */
if (dot < last->vma
&& os->bfd_section->size != 0
- && dot + os->bfd_section->size <= last->vma)
+ && dot + TO_ADDR (os->bfd_section->size) <= last->vma)
{
/* If dot moved backwards then leave lma equal to
vma. This is the old default lma, which might
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Missing TO_ADDR
2016-03-30 7:32 Missing TO_ADDR Alan Modra
@ 2016-03-30 12:08 ` Dan
[not found] ` <1459339484.9097.134.camel@jericho>
1 sibling, 0 replies; 9+ messages in thread
From: Dan @ 2016-03-30 12:08 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
Don't forget the "minfo ("0x%V %W", section->vma ..." line that needs
its "section->size" parameter changed to TO_ADDR(section->size), or the
"lma = last->lma+last->size" that needs to be changed to "lma =
last->lma + TO_ADDR(last->size);". At least according to my last git
pull, those changes still needed to be made as well.
Dan
On Wed, 2016-03-30 at 18:01 +1030, Alan Modra wrote:
> Calculates the wrong end address on targets with octets_per_byte
> not equal to one.
>
> * ldlang.c (lang_size_sections_1): Correct code detecting a
> backward non-overlapping move.
>
> diff --git a/ld/ldlang.c b/ld/ldlang.c
> index 235a246..b369f99 100644
> --- a/ld/ldlang.c
> +++ b/ld/ldlang.c
> @@ -5068,7 +5068,7 @@ lang_size_sections_1
> create overlapping LMAs. */
> if (dot < last->vma
> && os->bfd_section->size != 0
> - && dot + os->bfd_section->size <= last->vma)
> + && dot + TO_ADDR (os->bfd_section->size) <= last->vma)
> {
> /* If dot moved backwards then leave lma equal to
> vma. This is the old default lma, which might
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Missing TO_ADDR
[not found] ` <1459339484.9097.134.camel@jericho>
@ 2016-03-31 7:40 ` Alan Modra
2016-03-31 11:13 ` Dan
2016-03-31 16:03 ` Dan
0 siblings, 2 replies; 9+ messages in thread
From: Alan Modra @ 2016-03-31 7:40 UTC (permalink / raw)
To: dgisselq; +Cc: binutils
On Wed, Mar 30, 2016 at 08:04:44AM -0400, Dan wrote:
> Don't forget the "minfo ("0x%V %W", section->vma ..." line that needs
> its "section->size" parameter changed to TO_ADDR(section->size), or the
> "lma = last->lma+last->size" that needs to be changed to "lma =
> last->lma + TO_ADDR(last->size);". At least according to my last git
> pull, those changes still needed to be made as well.
Yes, there are other places missing TO_ADDR, and one of the minfo
lines wrongly invokes TO_ADDR. Thanks for the prod.
* ldlang.c (TO_ADDR, TO_SIZE, opb_shift): Move earlier in file.
(lang_insert_orphan): Use TO_ADDR in __stop sym calculation.
(print_input_section): Don't use TO_ADDR when printing section
size.
(lang_size_sections_1): Use TO_ADDR in overlay lma calculation.
(lang_size_sections): Use TO_ADDR in relro end calculation.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index cb6aab6..9fca810 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -49,7 +49,13 @@
#define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
#endif
-/* Locals variables. */
+/* Convert between addresses in bytes and sizes in octets.
+ For currently supported targets, octets_per_byte is always a power
+ of two, so we can use shifts. */
+#define TO_ADDR(X) ((X) >> opb_shift)
+#define TO_SIZE(X) ((X) << opb_shift)
+
+/* Local variables. */
static struct obstack stat_obstack;
static struct obstack map_obstack;
@@ -68,6 +74,7 @@ static lang_statement_list_type *stat_save[10];
static lang_statement_list_type **stat_save_ptr = &stat_save[0];
static struct unique_sections *unique_section_list;
static struct asneeded_minfo *asneeded_list_head;
+static unsigned int opb_shift = 0;
static bfd_boolean maybe_overlays = FALSE;
/* Forward declarations. */
@@ -1887,7 +1894,7 @@ lang_insert_orphan (asection *s,
before sizing dynamic sections. */
dot = os->bfd_section->vma;
exp_fold_tree (start_assign->exp, os->bfd_section, &dot);
- dot += s->size;
+ dot += TO_ADDR (s->size);
exp_fold_tree (stop_assign->exp, os->bfd_section, &dot);
}
@@ -3209,15 +3216,6 @@ ldlang_open_output (lang_statement_union_type *statement)
}
}
-/* Convert between addresses in bytes and sizes in octets.
- For currently supported targets, octets_per_byte is always a power
- of two, so we can use shifts. */
-#define TO_ADDR(X) ((X) >> opb_shift)
-#define TO_SIZE(X) ((X) << opb_shift)
-
-/* Support the above. */
-static unsigned int opb_shift = 0;
-
static void
init_opb (void)
{
@@ -4225,7 +4223,7 @@ print_input_section (asection *i, bfd_boolean is_discarded)
size = 0;
}
- minfo ("0x%V %W %B\n", addr, TO_ADDR (size), i->owner);
+ minfo ("0x%V %W %B\n", addr, size, i->owner);
if (size != i->rawsize && i->rawsize != 0)
{
@@ -5132,7 +5130,7 @@ lang_size_sections_1
/* If this is an overlay, set the current lma to that
at the end of the previous section. */
if (os->sectype == overlay_section)
- lma = last->lma + last->size;
+ lma = last->lma + TO_ADDR (last->size);
/* Otherwise, keep the same lma to vma relationship
as the previous section. */
@@ -5524,7 +5522,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions)
end = start = sec->vma;
if (!IS_TBSS (sec))
- end += sec->size;
+ end += TO_ADDR (sec->size);
bump = desired_end - end;
/* We'd like to increase START by BUMP, but we must heed
alignment so the increase might be less than optimum. */
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Missing TO_ADDR
2016-03-31 7:40 ` Alan Modra
@ 2016-03-31 11:13 ` Dan
2016-04-01 1:28 ` Alan Modra
2016-03-31 16:03 ` Dan
1 sibling, 1 reply; 9+ messages in thread
From: Dan @ 2016-03-31 11:13 UTC (permalink / raw)
To: Alan Modra; +Cc: dgisselq, binutils
Are you sure you want to take the TO_SIZE directives *away* from the
minfo statements? With the TO_SIZE directives, the addresses add up:
last address plus size adds up to the next address, and you can see
nothing missing. Without the TO_SIZE directives, the units don't match.
Dan
On Thu, 2016-03-31 at 18:09 +1030, Alan Modra wrote:
> On Wed, Mar 30, 2016 at 08:04:44AM -0400, Dan wrote:
> > Don't forget the "minfo ("0x%V %W", section->vma ..." line that needs
> > its "section->size" parameter changed to TO_ADDR(section->size), or the
> > "lma = last->lma+last->size" that needs to be changed to "lma =
> > last->lma + TO_ADDR(last->size);". At least according to my last git
> > pull, those changes still needed to be made as well.
>
> Yes, there are other places missing TO_ADDR, and one of the minfo
> lines wrongly invokes TO_ADDR. Thanks for the prod.
>
> * ldlang.c (TO_ADDR, TO_SIZE, opb_shift): Move earlier in file.
> (lang_insert_orphan): Use TO_ADDR in __stop sym calculation.
> (print_input_section): Don't use TO_ADDR when printing section
> size.
> (lang_size_sections_1): Use TO_ADDR in overlay lma calculation.
> (lang_size_sections): Use TO_ADDR in relro end calculation.
>
> diff --git a/ld/ldlang.c b/ld/ldlang.c
> index cb6aab6..9fca810 100644
> --- a/ld/ldlang.c
> +++ b/ld/ldlang.c
> @@ -49,7 +49,13 @@
> #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
> #endif
>
> -/* Locals variables. */
> +/* Convert between addresses in bytes and sizes in octets.
> + For currently supported targets, octets_per_byte is always a power
> + of two, so we can use shifts. */
> +#define TO_ADDR(X) ((X) >> opb_shift)
> +#define TO_SIZE(X) ((X) << opb_shift)
> +
> +/* Local variables. */
> static struct obstack stat_obstack;
> static struct obstack map_obstack;
>
> @@ -68,6 +74,7 @@ static lang_statement_list_type *stat_save[10];
> static lang_statement_list_type **stat_save_ptr = &stat_save[0];
> static struct unique_sections *unique_section_list;
> static struct asneeded_minfo *asneeded_list_head;
> +static unsigned int opb_shift = 0;
> static bfd_boolean maybe_overlays = FALSE;
>
> /* Forward declarations. */
> @@ -1887,7 +1894,7 @@ lang_insert_orphan (asection *s,
> before sizing dynamic sections. */
> dot = os->bfd_section->vma;
> exp_fold_tree (start_assign->exp, os->bfd_section, &dot);
> - dot += s->size;
> + dot += TO_ADDR (s->size);
> exp_fold_tree (stop_assign->exp, os->bfd_section, &dot);
> }
>
> @@ -3209,15 +3216,6 @@ ldlang_open_output (lang_statement_union_type *statement)
> }
> }
>
> -/* Convert between addresses in bytes and sizes in octets.
> - For currently supported targets, octets_per_byte is always a power
> - of two, so we can use shifts. */
> -#define TO_ADDR(X) ((X) >> opb_shift)
> -#define TO_SIZE(X) ((X) << opb_shift)
> -
> -/* Support the above. */
> -static unsigned int opb_shift = 0;
> -
> static void
> init_opb (void)
> {
> @@ -4225,7 +4223,7 @@ print_input_section (asection *i, bfd_boolean is_discarded)
> size = 0;
> }
>
> - minfo ("0x%V %W %B\n", addr, TO_ADDR (size), i->owner);
> + minfo ("0x%V %W %B\n", addr, size, i->owner);
>
> if (size != i->rawsize && i->rawsize != 0)
> {
> @@ -5132,7 +5130,7 @@ lang_size_sections_1
> /* If this is an overlay, set the current lma to that
> at the end of the previous section. */
> if (os->sectype == overlay_section)
> - lma = last->lma + last->size;
> + lma = last->lma + TO_ADDR (last->size);
>
> /* Otherwise, keep the same lma to vma relationship
> as the previous section. */
> @@ -5524,7 +5522,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions)
>
> end = start = sec->vma;
> if (!IS_TBSS (sec))
> - end += sec->size;
> + end += TO_ADDR (sec->size);
> bump = desired_end - end;
> /* We'd like to increase START by BUMP, but we must heed
> alignment so the increase might be less than optimum. */
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Missing TO_ADDR
2016-03-31 7:40 ` Alan Modra
2016-03-31 11:13 ` Dan
@ 2016-03-31 16:03 ` Dan
2016-04-01 1:31 ` Alan Modra
1 sibling, 1 reply; 9+ messages in thread
From: Dan @ 2016-03-31 16:03 UTC (permalink / raw)
To: Alan Modra; +Cc: dgisselq, binutils
This would be my proposal for what to change:
--- a/ld/ldlang.c 2016-03-31 11:52:02.147253098 -0400
+++ b/ld/ldlang.c 2016-03-31 12:01:13.039773821 -0400
@@ -1886,7 +1886,7 @@
before sizing dynamic sections. */
dot = os->bfd_section->vma;
exp_fold_tree (start_assign->exp, os->bfd_section, &dot);
- dot += s->size;
+ dot += TO_ADDR(s->size);
exp_fold_tree (stop_assign->exp, os->bfd_section, &dot);
}
@@ -4002,7 +4002,7 @@
++len;
}
- minfo ("0x%V %W", section->vma, section->size);
+ minfo ("0x%V %W", section->vma, TO_ADDR(section->size));
if (section->vma != section->lma)
minfo (_(" load address 0x%V"), section->lma);
@@ -4312,7 +4312,9 @@
break;
}
- minfo ("0x%V %W %s 0x%v", addr, size, name, data->value);
+ if (size < TO_SIZE ((unsigned) 1))
+ size = TO_SIZE ((unsigned) 1);
+ minfo ("0x%V %W %s 0x%v", addr, TO_ADDR(size), name, data->value);
if (data->exp->type.node_class != etree_value)
{
@@ -4355,7 +4357,7 @@
size = bfd_get_reloc_size (reloc->howto);
- minfo ("0x%V %W RELOC %s ", addr, size, reloc->howto->name);
+ minfo ("0x%V %W RELOC %s ", addr, TO_ADDR(size), reloc->howto->name);
if (reloc->name != NULL)
minfo ("%s+", reloc->name);
@@ -4388,7 +4390,7 @@
addr = s->output_offset;
if (s->output_section != NULL)
addr += s->output_section->vma;
- minfo ("0x%V %W ", addr, (bfd_vma) s->size);
+ minfo ("0x%V %W ", addr, TO_ADDR((bfd_vma) s->size));
if (s->fill->size != 0)
{
@@ -5067,7 +5069,7 @@
create overlapping LMAs. */
if (dot < last->vma
&& os->bfd_section->size != 0
- && dot + os->bfd_section->size <= last->vma)
+ && dot + TO_ADDR(os->bfd_section->size) <= last->vma)
{
/* If dot moved backwards then leave lma equal to
vma. This is the old default lma, which might
@@ -5084,7 +5086,7 @@
/* If this is an overlay, set the current lma to that
at the end of the previous section. */
if (os->sectype == overlay_section)
- lma = last->lma + last->size;
+ lma = last->lma + TO_ADDR(last->size);
/* Otherwise, keep the same lma to vma relationship
as the previous section. */
As I mentioned, this keeps the units of addresses and sizes consistent
within the map file.
Dan
On Thu, 2016-03-31 at 18:09 +1030, Alan Modra wrote:
> On Wed, Mar 30, 2016 at 08:04:44AM -0400, Dan wrote:
> > Don't forget the "minfo ("0x%V %W", section->vma ..." line that needs
> > its "section->size" parameter changed to TO_ADDR(section->size), or the
> > "lma = last->lma+last->size" that needs to be changed to "lma =
> > last->lma + TO_ADDR(last->size);". At least according to my last git
> > pull, those changes still needed to be made as well.
>
> Yes, there are other places missing TO_ADDR, and one of the minfo
> lines wrongly invokes TO_ADDR. Thanks for the prod.
>
> * ldlang.c (TO_ADDR, TO_SIZE, opb_shift): Move earlier in file.
> (lang_insert_orphan): Use TO_ADDR in __stop sym calculation.
> (print_input_section): Don't use TO_ADDR when printing section
> size.
> (lang_size_sections_1): Use TO_ADDR in overlay lma calculation.
> (lang_size_sections): Use TO_ADDR in relro end calculation.
>
> diff --git a/ld/ldlang.c b/ld/ldlang.c
> index cb6aab6..9fca810 100644
> --- a/ld/ldlang.c
> +++ b/ld/ldlang.c
> @@ -49,7 +49,13 @@
> #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
> #endif
>
> -/* Locals variables. */
> +/* Convert between addresses in bytes and sizes in octets.
> + For currently supported targets, octets_per_byte is always a power
> + of two, so we can use shifts. */
> +#define TO_ADDR(X) ((X) >> opb_shift)
> +#define TO_SIZE(X) ((X) << opb_shift)
> +
> +/* Local variables. */
> static struct obstack stat_obstack;
> static struct obstack map_obstack;
>
> @@ -68,6 +74,7 @@ static lang_statement_list_type *stat_save[10];
> static lang_statement_list_type **stat_save_ptr = &stat_save[0];
> static struct unique_sections *unique_section_list;
> static struct asneeded_minfo *asneeded_list_head;
> +static unsigned int opb_shift = 0;
> static bfd_boolean maybe_overlays = FALSE;
>
> /* Forward declarations. */
> @@ -1887,7 +1894,7 @@ lang_insert_orphan (asection *s,
> before sizing dynamic sections. */
> dot = os->bfd_section->vma;
> exp_fold_tree (start_assign->exp, os->bfd_section, &dot);
> - dot += s->size;
> + dot += TO_ADDR (s->size);
> exp_fold_tree (stop_assign->exp, os->bfd_section, &dot);
> }
>
> @@ -3209,15 +3216,6 @@ ldlang_open_output (lang_statement_union_type *statement)
> }
> }
>
> -/* Convert between addresses in bytes and sizes in octets.
> - For currently supported targets, octets_per_byte is always a power
> - of two, so we can use shifts. */
> -#define TO_ADDR(X) ((X) >> opb_shift)
> -#define TO_SIZE(X) ((X) << opb_shift)
> -
> -/* Support the above. */
> -static unsigned int opb_shift = 0;
> -
> static void
> init_opb (void)
> {
> @@ -4225,7 +4223,7 @@ print_input_section (asection *i, bfd_boolean is_discarded)
> size = 0;
> }
>
> - minfo ("0x%V %W %B\n", addr, TO_ADDR (size), i->owner);
> + minfo ("0x%V %W %B\n", addr, size, i->owner);
>
> if (size != i->rawsize && i->rawsize != 0)
> {
> @@ -5132,7 +5130,7 @@ lang_size_sections_1
> /* If this is an overlay, set the current lma to that
> at the end of the previous section. */
> if (os->sectype == overlay_section)
> - lma = last->lma + last->size;
> + lma = last->lma + TO_ADDR (last->size);
>
> /* Otherwise, keep the same lma to vma relationship
> as the previous section. */
> @@ -5524,7 +5522,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions)
>
> end = start = sec->vma;
> if (!IS_TBSS (sec))
> - end += sec->size;
> + end += TO_ADDR (sec->size);
> bump = desired_end - end;
> /* We'd like to increase START by BUMP, but we must heed
> alignment so the increase might be less than optimum. */
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Missing TO_ADDR
2016-03-31 11:13 ` Dan
@ 2016-04-01 1:28 ` Alan Modra
0 siblings, 0 replies; 9+ messages in thread
From: Alan Modra @ 2016-04-01 1:28 UTC (permalink / raw)
To: dgisselq; +Cc: binutils
On Thu, Mar 31, 2016 at 07:12:46AM -0400, Dan wrote:
> Are you sure you want to take the TO_SIZE directives *away* from the
> minfo statements? With the TO_SIZE directives, the addresses add up:
> last address plus size adds up to the next address, and you can see
> nothing missing. Without the TO_SIZE directives, the units don't match.
You mean, TO_ADDR. I understand your point and thought about
converting all the sizes to address units, but decided not to because
other places report octet sizes. eg. rawsize in print_input_section,
and print_data_statement, print_reloc_statement,
print_padding_statement. It seems likely that those functions bump
print_vma by the wrong amount too.
Hmm, I missed seeing that we have MEMORY region length in bytes, and
I'm not sure what the units are for symbol size in lang_one_common.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Missing TO_ADDR
2016-03-31 16:03 ` Dan
@ 2016-04-01 1:31 ` Alan Modra
2016-04-01 14:42 ` [PATCH] " Dan
0 siblings, 1 reply; 9+ messages in thread
From: Alan Modra @ 2016-04-01 1:31 UTC (permalink / raw)
To: dgisselq; +Cc: binutils
On Thu, Mar 31, 2016 at 12:03:17PM -0400, Dan wrote:
> This would be my proposal for what to change:
I'll approve a patch that is against current master, diff -up
preferred, and has a changelog. Please repost.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Missing TO_ADDR
2016-04-01 1:31 ` Alan Modra
@ 2016-04-01 14:42 ` Dan
2016-04-08 5:16 ` Alan Modra
0 siblings, 1 reply; 9+ messages in thread
From: Dan @ 2016-04-01 14:42 UTC (permalink / raw)
To: Alan Modra; +Cc: dgisselq, binutils
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
Alan,
Sorry, I'm still kind of new to the whole idea of posting patches. Will
this work better?
2016-04-01 Dan Gisselquist <dgisselq@ieee.org>
* ld/ldlang.c: Updated minfo lines so that map file sizes are
given in the target machines address units.
* ld/ldlang.c: Fixed three other references to section sizes
that didn't go through the size in octets to target address
units translation
I used diff -Naur -up this time ...
(Rest of patch attached)
Dan
On Fri, 2016-04-01 at 12:01 +1030, Alan Modra wrote:
> On Thu, Mar 31, 2016 at 12:03:17PM -0400, Dan wrote:
> > This would be my proposal for what to change:
>
> I'll approve a patch that is against current master, diff -up
> preferred, and has a changelog. Please repost.
>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 3050 bytes --]
diff -Naur -up a/ld/ChangeLog b/ld/ChangeLog
--- a/ld/ChangeLog 2016-04-01 10:36:46.571415208 -0400
+++ b/ld/ChangeLog 2016-04-01 10:40:00.458440792 -0400
@@ -1,3 +1,11 @@
+2016-04-01 Dan Gisselquist <dgisselq@ieee.org>
+
+ * ld/ldlang.c: Updated minfo lines so that map file sizes are
+ given in the target machines address units.
+ * ld/ldlang.c: Fixed three other references to section sizes
+ that didn't go through the size in octets to target address
+ units translation
+
2016-02-23 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/ld-frv/fdpic-pie-6.d: Updated.
diff -Naur -up a/ld/ldlang.c b/ld/ldlang.c
--- a/ld/ldlang.c 2016-03-31 11:52:02.147253098 -0400
+++ b/ld/ldlang.c 2016-03-31 12:01:13.039773821 -0400
@@ -1886,7 +1886,7 @@ lang_insert_orphan (asection *s,
before sizing dynamic sections. */
dot = os->bfd_section->vma;
exp_fold_tree (start_assign->exp, os->bfd_section, &dot);
- dot += s->size;
+ dot += TO_ADDR(s->size);
exp_fold_tree (stop_assign->exp, os->bfd_section, &dot);
}
@@ -4002,7 +4002,7 @@ print_output_section_statement
++len;
}
- minfo ("0x%V %W", section->vma, section->size);
+ minfo ("0x%V %W", section->vma, TO_ADDR(section->size));
if (section->vma != section->lma)
minfo (_(" load address 0x%V"), section->lma);
@@ -4312,7 +4312,9 @@ print_data_statement (lang_data_statemen
break;
}
- minfo ("0x%V %W %s 0x%v", addr, size, name, data->value);
+ if (size < TO_SIZE ((unsigned) 1))
+ size = TO_SIZE ((unsigned) 1);
+ minfo ("0x%V %W %s 0x%v", addr, TO_ADDR(size), name, data->value);
if (data->exp->type.node_class != etree_value)
{
@@ -4355,7 +4357,7 @@ print_reloc_statement (lang_reloc_statem
size = bfd_get_reloc_size (reloc->howto);
- minfo ("0x%V %W RELOC %s ", addr, size, reloc->howto->name);
+ minfo ("0x%V %W RELOC %s ", addr, TO_ADDR(size), reloc->howto->name);
if (reloc->name != NULL)
minfo ("%s+", reloc->name);
@@ -4388,7 +4390,7 @@ print_padding_statement (lang_padding_st
addr = s->output_offset;
if (s->output_section != NULL)
addr += s->output_section->vma;
- minfo ("0x%V %W ", addr, (bfd_vma) s->size);
+ minfo ("0x%V %W ", addr, TO_ADDR((bfd_vma) s->size));
if (s->fill->size != 0)
{
@@ -5067,7 +5069,7 @@ lang_size_sections_1
create overlapping LMAs. */
if (dot < last->vma
&& os->bfd_section->size != 0
- && dot + os->bfd_section->size <= last->vma)
+ && dot + TO_ADDR(os->bfd_section->size) <= last->vma)
{
/* If dot moved backwards then leave lma equal to
vma. This is the old default lma, which might
@@ -5084,7 +5086,7 @@ lang_size_sections_1
/* If this is an overlay, set the current lma to that
at the end of the previous section. */
if (os->sectype == overlay_section)
- lma = last->lma + last->size;
+ lma = last->lma + TO_ADDR(last->size);
/* Otherwise, keep the same lma to vma relationship
as the previous section. */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Missing TO_ADDR
2016-04-01 14:42 ` [PATCH] " Dan
@ 2016-04-08 5:16 ` Alan Modra
0 siblings, 0 replies; 9+ messages in thread
From: Alan Modra @ 2016-04-08 5:16 UTC (permalink / raw)
To: dgisselq; +Cc: binutils
On Fri, Apr 01, 2016 at 10:42:08AM -0400, Dan wrote:
> Alan,
>
> Sorry, I'm still kind of new to the whole idea of posting patches. Will
> this work better?
>
> 2016-04-01 Dan Gisselquist <dgisselq@ieee.org>
>
> * ld/ldlang.c: Updated minfo lines so that map file sizes are
> given in the target machines address units.
> * ld/ldlang.c: Fixed three other references to section sizes
> that didn't go through the size in octets to target address
> units translation
>
> I used diff -Naur -up this time ...
Thanks, but..
Hunk #1 FAILED at 1886.
Hunk #2 succeeded at 4001 (offset -1 lines).
Hunk #3 succeeded at 4311 (offset -1 lines).
Hunk #4 succeeded at 4356 (offset -1 lines).
Hunk #5 succeeded at 4389 (offset -1 lines).
Hunk #6 FAILED at 5069.
Hunk #7 FAILED at 5086.
3 out of 7 hunks FAILED -- saving rejects to file ld/ldlang.c.rej
..so I put it aside until I wasn't quite so busy. The rejects turned
out to be due to me already committing those changes. Here's what I
committed for you, and the style of changelog we use around here.
2016-04-08 Dan Gisselquist <dgisselq@ieee.org>
* ldlang.c (print_output_section_statement): Show minfo size
in target machine address units.
(print_reloc_statement): Likewise.
(print_padding_statement): Likewise.
(print_data_statement): Likewise. Ensure minimum print_dot
increment of one address unit.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 9fca810..5fbea3f 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4001,7 +4001,7 @@ print_output_section_statement
++len;
}
- minfo ("0x%V %W", section->vma, section->size);
+ minfo ("0x%V %W", section->vma, TO_ADDR (section->size));
if (section->vma != section->lma)
minfo (_(" load address 0x%V"), section->lma);
@@ -4311,7 +4311,9 @@ print_data_statement (lang_data_statement_type *data)
break;
}
- minfo ("0x%V %W %s 0x%v", addr, size, name, data->value);
+ if (size < TO_SIZE ((unsigned) 1))
+ size = TO_SIZE ((unsigned) 1);
+ minfo ("0x%V %W %s 0x%v", addr, TO_ADDR (size), name, data->value);
if (data->exp->type.node_class != etree_value)
{
@@ -4354,7 +4356,7 @@ print_reloc_statement (lang_reloc_statement_type *reloc)
size = bfd_get_reloc_size (reloc->howto);
- minfo ("0x%V %W RELOC %s ", addr, size, reloc->howto->name);
+ minfo ("0x%V %W RELOC %s ", addr, TO_ADDR (size), reloc->howto->name);
if (reloc->name != NULL)
minfo ("%s+", reloc->name);
@@ -4387,7 +4389,7 @@ print_padding_statement (lang_padding_statement_type *s)
addr = s->output_offset;
if (s->output_section != NULL)
addr += s->output_section->vma;
- minfo ("0x%V %W ", addr, (bfd_vma) s->size);
+ minfo ("0x%V %W ", addr, TO_ADDR (s->size));
if (s->fill->size != 0)
{
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-04-08 5:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30 7:32 Missing TO_ADDR Alan Modra
2016-03-30 12:08 ` Dan
[not found] ` <1459339484.9097.134.camel@jericho>
2016-03-31 7:40 ` Alan Modra
2016-03-31 11:13 ` Dan
2016-04-01 1:28 ` Alan Modra
2016-03-31 16:03 ` Dan
2016-04-01 1:31 ` Alan Modra
2016-04-01 14:42 ` [PATCH] " Dan
2016-04-08 5:16 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).