bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: dave.anglin at bell dot net
Subject: [Bug ld/19526] Using "gcc -o /dev/null" gives "ld: final link failed: File truncated" error
Date: Sat, 30 Jan 2016 02:06:13 +0000

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

--- Comment #3 from dave.anglin at bell dot net ---
It's not necessary to use a pipe to duplicate.  I created a file xxx.c with
'int main(){}' and
compiled with -save-temps and -Wl,-debug to get the actual link command.  Here
is backtrace
for bfd_error_file_truncated:

Breakpoint 4, bfd_set_error (error_tag=724328) at ../../src/bfd/bfd.c:511
511           va_start (ap, error_tag);
(gdb) step
503     {
(gdb) 
504       bfd_error = error_tag;
(gdb) 
505       if (error_tag == bfd_error_on_input)
(gdb) p bfd_error
$3 = bfd_error_file_truncated
(gdb) bt
#0  bfd_set_error (error_tag=bfd_error_file_truncated)
    at ../../src/bfd/bfd.c:505
#1  0xfd1ade30 in cache_bread_1 (abfd=0xaecb0, buf=0x257978, nbytes=256)
    at ../../src/bfd/cache.c:347
#2  0xfd1adf60 in cache_bread (abfd=0xaecb0, buf=0x257978, nbytes=256)
    at ../../src/bfd/cache.c:368
#3  0xfd1ac17c in bfd_bread (ptr=0x257978, size=256, abfd=0xaecb0)
    at ../../src/bfd/bfdio.c:196
#4  0xfd1b6000 in _bfd_generic_get_section_contents (abfd=0xaecb0, 
    section=0xb0850, location=0x257978, offset=0, count=256)
    at ../../src/bfd/libbfd.c:812
#5  0xfd1ca458 in bfd_get_section_contents (abfd=0xaecb0, section=0xb0850, 
    location=0x257978, offset=0, count=256) at ../../src/bfd/section.c:1619
#6  0xfd1af8c4 in bfd_get_full_section_contents (abfd=0xaecb0, sec=0xb0850, 
    ptr=0xfd7034d0) at ../../src/bfd/compress.c:253
#7  0xfd1ca4d8 in bfd_malloc_and_get_section (abfd=0xaecb0, sec=0xb0850, 
    buf=0xfd7034d0) at ../../src/bfd/section.c:1640
#8  0xfd1ddb4c in elf_hppa_sort_unwind (abfd=0xaecb0)
    at ../../src/bfd/elf-hppa.h:1196
#9  0xfd1e6030 in elf32_hppa_final_link (abfd=0xaecb0, 
    info=0x9f5b0 <link_info>) at ../../src/bfd/elf32-hppa.c:3257
#10 0x00049010 in ldwrite () at ../../src/ld/ldwrite.c:581
#11 0x00043bd8 in main (argc=38, argv=0xfd70302c) at ../../src/ld/ldmain.c:430
(gdb) frame 8
#8  0xfd1ddb4c in elf_hppa_sort_unwind (abfd=0xaecb0)
    at ../../src/bfd/elf-hppa.h:1196
1196          if (!bfd_malloc_and_get_section (abfd, s, &contents))
(gdb) p *abfd
$4 = {filename = 0xb0d58 "/dev/null", 
  xvec = 0xfd2d07b8 <hppa_elf32_linux_vec>, iostream = 0xb0d68, 
  iovec = 0xfd2c90a0 <cache_iovec>, lru_prev = 0xc5738, lru_next = 0x118568, 
  where = 2228, mtime = 0, id = 0, format = bfd_object, 
  direction = write_direction, flags = 386, cacheable = 1, 
  target_defaulted = 0, opened_once = 1, mtime_set = 0, no_export = 0, 
  output_has_begun = 1, has_armap = 0, is_thin_archive = 0, 
  selective_search = 0, is_linker_output = 1, is_linker_input = 0, 
  plugin_format = bfd_plugin_uknown, lto_output = 0, plugin_dummy_bfd = 0x0, 
  origin = 0, proxy_origin = 0, section_htab = {table = 0x232490, 
    newfunc = @0xfd42031e: 0xfd1c8b08 <bfd_section_hash_newfunc>, 
    memory = 0xafd60, size = 61, count = 31, entsize = 184, frozen = 0}, 
  sections = 0xafdc0, section_last = 0x232878, section_count = 27, 
  archive_pass = 0, start_address = 66496, outsymbols = 0x0, symcount = 93, 
  dynsymcount = 0, arch_info = 0xfd2d1140 <bfd_hppa_arch>, arelt_data = 0x0, 
  my_archive = 0x0, archive_next = 0x0, archive_head = 0x0, 
  nested_archives = 0x0, link = {next = 0xb0ed0, hash = 0xb0ed0}, tdata = {
    aout_data = 0xaed80, aout_ar_data = 0xaed80, oasys_obj_data = 0xaed80, 
    oasys_ar_data = 0xaed80, coff_obj_data = 0xaed80, pe_obj_data = 0xaed80, 
    xcoff_obj_data = 0xaed80, ecoff_obj_data = 0xaed80, ieee_data = 0xaed80, 
    ieee_ar_data = 0xaed80, srec_data = 0xaed80, verilog_data = 0xaed80, 
    ihex_data = 0xaed80, tekhex_data = 0xaed80, elf_obj_data = 0xaed80, 
    nlm_obj_data = 0xaed80, bout_data = 0xaed80, mmo_data = 0xaed80, 
    sun_core_data = 0xaed80, sco5_core_data = 0xaed80, 
    trad_core_data = 0xaed80, som_data = 0xaed80, hpux_core_data = 0xaed80, 
    hppabsd_core_data = 0xaed80, sgi_core_data = 0xaed80, 
    lynx_core_data = 0xaed80, osf_core_data = 0xaed80, 
    cisco_core_data = 0xaed80, versados_data = 0xaed80, 
    netbsd_core_data = 0xaed80, mach_o_data = 0xaed80, 
    mach_o_fat_data = 0xaed80, plugin_data = 0xaed80, pef_data = 0xaed80, 
    pef_xlib_data = 0xaed80, sym_data = 0xaed80, any = 0xaed80}, 
  usrdata = 0x0, memory = 0xaed68, build_id = 0x0}

Maybe skipping sort when filename is "/dev/null" will fix.

Is there a better test?

Dave
--
John David Anglin       address@hidden

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]