[llvm] r235988 - Use CIE version 4 for dwarf4.

Keith Walker kwalker at arm.com
Tue May 5 08:13:40 PDT 2015


Rafael,

One important feature that is missing in this change is the fact that the
reason there was a version number change in the CIE header in dwarf-4 was
because there were 2 new fields added to the CIE header:  address_size and
segment_size.

So although the version number in the CIE is now 4 for dwarf-4, the 2 new
fields expected in a dwarf-4 CIE header are currently missing.

Keith

> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> bounces at cs.uiuc.edu] On Behalf Of Rafael Espindola
> Sent: 28 April 2015 14:56
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm] r235988 - Use CIE version 4 for dwarf4.
> 
> Author: rafael
> Date: Tue Apr 28 08:55:31 2015
> New Revision: 235988
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=235988&view=rev
> Log:
> Use CIE version 4 for dwarf4.
> 
> According to http://www.dwarfstd.org/doc/DWARF4.pdf appendix F the CIE
> version for dwarf 4 is 4.
> 
> Modified:
>     llvm/trunk/lib/MC/MCDwarf.cpp
>     llvm/trunk/test/MC/ELF/cfi-sections.s
>     llvm/trunk/test/MC/ELF/cfi-version.ll
> 
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=235988&r1=235987&r2=235988&vie
> w=diff
> ========================================================================
> ======
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Tue Apr 28 08:55:31 2015
> @@ -1244,6 +1244,20 @@ void FrameEmitterImpl::EmitCompactUnwind
>      Streamer.EmitIntValue(0, Size); // No LSDA
>  }
> 
> +static unsigned getCIEVersion(bool IsEH, unsigned DwarfVersion) {
> +  if (IsEH)
> +    return 1;
> +  switch (DwarfVersion) {
> +  case 2:
> +    return 1;
> +  case 3:
> +    return 3;
> +  case 4:
> +    return 4;
> +  }
> +  llvm_unreachable("Unknown version");
> +}
> +
>  const MCSymbol &FrameEmitterImpl::EmitCIE(MCObjectStreamer &streamer,
>                                            const MCSymbol *personality,
>                                            unsigned personalityEncoding,
> @@ -1270,10 +1284,7 @@ const MCSymbol &FrameEmitterImpl::EmitCI
>    streamer.EmitIntValue(CIE_ID, 4);
> 
>    // Version
> -  // For .eh_frame, we use CIE version 1
> -  // For DWARF2, we use CIE version 1
> -  // For DWARF3+, we use CIE version 3
> -  uint8_t CIEVersion = (IsEH || context.getDwarfVersion() <= 2) ? 1 :
> 3;
> +  uint8_t CIEVersion = getCIEVersion(IsEH, context.getDwarfVersion());
>    streamer.EmitIntValue(CIEVersion, 1);
> 
>    // Augmentation String
> 
> Modified: llvm/trunk/test/MC/ELF/cfi-sections.s
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-
> sections.s?rev=235988&r1=235987&r2=235988&view=diff
> ========================================================================
> ======
> --- llvm/trunk/test/MC/ELF/cfi-sections.s (original)
> +++ llvm/trunk/test/MC/ELF/cfi-sections.s Tue Apr 28 08:55:31 2015
> @@ -26,7 +26,7 @@ f2:
>  // ELF_64-NEXT:     AddressAlignment: 8
>  // ELF_64-NEXT:     EntrySize: 0
>  // ELF_64-NEXT:     SectionData (
> -// ELF_64-NEXT:       0000: 14000000 FFFFFFFF 03000178 100C0708
> +// ELF_64-NEXT:       0000: 14000000 FFFFFFFF 04000178 100C0708
>  // ELF_64-NEXT:       0010: 90010000 00000000 14000000 00000000
>  // ELF_64-NEXT:       0020: 00000000 00000000 01000000 00000000
>  // ELF_64-NEXT:       0030: 14000000 00000000 00000000 00000000
> @@ -47,7 +47,7 @@ f2:
>  // ELF_32-NEXT:     AddressAlignment: 4
>  // ELF_32-NEXT:     EntrySize: 0
>  // ELF_32-NEXT:     SectionData (
> -// ELF_32-NEXT:       0000: 10000000 FFFFFFFF 0300017C 080C0404
> +// ELF_32-NEXT:       0000: 10000000 FFFFFFFF 0400017C 080C0404
>  // ELF_32-NEXT:       0010: 88010000 0C000000 00000000 00000000
>  // ELF_32-NEXT:       0020: 01000000 0C000000 00000000 01000000
>  // ELF_32-NEXT:       0030: 01000000
> 
> Modified: llvm/trunk/test/MC/ELF/cfi-version.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-
> version.ll?rev=235988&r1=235987&r2=235988&view=diff
> ========================================================================
> ======
> --- llvm/trunk/test/MC/ELF/cfi-version.ll (original)
> +++ llvm/trunk/test/MC/ELF/cfi-version.ll Tue Apr 28 08:55:31 2015
> @@ -1,6 +1,6 @@
>  ; RUN: %llc_dwarf %s -o - -dwarf-version 2 -filetype=obj | llvm-
> dwarfdump - | FileCheck %s --check-prefix=DWARF2
> -; RUN: %llc_dwarf %s -o - -dwarf-version 3 -filetype=obj | llvm-
> dwarfdump - | FileCheck %s --check-prefix=DWARF34
> -; RUN: %llc_dwarf %s -o - -dwarf-version 4 -filetype=obj | llvm-
> dwarfdump - | FileCheck %s --check-prefix=DWARF34
> +; RUN: %llc_dwarf %s -o - -dwarf-version 3 -filetype=obj | llvm-
> dwarfdump - | FileCheck %s --check-prefix=DWARF3
> +; RUN: %llc_dwarf %s -o - -dwarf-version 4 -filetype=obj | llvm-
> dwarfdump - | FileCheck %s --check-prefix=DWARF4
> 
>  ; .debug_frame is not emitted for targeting Windows x64.
>  ; REQUIRES: debug_frame
> @@ -40,6 +40,10 @@ attributes #1 = { "less-precise-fpmad"="
>  ; DWARF2:        Version:               1
>  ; DWARF2-NEXT:   Augmentation:
> 
> -; DWARF34:      .debug_frame contents:
> -; DWARF34:        Version:               3
> -; DWARF34-NEXT:   Augmentation:
> +; DWARF3:      .debug_frame contents:
> +; DWARF3:        Version:               3
> +; DWARF3-NEXT:   Augmentation:
> +
> +; DWARF4:      .debug_frame contents:
> +; DWARF4:        Version:               4
> +; DWARF4-NEXT:   Augmentation:
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits







More information about the llvm-commits mailing list