https://sourceware.org/bugzilla/show_bug.cgi?id=19979

            Bug ID: 19979
           Summary: Linker arithmetic behavior changed between 2.25 and
                    2.26
           Product: binutils
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: stefan.reinauer at coreboot dot org
  Target Milestone: ---

We used to have the following assert in our linker script:

/* SRAM memory is mapped in two different locations. Define regions in both for
 * full overlap checking and use this to guarantee they're kept in sync. */
#define ASSERT_MIRRORED(r1, r2) \
        _ = ASSERT(_e##r1 - _##r1 == _e##r2 - _##r2 && \
                   _##r1 & 0x7fffffff == _##r2 & 0x7fffffff, \
                   STR(r1 and r2 do not match!));
[..]
ASSERT_MIRRORED(bootblock, gram_bootblock)

With binutils 2.25 everything was fine, but the assert started triggering with
2.26.

As a fix in our code base I changed the code to:
#define ASSERT_MIRRORED(r1, r2) \
        _ = ASSERT((_e##r1 - _##r1) == (_e##r2 - _##r2) && \
                   (_##r1 & 0x7fffffff) == (_##r2 & 0x7fffffff), \
                   STR(r1 and r2 do not match!));

which seems like a good idea anyways, but I think binutils 2.26 is still doing
the wrong thing by grouping the parts of the expression differently than it
should.

Here's the link to the code change:
https://review.coreboot.org/#/c/14440

-- 
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

Reply via email to