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

r15 beta2 -g broken on MIPS and MIPS64 #399

Closed
yan12125 opened this issue May 18, 2017 · 13 comments
Closed

r15 beta2 -g broken on MIPS and MIPS64 #399

yan12125 opened this issue May 18, 2017 · 13 comments
Assignees

Comments

@yan12125
Copy link

Description

Since Android r15 beta2, -g is broken on MIPS and MIPS64. There are 4 scenarios:

  1. MIPS64 without -fno-integrated-as: failed
$ /opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target mips64el-none-linux-android -gcc-toolchain /opt/android-ndk-beta/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-ndk-beta/sysroot/usr -I/opt/android-ndk-beta/sysroot/usr/include/mips64el-linux-android -D__ANDROID_API__=21 -fPIC -g test.c -save-temps
test.s: Assembler messages:
test.s:6: Warning: unrecognized section type
test.s:6: Warning: entity size for SHF_MERGE not specified
test.s:6: Error: junk at end of line, first unrecognized character is `0'
test.s:13: Warning: unrecognized section type
test.s:13: Error: junk at end of line, first unrecognized character is `0'
test.s:14: Warning: unrecognized section type
test.s:14: Error: junk at end of line, first unrecognized character is `0'
test.s:31: Warning: unrecognized section type
test.s:31: Error: junk at end of line, first unrecognized character is `0'
test.s:43: Warning: unrecognized section type
test.s:43: Error: junk at end of line, first unrecognized character is `0'
test.s:44: Warning: unrecognized section type
test.s:44: Error: junk at end of line, first unrecognized character is `0'
test.s:51: Warning: unrecognized section type
test.s:51: Error: junk at end of line, first unrecognized character is `0'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
  1. MIPS64 with -fno-integrated-as: failed
$ /opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target mips64el-none-linux-android -gcc-toolchain /opt/android-ndk-beta/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-ndk-beta/sysroot/usr -I/opt/android-ndk-beta/sysroot/usr/include/mips64el-linux-android -D__ANDROID_API__=21 -fPIC -g test.c -save-temps -fno-integrated-as
test.s: Assembler messages:
test.s:6: Warning: unrecognized section type
test.s:6: Warning: entity size for SHF_MERGE not specified
test.s:6: Error: junk at end of line, first unrecognized character is `0'
test.s:13: Warning: unrecognized section type
test.s:13: Error: junk at end of line, first unrecognized character is `0'
test.s:14: Warning: unrecognized section type
test.s:14: Error: junk at end of line, first unrecognized character is `0'
test.s:31: Warning: unrecognized section type
test.s:31: Error: junk at end of line, first unrecognized character is `0'
test.s:43: Warning: unrecognized section type
test.s:43: Error: junk at end of line, first unrecognized character is `0'
test.s:44: Warning: unrecognized section type
test.s:44: Error: junk at end of line, first unrecognized character is `0'
test.s:51: Warning: unrecognized section type
test.s:51: Error: junk at end of line, first unrecognized character is `0'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
  1. MIPS without -fno-integrated-as: works
$ /opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target mipsel-none-linux-android -gcc-toolchain /opt/android-ndk-beta/toolchains/mipsel-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-ndk-beta/sysroot/usr -I/opt/android-ndk-beta/sysroot/usr/include/mipsel-linux-android -D__ANDROID_API__=21 -fPIC -g -c test.c -save-temps           
  1. MIPS64 with -fno-integrated-as: failed
$ /opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target mipsel-none-linux-android -gcc-toolchain /opt/android-ndk-beta/toolchains/mipsel-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-ndk-beta/sysroot/usr -I/opt/android-ndk-beta/sysroot/usr/include/mipsel-linux-android -D__ANDROID_API__=21 -fPIC -g -c test.c -save-temps -fno-integrated-as
test.s: Assembler messages:
test.s:8: Warning: unrecognized section type
test.s:8: Warning: entity size for SHF_MERGE not specified
test.s:8: Error: junk at end of line, first unrecognized character is `0'
test.s:15: Warning: unrecognized section type
test.s:15: Error: junk at end of line, first unrecognized character is `0'
test.s:16: Warning: unrecognized section type
test.s:16: Error: junk at end of line, first unrecognized character is `0'
test.s:33: Warning: unrecognized section type
test.s:33: Error: junk at end of line, first unrecognized character is `0'
test.s:45: Warning: unrecognized section type
test.s:45: Error: junk at end of line, first unrecognized character is `0'
test.s:46: Warning: unrecognized section type
test.s:46: Error: junk at end of line, first unrecognized character is `0'
test.s:53: Warning: unrecognized section type
test.s:53: Error: junk at end of line, first unrecognized character is `0'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)

I need -fno-integrated-as on MIPS due to #286, which is still an issue with the recent Clang update.

For now I disable debugging flags as a workaround.

Environment Details

Not all of these will be relevant to every bug, but please provide as much
information as you can.

  • NDK Version: 15.0.3996722-beta2
  • Build sytem: custom
  • Host OS: Arch Linux x86_64 latest
  • Compiler: Clang
  • ABI: MIPS, MIPS64
  • STL: N/A
  • NDK API level: 21
  • Device API level: N/A
@yan12125
Copy link
Author

PS: test.c in above tests is an empty file

yan12125 pushed a commit to yan12125/python3-android that referenced this issue May 18, 2017
@DanAlbert
Copy link
Member

Whoops. I fixed this in ndk-build and cmake but forgot to add a note to the changelog for those of you with custom build systems. Sorry about that. I'll get the changelog updated.

You need to explicitly pass -fintegrated-as for mips64, btw. -fno-integrated-as is the default for that target.

@DanAlbert DanAlbert self-assigned this May 18, 2017
@yan12125
Copy link
Author

Thanks! How about document ndk-build and cmake default flags? For example armeabi* uses -fno-integrated-as and mips64 uses -fintegrated-as.

@DanAlbert
Copy link
Member

For example armeabi* uses -fno-integrated-as and mips64 uses -fintegrated-as.

That's a clang default, not a ndk-build or cmake default. Those are under the control of upstream clang, so I don't know when they change (they should only rarely).

The ndk-build defaults can be found in the various setup.mk files in the build source: https://android.googlesource.com/platform/ndk/+/master/build/core/toolchains/arm-linux-androideabi-clang/setup.mk. CMake flags can be found in the toolchain file.

@yan12125
Copy link
Author

Sorry if I was unclear. What I was referring to is the following code segment in android.toolchain.cmake:

if(ANDROID_ABI STREQUAL "mips64" AND ANDROID_TOOLCHAIN STREQUAL clang)
  list(APPEND ANDROID_COMPILER_FLAGS "-fintegrated-as")
endif()
if(ANDROID_ABI MATCHES "^armeabi" AND ANDROID_TOOLCHAIN STREQUAL clang)
	# Disable integrated-as for better compatibility.
	list(APPEND ANDROID_COMPILER_FLAGS
		-fno-integrated-as)
endif()

Those flags are added by NDK build systems. Documenting them can help custom build system implementers.

@DanAlbert
Copy link
Member

Ah, yeah. I have a bug open to document things that build system maintainers should know: #125

@yan12125
Copy link
Author

Great! I guess this issue can be closed in favor of #125?

@DanAlbert
Copy link
Member

Now that I've gotten the changelog updates pushed to the wiki, yes.

@yan12125
Copy link
Author

Thanks!

brunoabinader added a commit to mapbox/mason that referenced this issue Mar 12, 2018
brunoabinader added a commit to mapbox/mason that referenced this issue Mar 12, 2018
brunoabinader added a commit to mapbox/mason that referenced this issue Mar 13, 2018
brunoabinader added a commit to mapbox/mason that referenced this issue Mar 13, 2018
brunoabinader added a commit to mapbox/mason that referenced this issue Mar 13, 2018
brunoabinader added a commit to mapbox/mason that referenced this issue Mar 13, 2018
brunoabinader added a commit to mapbox/mason that referenced this issue Mar 13, 2018
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
Test: None, markdown only
Bug: android/ndk#399
Change-Id: I261c80542adfc96652967e73f7aea88f478bfb8f
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
This has been outdated for quite some time. Upgrade to the current
platform and NDK toolchain that is in use.

Test: android/ndk#399
Change-Id: I64b4fe2032546e584191261b6f46b2deafb3ea27
@xiangzhai
Copy link

@DanAlbert

You need to explicitly pass -fintegrated-as for mips64, btw. -fno-integrated-as is the default for that target.

Thanks for your teaching! -fintegrated-as fix the binutils/gas compatibility issue, but lead another bug when compiling OpenJDK8 with LLVM toolchain, could you give me some hint? thanks a lot!

Regards,
Leslie Zhai

@DanAlbert
Copy link
Member

Probably just don't bother building for MIPS64. We don't support it anymore.

@yan12125
Copy link
Author

yan12125 commented Aug 2, 2018

Looks like @xiangzhai is building stuffs for a MIPS chip from China instead of Android, and he is not using NDK but their customized LLVM toolchain.

@xiangzhai
Copy link

@DanAlbert Thanks for your response!

@yan12125 It is not Android or NDK issue.

And it is not a customzied toolchain just the original one.
But I prefer to merge by upstream sorry that unimplemented Loong-ISA or Machine Scheduler yet.

Regards,
Leslie Zhai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants