镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

NativeAOT symbols are broken on linux when publishing Release #77407

Closed

Description

@agocke

I would expect symbols to be worse, but not broken in this configuration.

It looks like change is caused by passing -O to clang when linking the binaries. Without -O, debugging symbols are present and functional. With -O, all symbols and stacks are broken.

It's something in the DWARF info emitted by ILC.

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Oct 24, 2022
  2. added this to the 7.0.x milestone on Oct 24, 2022
  3. removed
    untriagedNew issue has not been triaged by the area owner
    on Oct 24, 2022
  4. MichalStrehovsky commented on Oct 27, 2022

    @MichalStrehovsky
    Member

    With -O, all symbols and stacks are broken.

    Do you have repro steps? I just debugged a coredump in #77522 (comment) and stacks looked fine.

    I can't find where we would be passing -O to clang in our build targets.

  5. agocke commented on Oct 27, 2022

    @agocke
    MemberAuthor

    Repro is in an Ubuntu 22.04 WSL instance with RC2, publishing helloworld using dotnet publish -r linux-x64 -c Release -bl.

    Afterwards I open up the exe in GDB and I get the following:

    GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
    Reading symbols from ./bin/Release/net7.0/linux-x64/publish/aot1...
    Dwarf Error: Could not find abbrev number 94 in CU at offset 0x0 [in module /home/andy/tmp/aot1/bin/Release/net7.0/linux-x64/publish/aot1]
    (No debugging symbols found in ./bin/Release/net7.0/linux-x64/publish/aot1)
    

    Function names are still around, but line number and file info is lost, as well as the symbol table.

    You're right about -O though, I can't see that in the command line. I must have accidentally added that manually when altering the linking command to build against local bits. My clang invocation is

    "clang" "obj/Release/net7.0/linux-x64/native/aot1.o" -o "bin/Release/net7.0/linux-x64/native/aot1" /home/andy/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/7.0.0-rc.2.22472.3/sdk/libbootstrapper.a /home/andy/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/7.0.0-rc.2.22472.3/sdk/libRuntime.WorkstationGC.a /home/andy/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/7.0.0-rc.2.22472.3/framework/libSystem.Native.a /home/andy/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/7.0.0-rc.2.22472.3/framework/libSystem.Globalization.Native.a /home/andy/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/7.0.0-rc.2.22472.3/framework/libSystem.IO.Compression.Native.a /home/andy/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/7.0.0-rc.2.22472.3/framework/libSystem.Net.Security.Native.a /home/andy/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/7.0.0-rc.2.22472.3/framework/libSystem.Security.Cryptography.Native.OpenSsl.a -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -pthread -lstdc++ -ldl -lm -lz -lrt -pie -Wl,-z,relro -Wl,-z,now -Wl,--discard-all -Wl,--gc-sections
    
  6. agocke commented on Oct 27, 2022

    @agocke
    MemberAuthor

    AH, my mistake, it's not the linking command that makes a difference, it's passing -O to ILC. Without it, debugging info is fine.

  7. agocke commented on Nov 17, 2022

    @agocke
    MemberAuthor

    Re-opening to track servicing fix.

  8. reopened this on Nov 17, 2022
  9. MichalStrehovsky commented on Dec 23, 2022

    @MichalStrehovsky
    Member

    The fix is in the LLVM objwriter release branch and we picked up the change in release/7.0 of this repo. I think this can be closed.

  10. TheSpydog commented on Jan 4, 2023

    @TheSpydog
    Contributor

    Did this fix make it into .NET 7.0.1? I'm still running into this problem in a non-trivial project with the 7.0.1 tooling.

    (Interestingly, upgrading from 7.0.0 to 7.0.1 did fix this issue for a simple Hello World app, but I'm not sure if it's a direct result of this change or if it was a complete fluke.)

  11. MichalStrehovsky commented on Jan 5, 2023

    @MichalStrehovsky
    Member

    I think it will only be in 7.0.2.

    7.0.1 happened in mid-november: https://github.com/dotnet/runtime/milestone/107?closed=1 and this change only landed after: dotnet/llvm-project#321

  12. ghost locked as resolved and limited conversation to collaborators on Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions