llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

llvm-strip on mips fails with error: symbol 'stdout' has unsupported value greater than or equal to SHN_LORESERVE: 65283

Open kraj opened this issue 4 years ago • 7 comments

Attached testcase fails llvm-strip where as GNU strip works ok.

mips-yoe-linux-llvm-strip purgatory/purgatory.ro.sym
../recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-llvm-strip: error: symbol 'stdout' has unsupported value greater than or equal to SHN_LORESERVE: 65283

purgatory.ro.sym.tar.gz

kraj avatar Feb 22 '22 20:02 kraj

@llvm/issue-subscribers-backend-mips

llvmbot avatar Feb 22 '22 20:02 llvmbot

@llvm/issue-subscribers-tools-llvm-objcopy-strip

llvmbot avatar Feb 22 '22 20:02 llvmbot

SHN_MIPS_SCOMMON is 0xff03. https://refspecs.linuxfoundation.org/elf/mipsabi.pdf (I do not know which ABI is more appropriate) says:

SHN_MIPS_SCOMMON - Symbols defined relative to this section are common symbols which can be placed in the global
data area (are gp-addressable). See "Global Data Area" in this chapter.

Clang never emits SHN_MIPS_SCOMMON. For GCC, does -fno-common help? https://gcc.gnu.org/gcc-10/changes.html defaults to -fno-common.

MaskRay avatar Feb 22 '22 21:02 MaskRay

SHN_MIPS_SCOMMON is 0xff03. https://refspecs.linuxfoundation.org/elf/mipsabi.pdf (I do not know which ABI is more appropriate) says:

SHN_MIPS_SCOMMON - Symbols defined relative to this section are common symbols which can be placed in the global
data area (are gp-addressable). See "Global Data Area" in this chapter.

Clang never emits SHN_MIPS_SCOMMON. For GCC, does -fno-common help? https://gcc.gnu.org/gcc-10/changes.html defaults to -fno-common.

its using clang with -fcommon to generate this binary.

kraj avatar Feb 22 '22 22:02 kraj

I imagine this is simply a case of handling the specual value like SHN_COMMON and SHN_ABS symbols, if the machine type is MIPS. Is that the case? If so, someone could add the good-first-bug tag as I think it'll be easy enough for a new developer to pick this one up, based on this.

jh7370 avatar Feb 23 '22 08:02 jh7370

@llvm/issue-subscribers-good-first-issue

llvmbot avatar Feb 23 '22 09:02 llvmbot

I submitted a patch here: https://reviews.llvm.org/D123902

argentite avatar Apr 16 '22 19:04 argentite