Set {C,CXX}FLAGS_x86_64_unknown_linux_gnu=--sysroot... as workaround for upstream issue

And remove upstream rust revert.

Suggested at https://github.com/rust-lang/rust/issues/136984#issuecomment-2659282396.

Tested locally that removing the revert causes the build to break and
the CFLAGS workaround fixes it again, so there shouldn't be a need for a
new package.

Bug: 395891130
Change-Id: Iae7fc9e518e6ff955a09385f5443fac54ca6a015
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6269907
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420683}
NOKEYCHECK=True
GitOrigin-RevId: 1c4eea48d528be0ab5144e3357a30be9e6059943
diff --git a/build_rust.py b/build_rust.py
index 60ed2fc..73f31d2 100755
--- a/build_rust.py
+++ b/build_rust.py
@@ -350,6 +350,12 @@
             self._env['CFLAGS'] += f' {sysroot_cflag}'
             self._env['CXXFLAGS'] += f' {sysroot_cflag}'
             self._env['LDFLAGS'] += f' {sysroot_cflag}'
+            # TODO(https://crbug.com/395891130): remove
+            # C/CXXFLAGS_x86_64_unknown_linux_gnu workaround after upstream
+            # issue is properly fixed.
+            self._env['CFLAGS_x86_64_unknown_linux_gnu'] += f' {sysroot_cflag}'
+            self._env[
+                'CXXFLAGS_x86_64_unknown_linux_gnu'] += f' {sysroot_cflag}'
 
             self._env['RUSTFLAGS_BOOTSTRAP'] += f' -Clink-arg={sysroot_cflag}'
             self._env[
@@ -585,18 +591,6 @@
     # with `GitMoveSubmoduleBranch()`.
     #############################
 
-    # TODO(https://crbug.com/395891130): Remove once upstream fixes passing flags to cargo link steps
-    RunCommand([
-        'git',
-        '-C',
-        RUST_SRC_DIR,
-        'revert',
-        '--no-edit',
-        '-m',
-        '1',
-        '6171d944aea415a3023d4262e0895aa3b18c771f',
-    ])
-
     print('Finished applying cherry-picks.')