[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/26543] New: bfd_generic_define_common_symbol does not calculate
From: |
tuckkern+sourceware at gmail dot com |
Subject: |
[Bug ld/26543] New: bfd_generic_define_common_symbol does not calculate correct alignment when bfd_octets_per_byte > 1 and power_of_two == 0 |
Date: |
Thu, 27 Aug 2020 03:13:21 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26543
Bug ID: 26543
Summary: bfd_generic_define_common_symbol does not calculate
correct alignment when bfd_octets_per_byte > 1 and
power_of_two == 0
Product: binutils
Version: 2.34
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: tuckkern+sourceware at gmail dot com
Target Milestone: ---
Created attachment 12803
--> https://sourceware.org/bugzilla/attachment.cgi?id=12803&action=edit
Patch implementing described fix
bfd_generic_define_common_symbol does not calculate the correct alignment for
targets with more than 1 octet per byte if alignment power is less than 1.
3103: linker.c
alignment = bfd_octets_per_byte (output_bfd, section) << power_of_two;
e.g.
A target has 16-bit bytes and an alignment of 1 byte (2 octets).
A common variable may be defined as .comm variable,1,1
bfd_log2(1) will calculate alignment_power == 0
Mathematically 2 ** 0 == 1 which would be correct but the above statement will
evaluate to 2.
Instead the statement should check for a power_of_two == 0 condition i.e.
alignment = power_of_two ? bfd_octets_per_byte (output_bfd, section) <<
power_of_two : 1;
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/26543] New: bfd_generic_define_common_symbol does not calculate correct alignment when bfd_octets_per_byte > 1 and power_of_two == 0,
tuckkern+sourceware at gmail dot com <=