<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Many profile tests FAIL due to SHF_GNU_RETAIN"
   href="https://bugs.llvm.org/show_bug.cgi?id=49437">49437</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Many profile tests FAIL due to SHF_GNU_RETAIN
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Solaris
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Keywords</th>
          <td>regression
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ro@gcc.gnu.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>i@maskray.me, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Recently dozens of Profile tests began to FAIL on Solaris (both sparc and x86,
32 and 64-bit):

  Profile-i386 :: Posix/instrprof-value-prof-shared.test
  Profile-i386 :: Posix/instrprof-visibility.cpp
  Profile-i386 :: coverage-inline.cpp
  Profile-i386 :: coverage_comments.cpp
  Profile-i386 :: coverage_emptylines.cpp
  Profile-i386 :: infinite_loop.c
  Profile-i386 :: instrprof-basic.c
  Profile-i386 :: instrprof-dump.c
  Profile-i386 :: instrprof-hostname.c
  Profile-i386 :: instrprof-icall-promo.test
  Profile-i386 :: instrprof-merge.c
  Profile-i386 :: instrprof-merging.cpp
  Profile-i386 :: instrprof-override-filename-then-reset-default.c
  Profile-i386 :: instrprof-override-filename-with-env.c
  Profile-i386 :: instrprof-override-filename.c
  Profile-i386 :: instrprof-reset-counters.c
  Profile-i386 :: instrprof-set-file-object-merging.c
  Profile-i386 :: instrprof-set-file-object.c
  Profile-i386 :: instrprof-set-filename-then-reset-default.c
  Profile-i386 :: instrprof-set-filename.c
  Profile-i386 :: instrprof-value-prof-2.c
  Profile-i386 :: instrprof-value-prof-evict.test
  Profile-i386 :: instrprof-value-prof-reset.c
  Profile-i386 :: instrprof-value-prof.c
  Profile-i386 :: instrprof-value-prof.test
  Profile-i386 :: instrprof-without-libc.c
  Profile-i386 :: instrprof-write-file-atexit-explicitly.c
  Profile-i386 :: instrprof-write-file-only.c
  Profile-i386 :: instrprof-write-file.c
  Profile-i386 :: runtime_infinite.c

The failure mode is always the same:

$ /var/llvm/dist-amd64-release-stage2-A/tools/clang/stage2-bins/./bin/clang 
--driver-mode=g++  -m32   -fprofile-instr-generate -fcoverage-mapping -o
/var/llvm/dist-amd64-release-stage2-A/tools/clang/stage2-bins/projects/compiler-rt/test/profile/Profile-i386/Output/coverage_emptylines.cpp.tmp
/var/llvm/dist-amd64-release-stage2-A/tools/clang/stage2-bins/projects/compiler-rt/test/profile/Profile-i386/Output/coverage_emptylines.cpp.tmp.stripped.cpp
-save-temps
ld: fatal: symbol '__covrec_DB956436E78DD5FAu' in file
coverage_emptylines.cpp.tmp.stripped.o associated with invalid section[8]
clang-13: error: linker command failed with exit code 1 (use -v to see
invocation)

That section is

Section Header[8]:  sh_name: __llvm_covfun
    sh_addr:      0               sh_flags:   [ SHF_GROUP SHF_SUNW_ABSENT ]
    sh_size:      0xb0            sh_type:    [ SHT_PROGBITS ]
    sh_offset:    0x108           sh_entsize: 0
    sh_link:      0               sh_info:    0
    sh_addralign: 0x8       

where <sys/elf.h> has

#define SHF_SUNW_ABSENT         0x00200000      /* section data not present */

However, looking at the assembler output, this has nothing to do with
SHF_SUNW_ABSENT, but the flag is rather SHF_GNU_RETAIN which has the same
value.  However, the object files isn't marked as ELFOSABI_GNU as it should
when using a GNU extension, but has

$ elfdump -e coverage_emptylines.cpp.tmp.stripped.o

ELF Header
  ei_magic:   { 0x7f, E, L, F }
  ei_class:   ELFCLASS32          ei_data:       ELFDATA2LSB
  ei_osabi:   ELFOSABI_NONE       ei_abiversion: 0
  e_machine:  EM_386              e_version:     EV_CURRENT
  e_type:     ET_REL
  e_flags:                     0
  e_entry:                     0  e_ehsize:     52  e_shstrndx:  1
  e_shoff:                 0x560  e_shentsize:  40  e_shnum:     21
  e_phoff:                     0  e_phentsize:   0  e_phnum:     0

Solaris ld is very unlikely to ever support SHF_GNU_RETAIN and the integrated
assembler shouldn't emit it.  Unfortunately, even with -fbinutils-version=none
this remains unchanged.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>