Skip to content

fix(bthread/context): Add .previous after GNU-stack note for aarch64#3266

Open
condy0919 wants to merge 1 commit intoapache:masterfrom
condy0919:fix-asan-build
Open

fix(bthread/context): Add .previous after GNU-stack note for aarch64#3266
condy0919 wants to merge 1 commit intoapache:masterfrom
condy0919:fix-asan-build

Conversation

@condy0919
Copy link
Copy Markdown

Add missing .previous directive after each .note.GNU-stack section in ARM inline assembly blocks. This ensures proper section switching and prevents potential assembler errors when building with asan.

What problem does this PR solve?

Issue Number: resolve #1186

Problem Summary:

When build brpc with asan enabled, gcc complains something similar with the following line

`.note.GNU-stack' referenced in section `.init_array.00099' of ../../output/lib/libbrpc.a(context.cpp.o): defined in discarded section

Add missing .previous directive after each .note.GNU-stack section in ARM inline
assembly blocks. This ensures proper section switching and prevents potential
assembler errors when building with asan.

See apache#1186
@condy0919 condy0919 changed the title fix(bthread/context): Add .previous after GNU-stack note fix(bthread/context): Add .previous after GNU-stack note for aarch64 Apr 9, 2026
@wwbmmm wwbmmm requested a review from Copilot April 10, 2026 01:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes ARM inline-assembly section switching in bthread/context.cpp by adding a missing .previous directive after emitting the .note.GNU-stack section, preventing the assembler from remaining in the discarded .note.GNU-stack section (which can surface as link/ASAN build errors).

Changes:

  • Add .previous after .section .note.GNU-stack,"",%progbits in the Linux ARM32 bthread_jump_fcontext and bthread_make_fcontext asm blocks.
  • Add .previous after .section .note.GNU-stack,"",%progbits in the Linux ARM64 bthread_jump_fcontext and bthread_make_fcontext asm blocks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Successfully merging this pull request may close these issues.

编译ASAN版本报错

2 participants