[PATCH] D94670: [DebugInfo][NFC] add a new DIE type to represent label + offset

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 11:03:56 PST 2021


MaskRay added a comment.

I want to have a feeling how the aix assembly works, so I tried binutils-gdb:

  % mkdir -p out/aix; cd out/aix
  % ../../configure --target=powerpc64-ibm-aix
  % make -j 30 all-gas
  # gas/as-new
  
  % gas/as-new =(echo '.section .debug_info')
  /tmp/zshHplgOV: Assembler messages:
  /tmp/zshHplgOV:1: Error: the XCOFF file format does not support arbitrary sections

Seems that the error is expected, as `gas/config/tc-ppc.c` says:

  /* This function handles the .section pseudo-op.  This is mostly to
     give an error, since XCOFF only supports .text, .data and .bss, but
     we do permit the user to name the text or data section.  */
  
  static void
  ppc_named_section (int ignore ATTRIBUTE_UNUSED)
  {
    char *user_name;
    const char *real_name;
    char c;
    symbolS *sym;
  
    c = get_symbol_name (&user_name);
  
    if (strcmp (user_name, ".text") == 0)
      real_name = ".text[PR]";
    else if (strcmp (user_name, ".data") == 0)
      real_name = ".data[RW]";
    else
      {
        as_bad (_("the XCOFF file format does not support arbitrary sections"));
        (void) restore_line_pointer (c);
        ignore_rest_of_line ();
        return;
      }

So how does your example work?

         .section        .debug_info
  .Ldebug_info:
          ###### .long   (length of .debug_info) # Length of Unit, this is not required any more
          .short version_number
          .....
          .long   .Ldebug_line-4            # DW_AT_stmt_list  ### refer to .debug_line table, but we need to refer to the previous 4 bytes as assembler will insert 4 bytes for the length field at the front of .debug_line.
  
          .section        .debug_line
  .Ldebug_line:
          ######.long  (length of .debug_line)      #this is not required any more
          .short version_number



> On aix, the default c/c++ compiler is XLC. With that compiler, there is no assembly mode. XLC only has object mode, so it does not involve assembler to generate a object file.

To be clear, you said XLC does not support assembly mode, but you'll implement something in `llvm/lib/MC`, then can this limitation be removed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94670/new/

https://reviews.llvm.org/D94670



More information about the llvm-commits mailing list