Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many profile tests FAIL due to SHF_GNU_RETAIN #48781

Closed
rorth opened this issue Mar 4, 2021 · 3 comments
Closed

Many profile tests FAIL due to SHF_GNU_RETAIN #48781

rorth opened this issue Mar 4, 2021 · 3 comments
Labels
bugzilla Issues migrated from bugzilla mc Machine (object) code regression

Comments

@rorth
Copy link
Collaborator

rorth commented Mar 4, 2021

Bugzilla Link 49437
Resolution FIXED
Resolved on Oct 11, 2021 20:29
Version trunk
OS Solaris
Blocks #51489
CC @MaskRay,@tstellar
Fixed by commit(s) 7bbbf29 aac4fe3

Extended Description

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.

@rorth
Copy link
Collaborator Author

rorth commented Aug 11, 2021

Fixed for main by https://reviews.llvm.org/D107747. Required on release/13.x
branch, too.

@tstellar
Copy link
Collaborator

Merged: aac4fe3

@tstellar
Copy link
Collaborator

mentioned in issue #51489

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla mc Machine (object) code regression
Projects
None yet
Development

No branches or pull requests

2 participants