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

__attribute__((section())) string should not be escaped #42295

Closed
nickdesaulniers opened this issue Aug 9, 2019 · 4 comments
Closed

__attribute__((section())) string should not be escaped #42295

nickdesaulniers opened this issue Aug 9, 2019 · 4 comments
Labels
bugzilla Issues migrated from bugzilla c wontfix Issue is real, but we can't or won't fix it. Not invalid

Comments

@nickdesaulniers
Copy link
Member

Bugzilla Link 42950
Resolution WONTFIX
Resolved on Sep 29, 2020 11:55
Version trunk
OS Linux
Blocks #4440
CC @dwblaikie,@DougGregor,@kees,@zygoloid,@rnk,@stephenhines

Extended Description

int foo attribute((section("".foo"")));

In Clang produces:
.section "".foo"","aw",@progbits

In GCC:
.section ".foo","aw"

This is leading to a bug in Clang built Linux kernels for distros that use BPF (not eBPF) during boot, causing them to fail to boot.

ClangBuiltLinux/linux#619

@nickdesaulniers
Copy link
Member Author

We can work around this for now; the escaping is coming from use of the C preprocessor:

#define __section(S) attribute((section(#S)))
int foo __section(".foo")

can instead be:
int foo __section(.foo)

but this is still a bug (or at least a dependency from gcc/binutils).

@rnk
Copy link
Collaborator

rnk commented Aug 9, 2019

Coincidentally, I mentioned this exact GCC misfeature to Bob yesterday. This has come up in the past, and our stance then was that this was always an escaping bug that GCC should fix. Previously people used to use this in creative ways to change the protections of the section, but I don't think it is possible anymore, at least not without using the comment character.

@kees
Copy link
Contributor

kees commented Aug 10, 2019

Coincidentally, I mentioned this exact GCC misfeature to Bob yesterday. This
has come up in the past, and our stance then was that this was always an
escaping bug that GCC should fix. Previously people used to use this in
creative ways to change the protections of the section, but I don't think it
is possible anymore, at least not without using the comment character.

As a person that has tried to use that hack, it is highly unstable and not cross-architecture portable, and should not be used. :P

@nickdesaulniers
Copy link
Member Author

Marking WONTFIX based on Reid's comment.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@Quuxplusone Quuxplusone added the wontfix Issue is real, but we can't or won't fix it. Not invalid label Jan 20, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c wontfix Issue is real, but we can't or won't fix it. Not invalid
Projects
None yet
Development

No branches or pull requests

4 participants