-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
generated code of inline assembly modifier 'P' with -fPIE is different between gcc and clang #60096
Comments
Hi Nick, I had looked up the documentation before. Regarding the 'P' modifier, it states that it "Prints the raw symbol name if used for a constant". If I understand correctly, it should generate an absolute reference. I have tested it by compiling with both I think the documentation is not clear enough for the user. Additionally, I was unable to find an explanation for the I think that the documentation may be insufficient for users to fully understand the behavior of these modifiers. :( |
GCC version: 9.3.0
Clang version: 15.0.7
The output assembly code of following code is different between gcc and clang with
-c -O2 -fPIE
:The expected assembly code should be like this:
Clang could generate right code but gcc generates absolute reference:
It seems that modifier

'P'
is not compatible withPIE
in gcc, so I try to use modifier'a'
and it can generate right code. But modifier
'a'
leads to compilation error in clang.My question is why the generated code of modifier 'P' is different between gcc and clang?
Which one is right?
Thanks.
The text was updated successfully, but these errors were encountered: