conf/distro: Add option for controlling compiler flags
2 unresolved threads
2 unresolved threads
Add an OPTIMIZE_FOR option that sets different compiler and hardening flags depending on the requested optimization type.
Signed-off-by: Bernhard Rosenkränzer bernhard.rosenkraenzer.ext@huawei.com
Merge request reports
Activity
Filter activity
added teamtoolchain label
assigned to @bero
mentioned in issue #95 (closed)
mentioned in issue #94
115 116 # Configure what to optimize for: 117 # - "normal": A normal build. 118 # - "debugging": More debuggable, but less performant and less secure binaries. 119 # - "security": Add security hardening even when it comes at the cost of 120 # severe performance penalties 121 # - "size": Optimize for code size 122 # - "speed": Optimize for performance 123 # - "unsafespeed": Optimize for performance even when it means 124 # relaxing standards (potentially introducing bugs) 125 OPTIMIZE_FOR ?= "normal" 126 127 TARGET_CFLAGS += "-O2 -flto -Wformat -Wformat-security -Wformat-nonliteral -Werror=format-security -Werror=format-nonliteral -Werror=array-bounds -Wstrict-aliasing=2 -Werror=strict-aliasing -Wl,-z,relro,-z,now,-z,noexecstack,--hash-style=gnu,--as-needed -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong --param=ssp-buffer-size=4 -fstack-clash-protection -fPIE -pie" 128 TARGET_CFLAGS += "${@oe.utils.conditional('OPTIMIZE_FOR', 'debugging', '-g4', '', d)}" 129 TARGET_CFLAGS += "${@oe.utils.conditional('OPTIMIZE_FOR', 'security', '-ftrivial-auto-var-init=pattern', '', d)}" 130 TARGET_CFLAGS:toolchain-clang += "${@oe.utils.conditional('OPTIMIZE_FOR', 'security', '-mspeculative-load-hardening -mretpoline', '', d)}" mentioned in issue #202 (closed)
Please register or sign in to reply