Skip to content

Instantly share code, notes, and snippets.

@MattCatz
Last active February 16, 2020 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattCatz/62628eb01181a40504d370bae557da73 to your computer and use it in GitHub Desktop.
Save MattCatz/62628eb01181a40504d370bae557da73 to your computer and use it in GitHub Desktop.
Bloaty bug for big endian powerpc64
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
make strip
# powerpc64-linux-gcc -o bloaty_bug.elf bloaty_bug.c
# powerpc64-linux-strip -R ".note.ABI-tag" -o bloaty_bug.strip.elf bloaty_bug.elf
bloaty bloaty_bug.elf
# bloaty: ELF region out-of-bounds
bloaty bloaty_bug.strip.elf
# VM SIZE FILE SIZE
# -------------- --------------
# 0.0% 0 [Unmapped] 61.1Ki 92.8%
# 12.8% 400 [ELF Headers] 1.89Ki 2.9%
# 33.8% 1.03Ki .text 1.03Ki 1.6%
# 11.8% 368 .dynamic 368 0.5%
# 6.7% 208 [LOAD [RW]] 280 0.4%
# 8.5% 264 .opd 264 0.4%
# 0.0% 0 .shstrtab 173 0.3%
# 4.2% 130 [LOAD [RX]] 130 0.2%
# 3.0% 95 [7 Others] 79 0.1%
# 2.4% 76 .eh_frame 76 0.1%
# 2.3% 72 .dynsym 72 0.1%
# 2.3% 72 .plt 0 0.0%
# 2.2% 68 .init 68 0.1%
# 1.8% 56 .dynstr 56 0.1%
# 1.8% 55 .rodata 55 0.1%
# 1.5% 48 .gnu.version_r 48 0.1%
# 1.5% 48 .got 48 0.1%
# 1.5% 48 .rela.plt 48 0.1%
# 1.2% 36 .fini 36 0.1%
# 0.0% 0 .comment 31 0.0%
# 0.8% 24 .hash 24 0.0%
# 100.0% 3.05Ki TOTAL 65.8Ki 100.0%
bloaty_bug.elf: bloaty_bug.c
powerpc64-linux-gcc -o $@ $^
bloaty_bug.strip.elf: bloaty_bug.elf
powerpc64-linux-strip -R ".note.ABI-tag" -o $@ $^
.PHONY: strip
strip: bloaty_bug.strip.elf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment