Advertisement
Guest User

Untitled

a guest
Apr 4th, 2015
308
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None
  1. quentin@chrystal ~/linux-2.6 $ cat test.S 0
  2.  
  3. #define alt_max_short(a, b) ((a) ^ (((a) ^ (b)) & -(-((a) < (b)))))
  4.  
  5. .pushsection .text, "ax"
  6. .globl main
  7. main:
  8. // zero padding
  9. .skip -((alt_max_short(1, 2) - 3) > 0) * \
  10. (alt_max_short(1, 2) - 3),0x01
  11. // one byte padding
  12. .skip -((alt_max_short(1, 3) - (2)) > 0) * \
  13. (alt_max_short(1, 3) - (2)),0x02
  14. // zero padding
  15. .skip -((alt_max_short(2, 1) - (3)) > 0) * \
  16. (alt_max_short(2, 1) - (3)),0x03
  17. // two bytes padding
  18. .skip -((alt_max_short(2, 3) - (1)) > 0) * \
  19. (alt_max_short(2, 3) - (1)),0x04
  20. // one byte padding
  21. .skip -((alt_max_short(3, 1) - (2)) > 0) * \
  22. (alt_max_short(3, 1) - (2)),0x05
  23. // two bytes padding
  24. .skip -((alt_max_short(3, 2) - (1)) > 0) * \
  25. (alt_max_short(3, 2) - (1)),0x06
  26. // three bytes padding
  27. .skip -((alt_max_short(3, 2) - (0)) > 0) * \
  28. (alt_max_short(3, 2) - (0)),0x07
  29. // two bytes padding
  30. .skip -((alt_max_short(3, 0) - (1)) > 0) * \
  31. (alt_max_short(3, 0) - (1)),0x08
  32.  
  33. .popsection
  34. quentin@chrystal ~/linux-2.6 $ gcc -c test.S -o test.o 0
  35. test.S: Assembler messages:
  36. test.S:8: Warning: .space repeat count is zero, ignored
  37. test.S:14: Warning: .space repeat count is zero, ignored
  38. quentin@chrystal ~/linux-2.6 $ objdump -j .text -s test.o 0
  39.  
  40. test.o: file format elf64-x86-64
  41.  
  42. Contents of section .text:
  43. 0000 02040405 06060707 070808 ...........
Advertisement
RAW Paste Data Copied
Advertisement