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

            Bug ID: 33323
           Summary: arm linker does not respect --no-relax
           Product: binutils
           Version: 2.46 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

This came up when looking at PR33314 at least for TLS relaxations but I *think*
it never honours it.

It looks like this in ld/emultempl/armelf.em:
```
static void
gld${EMULATION_NAME}_set_symbols (void)
{
  /* PR 19106: The section resizing code in gldarmelf_after_allocation
     is effectively the same as relaxation, so prevent early memory
     region checks which produce bogus error messages.
     Note - this test has nothing to do with symbols.  It is just here
     because this is the first emulation routine that is called after
     the command line has been parsed.  */
  if (!bfd_link_relocatable (&link_info))
    TARGET_ENABLE_RELAXATION;
}
```
clobbers DISABLE_RELAXATION set by --no-relax.

ld/emultempl/loongarchelf.em instead honours RELAXATION_DISABLED_BY_USER by
doing:
```
static void
larch_elf_before_allocation (void)
{
  gld${EMULATION_NAME}_before_allocation ();

  if (link_info.discard == discard_sec_merge)
    link_info.discard = discard_l;

  if (!bfd_link_relocatable (&link_info))
    {
      /* We always need at least some relaxation to handle code alignment.  */
      if (RELAXATION_DISABLED_BY_USER)
        TARGET_ENABLE_RELAXATION;
      else
        ENABLE_RELAXATION;
    }

  link_info.relax_pass = 3;
}
```

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

Reply via email to