History

objtool: Reorganize cmdline options

Split the existing options into two groups: actions, which actually do something; and options, which modify the actions in some way. Also there's no need to have short flags for all the non-action options. Reserve short flags for the more important actions. While at it: - change a few of the short flags to be more intuitive - make option descriptions more consistently descriptive - sort options in the source like they are when printed - move options to a global struct

Josh Poimboeuf committed 4 years ago

Commit 2daf7fa1 parent aa3d60e9 files · +108 −78Browse files

Showing the changes to scripts (2 of 9 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.build +5 −5
  2. scripts/link-vmlinux.sh +19 −11
scripts/Makefile.build+5−5
@@ -228,14 +228,14 @@ objtool := $(objtree)/tools/objtool/objtool · 227 unmodified lines
228 228
229objtool_args = \229objtool_args = \
230 $(if $(CONFIG_UNWINDER_ORC),orc generate,check) \230 $(if $(CONFIG_UNWINDER_ORC),orc generate,check) \
231 $(if $(part-of-module), --module) \
232 $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt) \231 $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt) \
233 $(if $(CONFIG_FRAME_POINTER),, --no-fp) \232 $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \
234 $(if $(CONFIG_GCOV_KERNEL), --no-unreachable) \
235 $(if $(CONFIG_RETPOLINE), --retpoline) \233 $(if $(CONFIG_RETPOLINE), --retpoline) \
234 $(if $(CONFIG_SLS), --sls) \
236 $(if $(CONFIG_X86_SMAP), --uaccess) \235 $(if $(CONFIG_X86_SMAP), --uaccess) \
237 $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \236 $(if $(part-of-module), --module) \
238 $(if $(CONFIG_SLS), --sls)237 $(if $(CONFIG_FRAME_POINTER),, --no-fp) \
238 $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
239 239
240cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)240cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)
241cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)241cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
scripts/link-vmlinux.sh+19−11
@@ -117,8 +117,6 @@ objtool_link() · 116 unmodified lines
117 objtoolcmd="orc generate"117 objtoolcmd="orc generate"
118 fi118 fi
119 119
120 objtoolopt="${objtoolopt} --lto"
121
122 if is_enabled CONFIG_X86_KERNEL_IBT; then120 if is_enabled CONFIG_X86_KERNEL_IBT; then
123 objtoolopt="${objtoolopt} --ibt"121 objtoolopt="${objtoolopt} --ibt"
124 fi122 fi
@@ -126,6 +124,8 @@ objtool_link() · 1 unmodified line
126 if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then124 if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then
127 objtoolopt="${objtoolopt} --mcount"125 objtoolopt="${objtoolopt} --mcount"
128 fi126 fi
127
128 objtoolopt="${objtoolopt} --lto"
129 fi129 fi
130 130
131 if is_enabled CONFIG_VMLINUX_VALIDATION; then131 if is_enabled CONFIG_VMLINUX_VALIDATION; then
@@ -133,25 +133,33 @@ objtool_link() · 1 unmodified line
133 fi133 fi
134 134
135 if [ -n "${objtoolopt}" ]; then135 if [ -n "${objtoolopt}" ]; then
136
136 if [ -z "${objtoolcmd}" ]; then137 if [ -z "${objtoolcmd}" ]; then
137 objtoolcmd="check"138 objtoolcmd="check"
138 fi139 fi
139 objtoolopt="${objtoolopt} --vmlinux"140
140 if ! is_enabled CONFIG_FRAME_POINTER; then
141 objtoolopt="${objtoolopt} --no-fp"
142 fi
143 if is_enabled CONFIG_GCOV_KERNEL; then
144 objtoolopt="${objtoolopt} --no-unreachable"
145 fi
146 if is_enabled CONFIG_RETPOLINE; then141 if is_enabled CONFIG_RETPOLINE; then
147 objtoolopt="${objtoolopt} --retpoline"142 objtoolopt="${objtoolopt} --retpoline"
148 fi143 fi
144
145 if is_enabled CONFIG_SLS; then
146 objtoolopt="${objtoolopt} --sls"
147 fi
148
149 if is_enabled CONFIG_X86_SMAP; then149 if is_enabled CONFIG_X86_SMAP; then
150 objtoolopt="${objtoolopt} --uaccess"150 objtoolopt="${objtoolopt} --uaccess"
151 fi151 fi
152 if is_enabled CONFIG_SLS; then152
153 objtoolopt="${objtoolopt} --sls"153 if ! is_enabled CONFIG_FRAME_POINTER; then
154 objtoolopt="${objtoolopt} --no-fp"
154 fi155 fi
156
157 if is_enabled CONFIG_GCOV_KERNEL; then
158 objtoolopt="${objtoolopt} --no-unreachable"
159 fi
160
161 objtoolopt="${objtoolopt} --vmlinux"
162
155 info OBJTOOL ${1}163 info OBJTOOL ${1}
156 tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1}164 tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1}
157 fi165 fi