[PATCH] D116100: [Utils][LoongArch](5/6) Add a --bits-endian option to extract-section.py

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 26 17:50:12 PST 2021


SixWeining added a comment.

Reply to @xen0n



================
Comment at: llvm/utils/extract-section.py:64
+            choices=['little', 'big'],
+            help='Print out bits in specified endianness (little or big), default to big')
     format_group.add_argument('-h', dest='format', action='store_const', const='hex',
----------------
xen0n wrote:
> Fixed grammar and punctuation: `Print out bits in specified endianness (little or big); defaults to big`
No problem. I will change that. Thanks.


================
Comment at: llvm/utils/extract-section.py:72
     arg_parser.set_defaults(format='bits', tool_path='llvm-readobj', input_file='-',
-            byte_indicator=False, hex_width=4)
+            byte_indicator=False, hex_width=4, endian='big')
     args = arg_parser.parse_args()
----------------
xen0n wrote:
> This probably should be `bits_endian` to agree with the addition above; while looking at the surrounding it seems `tool_path` should be `readobj_path` too. I'm not entirely sure though.
OK, I will rename `endian` to `bits_endian`. Thanks.
As to `tool_path` maybe it should be renamed in a seperate patch if we are entirely sure.


================
Comment at: llvm/utils/extract-section.py:88-90
+                    offsets = (24,16,8,0)
+                    if args.endian == 'little':
+                        offsets = (0,8,16,24)
----------------
xen0n wrote:
> While we're at it, add a space after every comma for general PEP8 cleanness?
Good suggestion. But seems that LLVM doesn't define a coding standard for python in https://llvm.org/docs/CodingStandards.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116100



More information about the llvm-commits mailing list