Message ID | 20220823141610.2934060-2-richard.purdie@linuxfoundation.org |
---|---|
State | New |
Headers | show |
Series | [1/2] mesa: Rework llvm handling | expand |
On Tue, Aug 23, 2022 at 7:16 AM Richard Purdie < richard.purdie@linuxfoundation.org> wrote: > Add a patch to meson to avoid encoding llvm-native paths into target > binaries > which cause reproducibility failures. > I think this should be solved if we turn llvm-config into a wrapper script which uses TARGET_* flags to report back like what we do in meta-clang Combining this with your prior patch would be a good solution > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- > .../meson/meson/llvm-ldflags.patch | 28 +++++++++++++++++++ > meta/recipes-devtools/meson/meson_0.63.1.bb | 1 + > 2 files changed, 29 insertions(+) > create mode 100644 meta/recipes-devtools/meson/meson/llvm-ldflags.patch > > diff --git a/meta/recipes-devtools/meson/meson/llvm-ldflags.patch > b/meta/recipes-devtools/meson/meson/llvm-ldflags.patch > new file mode 100644 > index 00000000000..7de01f4d6e1 > --- /dev/null > +++ b/meta/recipes-devtools/meson/meson/llvm-ldflags.patch > @@ -0,0 +1,28 @@ > +When building mesa with llvm enabled, e.g.: > + > +PACKAGECONFIG:append:x86-64:pn-mesa = ' gallium-llvm gallium r600' > + > +then llvm-native ldflags make it onto the compile commandline for the > target, which > +is rather bad. These then get encoded into the binary causing > reproducibility issues. > + > +This happens since llvm-config encodes the ldflags used at compile time. > It will > +relocate many items at runtime based on it's location but not the flags. > + > +Since we always provide our ldflags, we don't need meson adding the > +llvm-native ones from llvm-config so just drop this code for now to avoid > the problems. > + > +Upstream-Status: Inappropriate [OE specific workaround for cross compile > issues] > + > +Index: meson-0.63.0/mesonbuild/dependencies/dev.py > +=================================================================== > +--- meson-0.63.0.orig/mesonbuild/dependencies/dev.py > ++++ meson-0.63.0/mesonbuild/dependencies/dev.py > +@@ -338,7 +338,7 @@ class LLVMDependencyConfigTool(ConfigToo > + > + link_args = ['--link-static', '--system-libs'] if self.static > else ['--link-shared'] > + self.link_args = self.get_config_value( > +- ['--libs', '--ldflags'] + link_args + > list(self.required_modules), > ++ ['--libs'] + link_args + list(self.required_modules), > + 'link_args') > + > + def _set_old_link_args(self) -> None: > diff --git a/meta/recipes-devtools/meson/meson_0.63.1.bb > b/meta/recipes-devtools/meson/meson_0.63.1.bb > index 7f77a7de34a..53b0fde8233 100644 > --- a/meta/recipes-devtools/meson/meson_0.63.1.bb > +++ b/meta/recipes-devtools/meson/meson_0.63.1.bb > @@ -16,6 +16,7 @@ SRC_URI = " > https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P > file://0002-Support-building-allarch-recipes-again.patch \ > file://0001-is_debianlike-always-return-False.patch \ > file://0001-Check-for-clang-before-guessing-gcc-or-lcc.patch \ > + file://llvm-ldflags.patch \ > " > SRC_URI[sha256sum] = > "06fe13297213d6ff0121c5d5aab25a56ef938ffec57414ed6086fda272cb65e9" > > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#169708): > https://lists.openembedded.org/g/openembedded-core/message/169708 > Mute This Topic: https://lists.openembedded.org/mt/93204791/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/meta/recipes-devtools/meson/meson/llvm-ldflags.patch b/meta/recipes-devtools/meson/meson/llvm-ldflags.patch new file mode 100644 index 00000000000..7de01f4d6e1 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/llvm-ldflags.patch @@ -0,0 +1,28 @@ +When building mesa with llvm enabled, e.g.: + +PACKAGECONFIG:append:x86-64:pn-mesa = ' gallium-llvm gallium r600' + +then llvm-native ldflags make it onto the compile commandline for the target, which +is rather bad. These then get encoded into the binary causing reproducibility issues. + +This happens since llvm-config encodes the ldflags used at compile time. It will +relocate many items at runtime based on it's location but not the flags. + +Since we always provide our ldflags, we don't need meson adding the +llvm-native ones from llvm-config so just drop this code for now to avoid the problems. + +Upstream-Status: Inappropriate [OE specific workaround for cross compile issues] + +Index: meson-0.63.0/mesonbuild/dependencies/dev.py +=================================================================== +--- meson-0.63.0.orig/mesonbuild/dependencies/dev.py ++++ meson-0.63.0/mesonbuild/dependencies/dev.py +@@ -338,7 +338,7 @@ class LLVMDependencyConfigTool(ConfigToo + + link_args = ['--link-static', '--system-libs'] if self.static else ['--link-shared'] + self.link_args = self.get_config_value( +- ['--libs', '--ldflags'] + link_args + list(self.required_modules), ++ ['--libs'] + link_args + list(self.required_modules), + 'link_args') + + def _set_old_link_args(self) -> None: diff --git a/meta/recipes-devtools/meson/meson_0.63.1.bb b/meta/recipes-devtools/meson/meson_0.63.1.bb index 7f77a7de34a..53b0fde8233 100644 --- a/meta/recipes-devtools/meson/meson_0.63.1.bb +++ b/meta/recipes-devtools/meson/meson_0.63.1.bb @@ -16,6 +16,7 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P file://0002-Support-building-allarch-recipes-again.patch \ file://0001-is_debianlike-always-return-False.patch \ file://0001-Check-for-clang-before-guessing-gcc-or-lcc.patch \ + file://llvm-ldflags.patch \ " SRC_URI[sha256sum] = "06fe13297213d6ff0121c5d5aab25a56ef938ffec57414ed6086fda272cb65e9"
Add a patch to meson to avoid encoding llvm-native paths into target binaries which cause reproducibility failures. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- .../meson/meson/llvm-ldflags.patch | 28 +++++++++++++++++++ meta/recipes-devtools/meson/meson_0.63.1.bb | 1 + 2 files changed, 29 insertions(+) create mode 100644 meta/recipes-devtools/meson/meson/llvm-ldflags.patch