Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

cannot handle EXCLUDE_FILE in the middle of a input section description #29361

Closed Quuxplusone closed 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR30387
Status RESOLVED FIXED
Importance P normal
Reported by Rafael Ávila de Espíndola (rafael@espindo.la)
Reported on 2016-09-14 14:00:21 -0700
Last modified on 2016-09-16 08:20:33 -0700
Version unspecified
Hardware PC Linux
CC grimar@accesssoftek.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
We fail to parse

SECTIONS
{
  foo :
  {
    *(sec0 EXCLUDE_FILE (zed1.o) sec1  EXCLUDE_FILE (zed2.o) sec2 )
  }
}

The semantics according to bfd are:

* Include sec1 from every file but zed1.o
* Include sec2 from every file but zed2.o
* Include sec0 from every file
Quuxplusone commented 7 years ago
It is even can be like next:

 *(SORT(.foo.1) SORT(EXCLUDE_FILE (*file1.o) .foo.2) SORT(EXCLUDE_FILE (*file2.o) .foo.3))

Working on a fix.
Quuxplusone commented 7 years ago
I noticed difference in semanics of ld/gold here.

Like:
ld wants.
 *(SORT(EXCLUDE_FILE (*file1.o) .foo.1))

gold likes different order.
 *(EXCLUDE_FILE (*file1.o) SORT(.foo.1))

I am inclined to think that means that in real world excludes probably not used
with sorting and it is possible to simplify code a bit and not support that
either. I`ll continue to work on this bug tomorrow.
Quuxplusone commented 7 years ago

Patch: https://reviews.llvm.org/D24650

Quuxplusone commented 7 years ago

r281721