[Bug ld/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error

2016-01-30 Thread sch...@linux-m68k.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19526

--- Comment #5 from Andreas Schwab  ---
I think ld should error out if the output isn't a regular file.  There are
probably other cases where the linker needs to reread what it has written out.

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hpa at zytor dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #6 from hpa at zytor dot com  ---
On January 30, 2016 12:53:18 PM PST, hpa at zytor dot com
 wrote:
>https://sourceware.org/bugzilla/show_bug.cgi?id=19538
>
>--- Comment #5 from hpa at zytor dot com  ---
>On January 30, 2016 9:08:32 AM PST, "hjl.tools at gmail dot com"
> wrote:
>>https://sourceware.org/bugzilla/show_bug.cgi?id=19538
>>
>>--- Comment #3 from H.J. Lu  ---
>>(In reply to H.J. Lu from comment #2)
>>> pfx_compressed, which is __pm_code_lma, is wrong:
>>> 
>>> section .prefix nowrite progbits align=16
>>> pfx_start   dd _start   ; Start of raw chunk
>>> pfx_compressed  dd __pm_code_lma; Start of compressed chunk
>>> pfx_cdatalendd lzo_data_size; Pointer to compressed size
>>field
>>> %if IS_ISOLINUX
>>> pfx_checksumdd bi_length; File length and checksum
>>fields
>>> %else
>>> pfx_checksumdd 0; No checksum
>>> %endif
>>> pfx_maxlma  dd MaxLMA   ; Maximum size
>>> 
>>> 9770 B __pm_code_lma
>>
>>bios/core/ldlinux.elf is built with -pie.  The value of __pm_code_lma
>>won't be known until run-time:
>>
>>Relocation section '.rel.dyn' at offset 0x1ba34 contains 1435 entries:
>> Offset InfoTypeSym.Value  Sym. Name
>>...
>>0004  00010d01 R_386_32  9770   __pm_code_lma
>>8f62  00010d01 R_386_32  9770   __pm_code_lma
>>
>>Peter, am I missing something?
>
>ldlinux.elf shouldn't be build pie, so that would explain why.

What I genuinely can't remember offhand is whether or not it is a combination
of pic and non-pic objects...

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hpa at zytor dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #5 from hpa at zytor dot com  ---
On January 30, 2016 9:08:32 AM PST, "hjl.tools at gmail dot com"
 wrote:
>https://sourceware.org/bugzilla/show_bug.cgi?id=19538
>
>--- Comment #3 from H.J. Lu  ---
>(In reply to H.J. Lu from comment #2)
>> pfx_compressed, which is __pm_code_lma, is wrong:
>> 
>> section .prefix nowrite progbits align=16
>> pfx_start   dd _start   ; Start of raw chunk
>> pfx_compressed  dd __pm_code_lma; Start of compressed chunk
>> pfx_cdatalendd lzo_data_size; Pointer to compressed size
>field
>> %if IS_ISOLINUX
>> pfx_checksumdd bi_length; File length and checksum
>fields
>> %else
>> pfx_checksumdd 0; No checksum
>> %endif
>> pfx_maxlma  dd MaxLMA   ; Maximum size
>> 
>> 9770 B __pm_code_lma
>
>bios/core/ldlinux.elf is built with -pie.  The value of __pm_code_lma
>won't be known until run-time:
>
>Relocation section '.rel.dyn' at offset 0x1ba34 contains 1435 entries:
> Offset InfoTypeSym.Value  Sym. Name
>...
>0004  00010d01 R_386_32  9770   __pm_code_lma
>8f62  00010d01 R_386_32  9770   __pm_code_lma
>
>Peter, am I missing something?

ldlinux.elf shouldn't be build pie, so that would explain why.

-- 
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/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error

2016-01-30 Thread dave.anglin at bell dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=19526

--- Comment #9 from dave.anglin at bell dot net ---
On 2016-01-30, at 1:14 PM, John David Anglin wrote:

> It seems to me we either have to match x86 behaviour, or the linker should 
> not allow writing
> to a non-regular file.

Something like to the following can check if the output file is a regular file.
 Various stat errors
could also be reported.

I'm not sure how portable this is.

Dave
--
John David Anglin   dave.ang...@bell.net

-- 
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 binutils/19538] New: binutils (objcopy?) >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread pomidorabelisima at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

Bug ID: 19538
   Summary: binutils (objcopy?) >= 2.26 breaks syslinux (bios)
build
   Product: binutils
   Version: 2.27 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: pomidorabelisima at gmail dot com
  Target Milestone: ---

Hi Fi


$ rpm --query --file /usr/bin/objcopy
binutils-2.25.1-9.fc24.x86_64

$ cd syslinux-7cd1ed6/
$ make bios
...
make[3]: Leaving directory '/tmp/syslinux-7cd1ed6/bios/gpxe'
make[2]: Leaving directory '/tmp/syslinux-7cd1ed6/bios'
make[1]: Leaving directory '/tmp/syslinux-7cd1ed6'

$ file bios/core/*.bin
bios/core/isolinux.bin: data
bios/core/isolinux-debug.bin: isolinux Loader (version 6.04)
bios/core/ldlinux.bin: Syslinux bootloader (version 3.10 or newer)
bios/core/lpxelinux.bin: data
bios/core/pxelinux.bin: data

this looks OK,
however ...

$ rpm --query --file /usr/bin/objcopy
binutils-2.26-4.fc24.x86_64

$ cd syslinux-7cd1ed6/
$ make bios
...
objcopy -O binary -S ldlinux.elf ldlinux.raw
objcopy -O binary -S isolinux.elf isolinux.raw
objcopy -O binary -S isolinux-debug.elf isolinux-debug.raw
/tmp/syslinux-7cd1ed6/bios/core/../lzo/prepcore ldlinux.raw ldlinux.bin
objdump -h pxelinux.elf > pxelinux.sec
perl /tmp/syslinux-7cd1ed6/core/lstadjust.pl pxelinux.lsr pxelinux.sec
pxelinux.lst
objdump -h lpxelinux.elf > lpxelinux.sec
perl /tmp/syslinux-7cd1ed6/core/lstadjust.pl lpxelinux.lsr lpxelinux.sec
lpxelinux.lst
/tmp/syslinux-7cd1ed6/bios/core/../lzo/prepcore isolinux.raw isolinux.bin
/tmp/syslinux-7cd1ed6/bios/core/../lzo/prepcore isolinux-debug.raw
isolinux-debug.bin
/tmp/syslinux-7cd1ed6/bios/core/../lzo/prepcore: ldlinux.raw: write error
/tmp/syslinux-7cd1ed6/core/Makefile:153: recipe for target 'ldlinux.bin' failed
make[3]: *** [ldlinux.bin] Error 1
make[3]: *** Waiting for unfinished jobs
/tmp/syslinux-7cd1ed6/bios/core/../lzo/prepcore: isolinux.raw: write error
/tmp/syslinux-7cd1ed6/core/Makefile:153: recipe for target 'isolinux.bin'
failed
make[3]: *** [isolinux.bin] Error 1
/tmp/syslinux-7cd1ed6/bios/core/../lzo/prepcore: isolinux-debug.raw: write
error
/tmp/syslinux-7cd1ed6/core/Makefile:153: recipe for target 'isolinux-debug.bin'
failed
make[3]: *** [isolinux-debug.bin] Error 1
rm isolinux-debug.raw isolinux-debug.o ldlinux.o ldlinux.raw isolinux.o
isolinux.raw
make[3]: Leaving directory '/tmp/syslinux-7cd1ed6/bios/core'
/tmp/syslinux-7cd1ed6/Makefile:287: recipe for target 'core' failed
make[2]: *** [core] Error 2
make[2]: Leaving directory '/tmp/syslinux-7cd1ed6/bios'
/tmp/syslinux-7cd1ed6/Makefile:256: recipe for target 'bios' failed
make[1]: *** [bios] Error 2
make[1]: Leaving directory '/tmp/syslinux-7cd1ed6'
Makefile:104: recipe for target 'bios' failed
make: *** [bios] Error 2

$ file bios/core/*.bin
bios/core/isolinux.bin: empty
bios/core/isolinux-debug.bin: empty
bios/core/ldlinux.bin: empty

the same goes for
$ /usr/local/bin/objcopy --version | head -1
GNU objcopy (GNU Binutils) 2.26.51.20160130

-- 
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 binutils/19538] binutils (objcopy?) >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

H.J. Lu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu  ---
bios/core/ldlinux.elf has

Contents of section .prefix:
  007c  5c96   .|..\...
 0010 0200  

(gdb) p/x *prefix
$9 = {pfx_start = 0x7c00, pfx_compressed = 0x0, pfx_cdatalen = 0x965c, 
  pfx_checksum = 0x0, pfx_maxlma = 0x2}
(gdb) 

Does it look normal?

-- 
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/19538] binutils (objcopy?) >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

H.J. Lu  changed:

   What|Removed |Added

  Component|binutils|ld

--- Comment #2 from H.J. Lu  ---
pfx_compressed, which is __pm_code_lma, is wrong:

section .prefix nowrite progbits align=16
pfx_start   dd _start   ; Start of raw chunk
pfx_compressed  dd __pm_code_lma; Start of compressed chunk
pfx_cdatalendd lzo_data_size; Pointer to compressed size field
%if IS_ISOLINUX
pfx_checksumdd bi_length; File length and checksum fields
%else
pfx_checksumdd 0; No checksum
%endif
pfx_maxlma  dd MaxLMA   ; Maximum size

9770 B __pm_code_lma

-- 
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/19538] binutils (objcopy?) >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread pomidorabelisima at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

poma  changed:

   What|Removed |Added

 CC||hpa at zytor dot com

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #3 from H.J. Lu  ---
(In reply to H.J. Lu from comment #2)
> pfx_compressed, which is __pm_code_lma, is wrong:
> 
> section .prefix nowrite progbits align=16
> pfx_start   dd _start   ; Start of raw chunk
> pfx_compressed  dd __pm_code_lma; Start of compressed chunk
> pfx_cdatalendd lzo_data_size; Pointer to compressed size field
> %if IS_ISOLINUX
> pfx_checksumdd bi_length; File length and checksum fields
> %else
> pfx_checksumdd 0; No checksum
> %endif
> pfx_maxlma  dd MaxLMA   ; Maximum size
> 
> 9770 B __pm_code_lma

bios/core/ldlinux.elf is built with -pie.  The value of __pm_code_lma
won't be known until run-time:

Relocation section '.rel.dyn' at offset 0x1ba34 contains 1435 entries:
 Offset InfoTypeSym.Value  Sym. Name
...
0004  00010d01 R_386_32  9770   __pm_code_lma
8f62  00010d01 R_386_32  9770   __pm_code_lma

Peter, am I missing something?

-- 
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/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error

2016-01-30 Thread dave.anglin at bell dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=19526

--- Comment #8 from dave.anglin at bell dot net ---
On 2016-01-30, at 8:51 AM, sch...@linux-m68k.org wrote:

> https://sourceware.org/bugzilla/show_bug.cgi?id=19526
> 
> --- Comment #7 from Andreas Schwab  ---
> The linker should not allow writing the output to a non-regular file in the
> first place.  Changing the behaviour depending on the type of output file 
> would
> be wrong.


Currently in bfd/opncls.c, there is the following code

  if (abfd->direction == write_direction
  && (abfd->flags & (EXEC_P | DYNAMIC)) != 0)
{
  struct stat buf;

  if (stat (abfd->filename, ) == 0
  /* Do not attempt to change non-regular files.  This is
 here especially for configure scripts and kernel builds
 which run tests with "ld [...] -o /dev/null".  */
  && S_ISREG(buf.st_mode))
{
  unsigned int mask = umask (0);

  umask (mask);
  chmod (abfd->filename,
 (0777
  & (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask;
}
}

to support "ld [...] -o /dev/null".

It seems to me we either have to match x86 behaviour, or the linker should not
allow writing
to a non-regular file.

Dave
--
John David Anglin   dave.ang...@bell.net

-- 
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/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error

2016-01-30 Thread sch...@linux-m68k.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19526

--- Comment #7 from Andreas Schwab  ---
The linker should not allow writing the output to a non-regular file in the
first place.  Changing the behaviour depending on the type of output file would
be wrong.

-- 
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 binutils/19538] binutils (objcopy?) >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread pomidorabelisima at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

poma  changed:

   What|Removed |Added

 CC||nickc at redhat dot com

-- 
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 binutils/19538] binutils (objcopy?) >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread pomidorabelisima at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

poma  changed:

   What|Removed |Added

   See Also||http://bugs.debian.org/8064
   ||87

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

H.J. Lu  changed:

   What|Removed |Added

Summary|binutils (objcopy?) >= 2.26 |ld >= 2.26 breaks syslinux
   |breaks syslinux (bios)  |(bios) build
   |build   |

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #4 from H.J. Lu  ---
Created attachment 8939
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8939=edit
Try this syslinux patch

Please try this and verify if it generates a working syslinux.

-- 
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/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error

2016-01-30 Thread deller at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=19526

--- Comment #6 from Helge Deller  ---
Andreas wrote:
> I think ld should error out if the output isn't a regular file.

It currently does error out with a "final link failed: File truncated" error in
that case. But that's actually the problem. It shouldn't error out as I
described in the bug report.

-- 
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 binutils/19501] binutils should be updated to support additional target

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19501

H.J. Lu  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.26

--- Comment #2 from H.J. Lu  ---
No response.  Should be fixed in 2.26.

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #7 from H.J. Lu  ---
(In reply to h...@zytor.com from comment #5)
> 
> ldlinux.elf shouldn't be build pie, so that would explain why.

It was changed to PIE by

commit 38e58635d3868c23537fc5dce87b152a52df34ad
Author: chandramouli narayanan 
Date:   Mon Jun 25 12:45:26 2012 -0700

The make files have undergone changes to support both i386 and x86_64
platforms.
Pertinent changes are sprinkled through *.mk and Makefile in the syslinux
tree.

Build architecture is specified at the command line via ARCH macro. This is
to enable whether
one is building for the native platform or cross-building for a different
architecture. Currently,
the only supported architectures via ARCH macro are i386 and x86_64.

There are some modules (e.g. memdump) that don't build under the EFI
environment. To go forward
with efi boot support, a separate EFI_BUILD=1 macro has been added and is
required to be
specified while building. This is a temporary solution for the current
build environment.

example build:

On a x86_64 platform, the following cross-builds syslinux for i386
To build for i386: make EFI_BUILD=1 ARCH=i386

On a x86_64 platform, the following builds syslinux for x86_64
To build natively: make EFI_BUILD=1

Changes specific to GCC and LD options:

Architecture specific flags and include/search directories are set up for
GCC and LD commands.
Internally, GCC options such as stack-boundary, PIC and machine
architecture are set up
based on ARCH macro. While stack-boundary=2 is fine for i386, it does not
work for x86_64
and so it is left to the default value. Using -fPIE with gcc does not work
with ld on x86_64,
but -fPIC works fine. Similarly, target and elf options are set up for
linking
as approrpriate for architecture.

Assumption about gnu-efi install path:

Since the EFI build supports both EFI32 and EFI64, the following
assumptions
are made with regard to the installed location of gnu-efi on the build
platform.
1. gnu-efi-ia32: assumed installed in /usr/local
[ EFI-32 include files in /usr/local/include/efi and gnu-efi library in
/usr/local/lib/ ]
2. gnu-efi-x86_64: assumed installed in /usr
[ EFI-64 include files in /usr/include/efi and gnu-efi library in
/usr/lib64/ ]

Remanants of the unused old i386-only files, if any, need to be pruned.

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #8 from H.J. Lu  ---
(In reply to h...@zytor.com from comment #6)
>
> >
> >ldlinux.elf shouldn't be build pie, so that would explain why.
> 
> What I genuinely can't remember offhand is whether or not it is a
> combination of pic and non-pic objects...

It may be used for EFI.

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hpa at zytor dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #11 from hpa at zytor dot com  ---
On January 30, 2016 2:18:51 PM PST, "hjl.tools at gmail dot com"
 wrote:
>https://sourceware.org/bugzilla/show_bug.cgi?id=19538
>
>--- Comment #8 from H.J. Lu  ---
>(In reply to h...@zytor.com from comment #6)
>>
>> >
>> >ldlinux.elf shouldn't be build pie, so that would explain why.
>> 
>> What I genuinely can't remember offhand is whether or not it is a
>> combination of pic and non-pic objects...
>
>It may be used for EFI.

But that is not built in core/bios.

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #10 from H.J. Lu  ---
It is a syslinux bug.  Please reopen it if it isn't the case.

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #12 from H.J. Lu  ---
(In reply to h...@zytor.com from comment #11)
> 
> But that is not built in core/bios.

core/Makefile has

# Set up the NASM and LD options for the architecture
NASM_ELF = "unknown"
LD_PIE = "unknown"
ifeq ($(ARCH),i386)
NASM_ELF = elf 
LD_PIE = -pie
endif
ifeq ($(ARCH),x86_64)
NASM_ELF = elf64
#LD_PIE = --pic-executable
LD_PIE = 
endif

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

H.J. Lu  changed:

   What|Removed |Added

   Attachment #8939|0   |1
is obsolete||

--- Comment #9 from H.J. Lu  ---
Created attachment 8941
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8941=edit
Please try this simpler patch

-- 
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/19539] New: ld: Segmentation fault (core dumped)

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19539

Bug ID: 19539
   Summary: ld: Segmentation fault (core dumped)
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

[hjl@gnu-tools-1 pr19538]$ cat x.s
.section .prefix,"a",@progbits
.dc.a foo
.text
.global _start
_start:
ret
[hjl@gnu-tools-1 pr19538]$ cat ld.t 
HIDDEN (foo = .);
[hjl@gnu-tools-1 pr19538]$ make
as --32  -o x.o x.s
./ld -pie -T ld.t -m elf_i386 -o x x.o
Makefile:13: recipe for target 'x' failed
make: *** [x] Segmentation fault (core dumped)
make: *** Deleting file 'x'
[hjl@gnu-tools-1 pr19538]$

-- 
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/19539] ld: Segmentation fault (core dumped)

2016-01-30 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19539

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
Version|unspecified |2.27 (HEAD)
 Resolution|--- |FIXED
   Target Milestone|--- |2.27

--- Comment #2 from H.J. Lu  ---
Fixed for 2.27.

-- 
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/19538] ld >= 2.26 breaks syslinux (bios) build

2016-01-30 Thread hpa at zytor dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19538

--- Comment #13 from hpa at zytor dot com  ---
On January 30, 2016 4:19:57 PM PST, "hjl.tools at gmail dot com"
 wrote:
>https://sourceware.org/bugzilla/show_bug.cgi?id=19538
>
>--- Comment #12 from H.J. Lu  ---
>(In reply to h...@zytor.com from comment #11)
>> 
>> But that is not built in core/bios.
>
>core/Makefile has
>
># Set up the NASM and LD options for the architecture
>NASM_ELF = "unknown"
>LD_PIE = "unknown"
>ifeq ($(ARCH),i386)
>NASM_ELF = elf 
>LD_PIE = -pie
>endif
>ifeq ($(ARCH),x86_64)
>NASM_ELF = elf64
>#LD_PIE = --pic-executable
>LD_PIE = 
>endif

And that is true for most of the modules.  Let me look into it later.

However, part of the weirdness is that it is a partly pic and partly non-pic
object.

-- 
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/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error

2016-01-30 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19526

--- Comment #11 from Alan Modra  ---
Ah, never mind about S_ISLNK.  You're using stat, not lstat.

-- 
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/19541] Format reader for ILF format (used by MSVC-generated import libraries) does not properly handle data imports

2016-01-30 Thread njs at pobox dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19541

--- Comment #1 from Nathaniel J. Smith  ---
Created attachment 8943
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8943=edit
First attempt at a patch

-- 
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/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error

2016-01-30 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19526

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #10 from Alan Modra  ---
Dave, I like your first patch, but you should probably allow S_ISLNK too.  The
second will only cause grief for distros.

-- 
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/19541] New: Format reader for ILF format (used by MSVC-generated import libraries) does not properly handle data imports

2016-01-30 Thread njs at pobox dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19541

Bug ID: 19541
   Summary: Format reader for ILF format (used by MSVC-generated
import libraries) does not properly handle data
imports
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: njs at pobox dot com
  Target Milestone: ---

On Windows, there are two formats for "import libraries" commonly in use: the
format generated by dlltool and commonly used with mingw-w64 toolchains, which
is an ar archive of COFF objects (conventionally named like "libpython27.a"),
and the format generated and commonly used by MSVC toolchains, which is an ar
archive of "ILF" objects (and conventionally named like "python27.lib").

Either way, the purpose of such files is to provide DLL imports. DLL imports
come in two main flavors. There are "code" symbols, which refer to functions,
and which require (a) a __imp___foo relocation symbol, and (b) _foo trampoline
that just jumps to __imp___foo. And then there are "data" symbols, which refer
to things like global variables exported from a DLL, and only require a
__imp___foo symbol, with no trampoline symbol. In the ILF format these are
represented identically, except that there is a flag value labeling each import
symbol as either IMPORT_CODE or IMPORT_DATA.

Unfortunately, binutils's ILF-reading code currently only supports IMPORT_CODE
symbols. Any symbols with the IMPORT_DATA flag set are completely skipped over,
as if they didn't exist.

One place where this causes problems is when attempting to use binutils to link
programs against the python C API, because python27.dll makes extensive use of
DATA symbols. But really it would be nice to support these in general, because
it should be simple to do and it would be nice if we didn't have to jump
through hoops to use import libraries on Windows. In addition, mingw-w64 is
looking to transition to a new 'genlib' tool for generating import libraries,
and genlib also generates ILF-format libraries.

I've attached a patch that in theory ought to fix this. Basically, right now
all the code for emitting import symbol information from ILF files is hidden
behind switch { case IMPORT_CODE: ...}; my patch just takes the parts that are
common to IMPORT_CODE and IMPORT_DATA and moves them out of the switch
statement so that they are executed unconditionally. The function-specific
trampoline generation code remains inside the switch statement, and if we see
anything besides IMPORT_CODE or IMPORT_DATA then we abort(), so this should be
safe.

The patch compiles, and using it to manually link a simple test program against
python27.lib produces correct-looking output (i.e., a binary is successfully
produced, and running objdump on it shows that it has a correct-looking import
table that successfully references DATA symbols in python27.dll). Unfortunately
though I don't have a great way to test this directly (no handy Windows system,
and no convenient way to build a whole toolchain including my patched ld), and
someone else reported that when they did all that then the compile seemed to
work but the resulting binary segfaulted. (Possibly due to unrelated issues
though, who knows.)

So, I'm posting this here in hopes that either someone who knows what they're
doing will look at it and think "well, this is obviously correct", or else
think "well, this is obviously broken, you need to do _" :-)

Some discussion where we found this bug:
https://github.com/mingwpy/mingwpy.github.io/issues/31#issuecomment-175334085

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