[Bug ld/30499] reword "alignment ... is smaller than alignment ..." warning

2023-05-30 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=30499

--- Comment #2 from Michael Matz  ---
Hmm, on reflection this proposed message might not actually be correct.
Generally one can't just increase the alignment of random data symbols like
here: they might be part of a larger object with known relative offsets, and
changing the alignment of such data symbol will then break such knowledge.

In _this_ specific case everything works out and the resulting alignment of
'com2_' is 64.  But that might not always be possible, which I guess is the
reason for the warning in the first place.  And changing the wording to suggest
that the bigger alignment is actually used always is then misleading.

So one point for not changing the warning :)

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


[Bug ld/30499] reword "alignment ... is smaller than alignment ..." warning

2023-05-30 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=30499

--- Comment #1 from Michael Matz  ---
Patch would be trivial:

--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -5339,7 +5339,7 @@ elf_link_add_object_symbols (bfd *abfd, struct
bfd_link_info *info)
_bfd_error_handler
  /* xgettext:c-format */
  (_("warning: alignment %u of symbol `%s' in %pB"
-" is smaller than %u in %pB"),
+" changed to %u to match %pB"),
   1 << normal_align, name, normal_bfd,
   1 << common_align, common_bfd);
}

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


[Bug ld/30499] New: reword "alignment ... is smaller than alignment ..." warning

2023-05-30 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=30499

Bug ID: 30499
   Summary: reword "alignment ... is smaller than alignment ..."
warning
   Product: binutils
   Version: 2.41 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: matz at suse dot de
  Target Milestone: ---

A customer of a customer of ours is requesting that the warning about
mismatching symbol alignments be reworded.  Given this:

% cat test1.s
  .type   com2_,@object
  .comm   com2_,8,64
  .quad   com2_
% cat test2.s
  .globl  com2_
  .data
  .align 32
  .type   com2_, @object
  .size   com2_, 8
com2_:
  .quad   2
% cat main.c
int main () {
return 0;
}
% cc -c main.c test1.s test2.s
% cc main.o test1.o test2.o

The current warning is:
warning: alignment 32 of symbol `com2_' in test2.o is smaller than 64 in
test1.o

The proposal would be:
warning: alignment 32 of symbol `com2_' in test2.o changed to 64 to match
test1.o

I think the proposed warning is a little bit nicer as being explicit what the
resolution to the situation is.  I'm undecided if it's nicer enough to warrant
changing a translated warning, which is why I'm creating this PR, perhaps I
get opinions :-)

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