[llvm-bugs] [Bug 49437] New: Many profile tests FAIL due to SHF_GNU_RETAIN

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 4 04:44:51 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49437

            Bug ID: 49437
           Summary: Many profile tests FAIL due to SHF_GNU_RETAIN
           Product: libraries
           Version: trunk
          Hardware: All
                OS: Solaris
            Status: NEW
          Keywords: regression
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: ro at gcc.gnu.org
                CC: i at maskray.me, llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210304/0671c88c/attachment.html>


More information about the llvm-bugs mailing list