From fed3e5ce397c9698b5d9546e2edfcb3504c403c3 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 16 May 2019 21:58:06 +0200 Subject: Fix linker too long argument list For yocto builds linker can get quite long path since all archives are listed as absolute paths. This can end up as "execvp: /bin/sh: Argument list too long" Use rsp files also for archives. Change-Id: I096e2f35ed72b68261bf465e84baddd1f78cd917 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 546c42e42643a209d893d5291c26c3f8ef7102a3) Reviewed-by: Michal Klocek --- src/core/core_module.pro | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/core/core_module.pro') diff --git a/src/core/core_module.pro b/src/core/core_module.pro index 3b5d37f29..0217d2a2b 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -25,14 +25,17 @@ isEmpty(NINJA_LIBS): error("Missing library files from QtWebEngineCore linking p NINJA_OBJECTS = $$eval($$list($$NINJA_OBJECTS)) # Do manual response file linking for macOS and Linux -RSP_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}.rsp -for(object, NINJA_OBJECTS): RSP_CONTENT += $$object -write_file($$RSP_FILE, RSP_CONTENT) -macos:LIBS_PRIVATE += -Wl,-filelist,$$shell_quote($$RSP_FILE) -linux:LIBS_PRIVATE += @$$RSP_FILE +RSP_OBJECT_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}_o.rsp +for(object, NINJA_OBJECTS): RSP_O_CONTENT += $$object +write_file($$RSP_OBJECT_FILE, RSP_O_CONTENT) +RSP_ARCHIVE_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}_a.rsp +for(archive, NINJA_ARCHIVES): RSP_A_CONTENT += $$archive +write_file($$RSP_ARCHIVE_FILE, RSP_A_CONTENT) +macos:LIBS_PRIVATE += -Wl,-filelist,$$shell_quote($$RSP_OBJECT_FILE) +linux:LIBS_PRIVATE += @$${RSP_OBJECT_FILE} # QTBUG-58710 add main rsp file on windows -win32:QMAKE_LFLAGS += @$$RSP_FILE -linux: LIBS_PRIVATE += -Wl,--start-group $$NINJA_ARCHIVES -Wl,--end-group +win32:QMAKE_LFLAGS += @$${RSP_OBJECT_FILE} +linux: LIBS_PRIVATE += -Wl,--start-group @$${RSP_ARCHIVE_FILE} -Wl,--end-group else: LIBS_PRIVATE += $$NINJA_ARCHIVES LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS # GN's LFLAGS doesn't always work across all the Linux configurations we support. -- cgit v1.2.3 From ddd3d905395298188329df111d3785e07e06e0db Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 17 May 2019 15:49:23 +0200 Subject: Make linker call look great again Fix issues with messed up linker path: * do not use LIBS_PRIVATE on linux at least for passing object and archive responses files. * do not use QT and QT_PRIVATE with same libs, it simply includes libs in LIB and LIB_PRIVATE so doubles linker libs. * remove bogus dependency for gui and core for webengineheaders pseudo module. * remove unused egl config flag Fixes: QTBUG-75832 Task-number: QTBUG-75357 Change-Id: I1720394e636e3f89d546f372b10932dd4ad395fe Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit ee12b53eba009e8a3ca12ef77031d9a48c609cb4) Reviewed-by: Michal Klocek --- src/core/core_module.pro | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/core/core_module.pro') diff --git a/src/core/core_module.pro b/src/core/core_module.pro index 0217d2a2b..b5c8542f3 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -10,8 +10,6 @@ linking_pri = $$OUT_PWD/$$getConfigDir()/$${TARGET}.pri error("Could not find the linking information that gn should have generated.") } -load(qt_module) - api_library_name = qtwebenginecoreapi$$qtPlatformTargetSuffix() api_library_path = $$OUT_PWD/api/$$getConfigDir() @@ -32,10 +30,10 @@ RSP_ARCHIVE_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}_a.rsp for(archive, NINJA_ARCHIVES): RSP_A_CONTENT += $$archive write_file($$RSP_ARCHIVE_FILE, RSP_A_CONTENT) macos:LIBS_PRIVATE += -Wl,-filelist,$$shell_quote($$RSP_OBJECT_FILE) -linux:LIBS_PRIVATE += @$${RSP_OBJECT_FILE} +linux:QMAKE_LFLAGS += @$${RSP_OBJECT_FILE} # QTBUG-58710 add main rsp file on windows win32:QMAKE_LFLAGS += @$${RSP_OBJECT_FILE} -linux: LIBS_PRIVATE += -Wl,--start-group @$${RSP_ARCHIVE_FILE} -Wl,--end-group +linux:QMAKE_LFLAGS += -Wl,--start-group @$${RSP_ARCHIVE_FILE} -Wl,--end-group else: LIBS_PRIVATE += $$NINJA_ARCHIVES LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS # GN's LFLAGS doesn't always work across all the Linux configurations we support. @@ -74,7 +72,7 @@ osx { # API library as response file to the linker. QMAKE_LFLAGS += @$${api_library_path}$${QMAKE_DIR_SEP}$${api_library_name}.lib.objects } else { - LIBS_PRIVATE += -Wl,-whole-archive -l$$api_library_name -Wl,-no-whole-archive + QMAKE_LFLAGS += -Wl,-whole-archive -l$$api_library_name -Wl,-no-whole-archive } win32-msvc* { @@ -87,8 +85,6 @@ win32-msvc* { # and doesn't let Chromium get access to libc symbols through dlsym. CONFIG -= bsymbolic_functions -qtConfig(egl): CONFIG += egl - linux:qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)" REPACK_DIR = $$OUT_PWD/$$getConfigDir() @@ -157,3 +153,6 @@ OTHER_FILES = \ $$files(../3rdparty/chromium/*.gypi, true) \ $$files(../3rdparty/chromium/*.gn, true) \ $$files(../3rdparty/chromium/*.gni, true) + +load(qt_module) + -- cgit v1.2.3 From 597359a16a798df3955404200f1fc6833a7425ab Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 31 May 2019 09:56:28 -0700 Subject: Don't allow QtWebEngineCore to request executable stack The Chromium sources contain assembly code that causes the library to default to executable stack (the linker requires that *all* .o files have a .note.GNU-stack section in order to default to non-executable). So add the -z noexecstack linker flag to change the setting. The other libraries are not affected. Change-Id: I0bf9ebeb5aa34d19be30fffd15a3d3063dea2005 Reviewed-by: Allan Sandfeld Jensen --- src/core/core_module.pro | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/core_module.pro') diff --git a/src/core/core_module.pro b/src/core/core_module.pro index b5c8542f3..9bd56f9de 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -39,6 +39,8 @@ LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS # GN's LFLAGS doesn't always work across all the Linux configurations we support. # The Windows and macOS ones from GN does provide a few useful flags however +unix:qtConfig(webengine-noexecstack): \ + QMAKE_LFLAGS += -Wl,-z,noexecstack linux { QMAKE_LFLAGS += -Wl,--gc-sections -Wl,-O1 -Wl,-z,now # Embedded address sanitizer symbols are undefined and are picked up by the dynamic link loader -- cgit v1.2.3