lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8f4aUx7P45qHlpl@localhost.localdomain>
Date:   Wed, 18 Jan 2023 10:47:21 -0300
From:   "Herton R. Krzesinski" <herton@...hat.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-kernel@...r.kernel.org, vbabka@...e.cz, jforbes@...hat.com,
        dzickus@...hat.com, scweaver@...hat.com
Subject: Re: [PATCH] tools/vm: allow users to provide additional
 cflags/ldflags

On Tue, Jan 17, 2023 at 04:53:26PM -0800, Andrew Morton wrote:
> On Mon, 16 Jan 2023 19:49:21 -0300 "Herton R. Krzesinski" <herton@...hat.com> wrote:
> 
> > Right now there is no way to provide additional cflags/ldflags when
> > building tools/vm binaries. And using eg. make CFLAGS=<options> will
> > override the CFLAGS being set in the Makefile, making the build fail
> > since it requires the include of the ../lib dir (for libapi).
> > 
> > This change then allows you to specify:
> > CFLAGS=<options> LDFLAGS=<options> make V=1 -C tools/vm
> > 
> > And the options will be correctly appended as can be seen from the
> > make output.
> > 
> > ...
> >
> > --- a/tools/vm/Makefile
> > +++ b/tools/vm/Makefile
> > @@ -8,8 +8,8 @@ TARGETS=page-types slabinfo page_owner_sort
> >  LIB_DIR = ../lib/api
> >  LIBS = $(LIB_DIR)/libapi.a
> >  
> > -CFLAGS = -Wall -Wextra -I../lib/
> > -LDFLAGS = $(LIBS)
> > +CFLAGS += -Wall -Wextra -I../lib/
> > +LDFLAGS += $(LIBS)
> >  
> 
> I think EXTRA_CFLAGS is more conventional?
> 

I was looking and there is no standard under tools/

Some use it, some not. To given an example of what uses CFLAGS:
tools/arch/x86/kcpuid/Makefile:override CFLAGS += -O2 -Wall -I../../../include
tools/arch/x86/intel_sdsi/Makefile:override CFLAGS += -O2 -Wall
tools/iio/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/thermal/tmon/Makefile:override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \
tools/gpio/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/pci/Makefile:CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/spi/Makefile:CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/wmi/Makefile:CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
tools/io_uring/Makefile:CFLAGS += -Wall -Wextra -g -D_GNU_SOURCE
tools/counter/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include

I can however use EXTRA_CFLAGS, not a problem, eg. doing instead:
CFLAGS = -Wall -Wextra -I../lib/ $(EXTRA_CFLAGS)
LDFLAGS = $(LIBS) $(EXTRA_LDFLAGS)

Let me know and I'll resend the patch using EXTRA_* instead.

-- 
[]'s
Herton

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ