[Bug ld/24411] New: Division is not accepted in MEMORY length expression

2019-04-02 Thread rda_emcraft at mail dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=24411

Bug ID: 24411
   Summary: Division is not accepted in MEMORY length expression
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: rda_emcraft at mail dot ru
  Target Milestone: ---

I've encountered that division is not accepted in the expression specifying
length of a memory region.

I was able to confirm that at least the following versions of ld are affected:

(Fedora29-x64)
GNU ld version 2.31.1-24.fc29
Copyright (C) 2018 Free Software Foundation, Inc.

(slackware-x64)
GNU ld version 2.26.20160125
Copyright (C) 2015 Free Software Foundation, Inc.

(arm-none-eabi)
GNU ld (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 2.31.51.20181213
Copyright (C) 2018 Free Software Foundation, Inc.

(arm-none-eabi)
GNU ld (Sourcery G++ Lite 2010q1-188) 2.19.51.20090709
Copyright 2008 Free Software Foundation, Inc.


The symptom is:
$cat bad.lds
MEMORY
{
DEFAULT (r) : ORIGIN = 0x8000, LENGTH = 0x8000
ROM (rx) : ORIGIN = 0, LENGTH = ((2*1024*1024)/2) + 0x1000 
RAM (rwx) : ORIGIN = 0x2000, LENGTH = (192*1024)
}
SECTIONS
{
.text : {
*(.text .stub)
*(.glue_7t) *(.glue_7)
} > ROM
}

$ld -T bad.lds
ld:bad.lds:4: syntax error


Replacing "/2" with ">>1" in expression remove the syntax error message:

$cat good.lds
MEMORY
{
DEFAULT (r) : ORIGIN = 0x8000, LENGTH = 0x8000
ROM (rx) : ORIGIN = 0, LENGTH = ((2*1024*1024) >> 1) + 0x1000 
RAM (rwx) : ORIGIN = 0x2000, LENGTH = (192*1024)
}
SECTIONS
{
.text : {
*(.text .stub)
*(.glue_7t) *(.glue_7)
} > ROM
}

$ld -T good.lds
ld: no input files

Indeed, no files were provided, but at least script is parsed successfully.

>From the ld manual:

   The ORIGIN is an numerical expression for the start address of the
memory region.  The expression must evaluate to a constant and it cannot
involve any symbols.  The keyword 'ORIGIN' may be abbreviated to 'org'
or 'o' (but not, for example, 'ORG').

  The LEN is an expression for the size in bytes of the memory region.
As with the ORIGIN expression, the expression must be numerical only and
must evaluate to a constant.  The keyword 'LENGTH' may be abbreviated to
'len' or 'l'.

So, "/2" shall be accepted. And in real world that expression comes from
expansion of preprocessor macros, so changing it is non-trivial.

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


[Bug ld/24406] -Wl,--wrap= incompatible with -flto

2019-04-02 Thread dilyan.palauzov at aegee dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24406

--- Comment #1 from dilyan.palauzov at aegee dot org  ---
Reported the same at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89930 for GCC
with the note “since clang+gold works, gcc+gold should also work.”

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


[Bug ld/24406] -Wl,--wrap= incompatible with -flto

2019-04-02 Thread dilyan.palauzov at aegee dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24406

--- Comment #2 from dilyan.palauzov at aegee dot org  ---
This works:

clang -flto -fuse-ld=lld -Wl,--wrap=read t.c 

with ld.LLD 8.0.0.

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


[Bug ld/24389] can't link soft-float modules with double-float modules

2019-04-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24389

--- Comment #6 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Jim Wilson :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=87f98bacb76001157d5a26555a41738ac3841a56

commit 87f98bacb76001157d5a26555a41738ac3841a56
Author: Jim Wilson 
Date:   Tue Apr 2 13:30:07 2019 -0700

RISC-V: Don't check ABI flags if no code section.

This fixes a glib build failure reported in PR 24389.  Using ld -b binary
creates an object file with no elf header flags set which has the wrong ABI
info for riscv64-linux.  But the file also has no code sections, so I added
code borrowed from the arm port that only checks the ELF header ABI flags
if
there is a code section.

bfd/
PR 24389
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Move read of
ELF header flags to after check for ELF object file.  Loop through
sections looking for code sections, if none, then skip ABI checks.

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


[Bug ld/24389] can't link soft-float modules with double-float modules

2019-04-02 Thread wilson at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24389

Jim Wilson  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jim Wilson  ---
Patch added to mainline.

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


[Bug ld/24406] -Wl,--wrap= incompatible with -flto

2019-04-02 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24406

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-04-02
 CC||hjl.tools at gmail dot com
   Target Milestone|--- |2.33
 Ever confirmed|0   |1

--- Comment #3 from H.J. Lu  ---
A patch is posted at

https://sourceware.org/ml/binutils/2019-04/msg00011.html

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


[Bug ld/24411] Division is not accepted in MEMORY length expression

2019-04-02 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24411

Alan Modra  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-04-03
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com
 Ever confirmed|0   |1

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


[Bug ld/24411] Division is not accepted in MEMORY length expression

2019-04-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24411

--- Comment #1 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1c6aafe894645ca1da5c0dd0661bca19caf37ad0

commit 1c6aafe894645ca1da5c0dd0661bca19caf37ad0
Author: Alan Modra 
Date:   Wed Apr 3 11:21:36 2019 +1030

PR24411, Division is not accepted in MEMORY length expression

Let's hope no one has section names starting with '/' in scripts.  If
they do, this change to fix parsing of '/' in expressiongs will break
their project.

PR 24411
ldlex.l (SYMBOLNAMECHAR1): Don't match '/'.
("/DISCARD/"): New.

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


[Bug ld/24411] Division is not accepted in MEMORY length expression

2019-04-02 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24411

Alan Modra  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Alan Modra  ---
Fixed on master.  Workaround for older linkers is to write "/ 2" rather than
"/2".

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