| ... | ... | @@ -479,18 +479,8 @@ pub fn SectionHeaderIterator(ParseSource: anytype) type { |
| 479 | 479 | if (self.elf_header.endian == native_endian) return shdr; |
| 480 | 480 | |
| 481 | 481 | // Convert fields to native endianness. |
| 482 | | return Elf64_Shdr{ |
| 483 | | .sh_name = @byteSwap(@TypeOf(shdr.sh_name), shdr.sh_name), |
| 484 | | .sh_type = @byteSwap(@TypeOf(shdr.sh_type), shdr.sh_type), |
| 485 | | .sh_flags = @byteSwap(@TypeOf(shdr.sh_flags), shdr.sh_flags), |
| 486 | | .sh_addr = @byteSwap(@TypeOf(shdr.sh_addr), shdr.sh_addr), |
| 487 | | .sh_offset = @byteSwap(@TypeOf(shdr.sh_offset), shdr.sh_offset), |
| 488 | | .sh_size = @byteSwap(@TypeOf(shdr.sh_size), shdr.sh_size), |
| 489 | | .sh_link = @byteSwap(@TypeOf(shdr.sh_link), shdr.sh_link), |
| 490 | | .sh_info = @byteSwap(@TypeOf(shdr.sh_info), shdr.sh_info), |
| 491 | | .sh_addralign = @byteSwap(@TypeOf(shdr.sh_addralign), shdr.sh_addralign), |
| 492 | | .sh_entsize = @byteSwap(@TypeOf(shdr.sh_entsize), shdr.sh_entsize), |
| 493 | | }; |
| 482 | bswapAllFields(Elf64_Shdr, &shdr); |
| 483 | return shdr; |
| 494 | 484 | } |
| 495 | 485 | |
| 496 | 486 | var shdr: Elf32_Shdr = undefined; |
| ... | ... | @@ -501,18 +491,7 @@ pub fn SectionHeaderIterator(ParseSource: anytype) type { |
| 501 | 491 | // ELF endianness does NOT match native endianness. |
| 502 | 492 | if (self.elf_header.endian != native_endian) { |
| 503 | 493 | // Convert fields to native endianness. |
| 504 | | shdr = .{ |
| 505 | | .sh_name = @byteSwap(@TypeOf(shdr.sh_name), shdr.sh_name), |
| 506 | | .sh_type = @byteSwap(@TypeOf(shdr.sh_type), shdr.sh_type), |
| 507 | | .sh_flags = @byteSwap(@TypeOf(shdr.sh_flags), shdr.sh_flags), |
| 508 | | .sh_addr = @byteSwap(@TypeOf(shdr.sh_addr), shdr.sh_addr), |
| 509 | | .sh_offset = @byteSwap(@TypeOf(shdr.sh_offset), shdr.sh_offset), |
| 510 | | .sh_size = @byteSwap(@TypeOf(shdr.sh_size), shdr.sh_size), |
| 511 | | .sh_link = @byteSwap(@TypeOf(shdr.sh_link), shdr.sh_link), |
| 512 | | .sh_info = @byteSwap(@TypeOf(shdr.sh_info), shdr.sh_info), |
| 513 | | .sh_addralign = @byteSwap(@TypeOf(shdr.sh_addralign), shdr.sh_addralign), |
| 514 | | .sh_entsize = @byteSwap(@TypeOf(shdr.sh_entsize), shdr.sh_entsize), |
| 515 | | }; |
| 494 | bswapAllFields(Elf32_Shdr, &shdr); |
| 516 | 495 | } |
| 517 | 496 | |
| 518 | 497 | // Convert 32-bit header to 64-bit. |