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

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

Closed
kraj opened this issue Feb 22, 2022 · 7 comments
Labels
backend:MIPS good first issue https://github.com/llvm/llvm-project/contribute tools:llvm-objcopy/strip

Comments

@kraj
Copy link
Contributor

kraj commented Feb 22, 2022

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

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 22, 2022

@llvm/issue-subscribers-backend-mips

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 22, 2022

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

@MaskRay
Copy link
Member

MaskRay commented Feb 22, 2022

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.

@kraj
Copy link
Contributor Author

kraj commented Feb 22, 2022

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.

@jh7370
Copy link
Collaborator

jh7370 commented Feb 23, 2022

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.

@atanasyan atanasyan added the good first issue https://github.com/llvm/llvm-project/contribute label Feb 23, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 23, 2022

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

@argentite
Copy link
Contributor

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

mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
This fixes llvm/llvm-project#53998
and displays correct information in obj2yaml for SHN_MIPS_*
sections according to
https://refspecs.linuxfoundation.org/elf/mipsabi.pdf

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D123902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:MIPS good first issue https://github.com/llvm/llvm-project/contribute tools:llvm-objcopy/strip
Projects
None yet
Development

No branches or pull requests

7 participants