[Bug ld/21250] New: ld --sysroot without --with-sysroot searches default dirs

2017-03-15 Thread ro at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21250

Bug ID: 21250
   Summary: ld --sysroot without --with-sysroot searches default
dirs
   Product: binutils
   Version: 2.28
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: ro at gcc dot gnu.org
  Target Milestone: ---

Playing around with gcc --sysroot, I noticed a weird ld behaviour.  I've
observed
this with native gcc mainline and gld 2.28, on both i386-pc-solaris2.12 and
x86_64-pc-linux-gnu, so I suppose it's target independent:

* When binutils have been configured without --with-sysroot and I point gcc at
  a non-existant/empty --sysroot directory, header files aren't found during
  compilation, just as expected.

  Once I add a copy of usr/include, compilation succeeds but startup files gcc
  searches itself (like crt1.o and friends) aren't found.

  Adding them (to /usr/lib instead of /usr/lib64 as I'd would
  have expected on Linux) causes both the startup files to be found and the
link
  to succeed *although there's no libc.so/libc.so.6 below *.

* However, if I configure binutils with --with-sysroot pointing to a
non-existant
  directory, the exact same ld invocation now fails to find libc.so, as it
should.

* Unlike ld, gold (2.27 in this case) gets this right, however: a default gold
  build doesn't find libc.so if it's missing below .

Besides, ld.texinfo incorrectly claims that --sysroot only works when binutils
have been configured with --with-sysroot, which is no longer true.  It seems
this
was true until binutils 2.25,however.

  Rainer

-- 
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/21251] New: Support $SYSROOT in ld -L and INPUT command

2017-03-15 Thread ro at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21251

Bug ID: 21251
   Summary: Support $SYSROOT in ld -L and INPUT command
   Product: binutils
   Version: 2.28
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: ro at gcc dot gnu.org
  Target Milestone: ---

Using = to refer to the sysroot prefix in both the -L option and the INPUT
command is not very expressive/mnemonic.  It would seem useful to additionall
support $SYSROOT similarly to $ORIGIN and $LIB.

-- 
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/21252] New: -shared/-pie create RWE LOAD segment

2017-03-15 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21252

Bug ID: 21252
   Summary: -shared/-pie create RWE LOAD segment
   Product: binutils
   Version: 2.29 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
Target: hppa64-linux

hjl@gnu-mic-2 ld]$ cat x.s
.text
.global start   /* Used by SH targets.  */
start:
.global _start
_start:
.global __start
__start:
.global main/* Used by HPPA targets.  */
main:
.dc.a 0
.data
.byte 2
[hjl@gnu-mic-2 ld]$ ../gas/as-new -o x.o x.s
[hjl@gnu-mic-2 ld]$ ./ld-new -shared x.o
[hjl@gnu-mic-2 ld]$ ../binutils/readelf -SWl a.out 
There are 10 section headers, starting at offset 0x14e8:

Section Headers:
  [Nr] Name  TypeAddress  OffSize   ES Flg
Lk Inf Al
  [ 0]   NULL 00 00 00 
0   0  0
  [ 1] .dynamic  DYNAMIC 00e8 e8 e0 10  WA 
4   0  8
  [ 2] .hash HASH01c8 0001c8 34 04   A 
3   0  8
  [ 3] .dynsym   DYNSYM  0200 000200 c0 18   A 
4   1  8
  [ 4] .dynstr   STRTAB  02c0 0002c0 26 00   A 
0   0  1
  [ 5] .text PROGBITS02e8 0002e8 08 00  AX 
0   0  8
  [ 6] .data PROGBITS12f0 0012f0 11 00  WA 
0   0  1
  [ 7] .symtab   SYMTAB   001308 000168 18 
8   8  8
  [ 8] .strtab   STRTAB   001470 2f 00 
0   0  1
  [ 9] .shstrtab STRTAB   00149f 46 00 
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0x2e8
There are 3 program headers, starting at offset 64

Program Headers:
  Type   Offset   VirtAddr   PhysAddr   FileSiz  MemSiz
  Flg Align
  PHDR   0x40 0x0040 0x 0xa8
0xa8 R E 0x8
  LOAD   0x00 0x 0x 0x001301
0x001301 RWE 0x1000
  DYNAMIC0xe8 0x00e8 0x00e8 0xe0
0xe0 RW  0x8

 Section to Segment mapping:
  Segment Sections...
   00 
   01 .dynamic .hash .dynsym .dynstr .text .data 
   02 .dynamic 
[hjl@gnu-mic-2 ld]$  

I was expecting

  LOAD   0x00 0x0001 0x0001 0xf0
0xf0 R E 0x1000
  LOAD   0xf0 0x000110f0 0x000110f0 0x11
0x11 RW  0x1000

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