android_kernel_xiaomi_sm8350/drivers/acpi/acpica
Mark Rutland fe00ab1eb3 ACPI: Don't build ACPICA with '-Os'
[ Upstream commit 8f9e0a52810dd83406c768972d022c37e7a18f1f ]

The ACPICA code has been built with '-Os' since the beginning of git
history, though there's no explanatory comment as to why.

This is unfortunate as GCC drops the alignment specificed by
'-falign-functions=N' when '-Os' is used, as reported in GCC bug 88345:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345

This prevents CONFIG_FUNCTION_ALIGNMENT and
CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B from having their expected effect
on the ACPICA code. This is doubly unfortunate as in subsequent patches
arm64 will depend upon CONFIG_FUNCTION_ALIGNMENT for its ftrace
implementation.

Drop the '-Os' flag when building the ACPICA code. With this removed,
the code builds cleanly and works correctly in testing so far.

I've tested this by selecting CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B=y,
building and booting a kernel using ACPI, and looking for misaligned
text symbols:

* arm64:

  Before, v6.2-rc3:
    # uname -rm
    6.2.0-rc3 aarch64
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l
    5009

  Before, v6.2-rc3 + fixed __cold:
    # uname -rm
    6.2.0-rc3-00001-g2a2bedf8bfa9 aarch64
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l
    919

  After:
    # uname -rm
    6.2.0-rc3-00002-g267bddc38572 aarch64
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l
    323
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | grep acpi | wc -l
    0

* x86_64:

  Before, v6.2-rc3:
    # uname -rm
    6.2.0-rc3 x86_64
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l
    11537

  Before, v6.2-rc3 + fixed __cold:
    # uname -rm
    6.2.0-rc3-00001-g2a2bedf8bfa9 x86_64
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l
    2805

  After:
    # uname -rm
    6.2.0-rc3-00002-g267bddc38572 x86_64
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l
    1357
    # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | grep acpi | wc -l
    0

With the patch applied, the remaining unaligned text labels are a
combination of static call trampolines and labels in assembly, which can
be dealt with in subsequent patches.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Florent Revest <revest@chromium.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Moore <robert.moore@intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Deacon <will@kernel.org>
Cc: linux-acpi@vger.kernel.org
Link: https://lore.kernel.org/r/20230123134603.1064407-4-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-11 16:43:55 +01:00
..
acapps.h
accommon.h
acconvert.h
acdebug.h
acdispat.h
acevents.h
acglobal.h
achware.h
acinterp.h
aclocal.h
acmacros.h
acnamesp.h
acobject.h
acopcode.h
acparser.h
acpredef.h
acresrc.h
acstruct.h
actables.h
acutils.h
amlcode.h
amlresrc.h
dbcmds.c
dbconvert.c
dbdisply.c
dbexec.c
dbfileio.c
dbhistry.c
dbinput.c
dbmethod.c
dbnames.c
dbobject.c
dbstats.c
dbtest.c
dbutils.c
dbxface.c
dsargs.c
dscontrol.c
dsdebug.c
dsfield.c
dsinit.c
dsmethod.c ACPICA: Fix error code path in acpi_ds_call_control_method() 2023-01-18 11:41:34 +01:00
dsmthdat.c
dsobject.c
dsopcode.c
dspkginit.c
dsutils.c
dswexec.c
dswload2.c
dswload.c
dswscope.c
dswstate.c
evevent.c
evglock.c
evgpe.c
evgpeblk.c
evgpeinit.c
evgpeutil.c
evhandler.c
evmisc.c
evregion.c
evrgnini.c
evsci.c
evxface.c
evxfevnt.c
evxfgpe.c
evxfregn.c
exconcat.c
exconfig.c
exconvrt.c
excreate.c
exdebug.c
exdump.c
exfield.c
exfldio.c
exmisc.c
exmutex.c
exnames.c
exoparg1.c
exoparg2.c
exoparg3.c
exoparg6.c
exprep.c
exregion.c
exresnte.c
exresolv.c
exresop.c
exserial.c
exstore.c
exstoren.c
exstorob.c
exsystem.c
extrace.c
exutils.c
hwacpi.c
hwesleep.c
hwgpe.c
hwpci.c
hwregs.c
hwsleep.c
hwtimer.c
hwvalid.c ACPICA: Drop port I/O validation for some regions 2023-03-11 16:43:38 +01:00
hwxface.c
hwxfsleep.c
Makefile ACPI: Don't build ACPICA with '-Os' 2023-03-11 16:43:55 +01:00
nsaccess.c
nsalloc.c
nsarguments.c
nsconvert.c
nsdump.c
nsdumpdv.c
nseval.c
nsinit.c
nsload.c
nsnames.c
nsobject.c
nsparse.c
nspredef.c
nsprepkg.c
nsrepair2.c
nsrepair.c ACPICA: nsrepair: handle cases without a return value correctly 2023-03-11 16:43:38 +01:00
nssearch.c
nsutils.c
nswalk.c
nsxfeval.c
nsxfname.c
nsxfobj.c
psargs.c
psloop.c
psobject.c
psopcode.c
psopinfo.c
psparse.c
psscope.c
pstree.c
psutils.c
pswalk.c
psxface.c
rsaddr.c
rscalc.c
rscreate.c
rsdump.c
rsdumpinfo.c
rsinfo.c
rsio.c
rsirq.c
rslist.c
rsmemory.c
rsmisc.c
rsserial.c
rsutils.c
rsxface.c
tbdata.c
tbfadt.c
tbfind.c
tbinstal.c
tbprint.c
tbutils.c
tbxface.c
tbxfload.c
tbxfroot.c
utaddress.c
utalloc.c
utascii.c
utbuffer.c
utcache.c
utcopy.c ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() 2023-01-18 11:40:57 +01:00
utdebug.c
utdecode.c
utdelete.c
uterror.c
uteval.c
utexcep.c
utglobal.c
uthex.c
utids.c
utinit.c
utlock.c
utmath.c
utmisc.c
utmutex.c
utnonansi.c
utobject.c
utosi.c
utownerid.c
utpredef.c
utprint.c
utresdecode.c
utresrc.c
utstate.c
utstring.c
utstrsuppt.c
utstrtoul64.c
uttrack.c
utuuid.c
utxface.c
utxferror.c
utxfinit.c
utxfmutex.c