Skip to content

llvm-strip+llvm-objcopy missing wildcard/glob support #478

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

Closed
nickdesaulniers opened this issue May 14, 2019 · 5 comments
Closed

llvm-strip+llvm-objcopy missing wildcard/glob support #478

nickdesaulniers opened this issue May 14, 2019 · 5 comments
Assignees
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0 [TOOL] llvm-objcopy The issue is relevant to LLVM objcopy [TOOL] llvm-strip The issue is relevant to LLVM strip

Comments

@nickdesaulniers
Copy link
Member

nickdesaulniers commented May 14, 2019

Copy pasta from @nathanchance :
https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/199950114
https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/199950118
https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/199950120

Stuff along the lines of:

0000000000000000 R_AARCH64_ABS64 sort
0000000000000008 R_AARCH64_ABS64 __ksymtab_strings
drivers/firmware/efi/libstub/lib-sort.stub.o: absolute symbol references not allowed in the EFI stub

It looks like this is probably caused by llvm-strip not supporting the globs in STUBCOPY_RM-y, which @rupprecht noted here. These were removed upstream in torvalds@02562d0 because of torvalds@f922c4a. torvalds@f922c4a decently backports to 4.9 and 4.14, not so clean for 4.4. Might be wise to conditionally turn on llvm-strip.
cc @rupprecht

@nickdesaulniers nickdesaulniers added [BUG] linux A bug that should be fixed in the mainline kernel. [PATCH] Exists There is a patch that fixes this issue [ARCH] arm64 This bug impacts ARCH=arm64 [TOOL] llvm-strip The issue is relevant to LLVM strip Needs Backport Should be backported to either linux-stable tree or latest llvm release branch. labels May 14, 2019
@rupprecht
Copy link

rupprecht commented May 14, 2019

It sound like there's no opposition to just supporting glob characters: https://llvm.org/pr41268. But no one has gotten around to it yet.

@nickdesaulniers nickdesaulniers added the low priority This bug is not critical and not a priority label May 14, 2019
@nathanchance
Copy link
Member

Just as an FYI, even without llvm-strip, llvm-objcopy fails on 4.4 with:

...
000000000000013c R_AARCH64_ABS64 .init.text
0000000000000014 R_AARCH64_ABS32 .debug_frame
0000000000000018 R_AARCH64_ABS64 .init.text
000000000000003c R_AARCH64_ABS32 .debug_frame
0000000000000040 R_AARCH64_ABS64 .init.text+168
000000000000005c R_AARCH64_ABS32 .debug_frame
0000000000000060 R_AARCH64_ABS64 .init.text+192
000000000000007c R_AARCH64_ABS32 .debug_frame
0000000000000080 R_AARCH64_ABS64 .init.text+216
00000000000000ac R_AARCH64_ABS32 .debug_frame
00000000000000b0 R_AARCH64_ABS64 .init.text+628
00000000000000cc R_AARCH64_ABS32 .debug_frame
00000000000000d0 R_AARCH64_ABS64 .init.text+656
00000000000000fc R_AARCH64_ABS32 .debug_frame
0000000000000100 R_AARCH64_ABS64 .init.text+1440
000000000000012c R_AARCH64_ABS32 .debug_frame
0000000000000130 R_AARCH64_ABS64 .init.text+1740
drivers/firmware/efi/libstub/arm-stub.stub.o: absolute symbol references not allowed in the EFI stub

Same root cause it seems (drivers/firmware/efi/libstub/Makefile):

STUBCOPY_FLAGS-y		:= -R .debug* -R *ksymtab* -R *kcrctab*
...
quiet_cmd_stubcopy = STUBCPY $@
      cmd_stubcopy = if $(OBJCOPY) $(STUBCOPY_FLAGS-y) $< $@; then	\
		     $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y)	\
		     && (echo >&2 "$@: absolute symbol references not allowed in the EFI stub"; \
			 rm -f $@; /bin/false); else /bin/false; fi

I don't think backporting the fixes for that is feasible, glob support would need to be added for this to work I think.

@nickdesaulniers
Copy link
Member Author

patch: https://reviews.llvm.org/D66613

@nickdesaulniers nickdesaulniers added [PATCH] Submitted A patch has been submitted for review and removed [PATCH] Exists There is a patch that fixes this issue labels Aug 22, 2019
@nickdesaulniers nickdesaulniers changed the title [llvm-strip] broken for arm64 4.14 and older llvm-strip+llvm-objcopy missing wildcard/glob support Oct 17, 2019
@nickdesaulniers nickdesaulniers added [TOOL] llvm-objcopy The issue is relevant to LLVM objcopy [BUG] llvm A bug that should be fixed in upstream LLVM and removed Needs Backport Should be backported to either linux-stable tree or latest llvm release branch. [BUG] linux A bug that should be fixed in the mainline kernel. low priority This bug is not critical and not a priority labels Oct 17, 2019
@rupprecht
Copy link

Finally landed just now in r375169. Closing this finally, and please let me know if it works in the kernel build!

@nathanchance
Copy link
Member

% make -j$(nproc) -s ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu- O=out OBJCOPY=llvm-objcopy STRIP=llvm-strip distclean defconfig all

succeeds for me on 4.4.196 with a build of LLVM at llvm/llvm-project@9a335b6.

@nickdesaulniers nickdesaulniers added [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0 and removed [PATCH] Submitted A patch has been submitted for review labels Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0 [TOOL] llvm-objcopy The issue is relevant to LLVM objcopy [TOOL] llvm-strip The issue is relevant to LLVM strip
Projects
None yet
Development

No branches or pull requests

3 participants