diff --git a/pmb/aportgen/gcc.py b/pmb/aportgen/gcc.py
index ca1c4da526aebdcbbc11d6b4c2e726fef260908c..a97c7a1617ae1bbcc9cc99534259efd7d318e0d0 100644
--- a/pmb/aportgen/gcc.py
+++ b/pmb/aportgen/gcc.py
@@ -23,8 +23,17 @@ import pmb.helpers.run
 
 def generate(args, pkgname):
     # Copy original aport
+    prefix = pkgname.split("-")[0]
     arch = pkgname.split("-")[1]
-    upstream = pmb.aportgen.core.get_upstream_aport(args, "main/gcc")
+    if prefix == "gcc":
+        upstream = pmb.aportgen.core.get_upstream_aport(args, "main/gcc")
+        based_on = "main/gcc (from Alpine)"
+    elif prefix == "gcc6":
+        upstream = args.aports + "/main/gcc6"
+        based_on = "main/gcc6 (from postmarketOS)"
+    else:
+        raise ValueError("Invalid prefix '" + prefix + "', expected gcc or"
+                         " gcc6.")
     pmb.helpers.run.user(args, ["cp", "-r", upstream, args.work + "/aportgen"])
 
     # Architectures to build this package for
@@ -39,7 +48,11 @@ def generate(args, pkgname):
         "depends": "isl binutils-" + arch,
         "makedepends_build": "gcc g++ paxmark bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev",
         "makedepends_host": "linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-" + arch + " binutils-" + arch,
-        "subpackages": "g++-" + arch + ":gpp",
+        "subpackages": "g++-" + arch + ":gpp" if prefix == "gcc" else "",
+
+        # gcc6: options is already there, so we need to replace it and not only
+        # set it below the header like done below.
+        "options": "!strip !tracedeps",
 
         "LIBGOMP": "false",
         "LIBGCC": "false",
@@ -80,6 +93,6 @@ def generate(args, pkgname):
         '*_cross_configure=*': None,
     }
 
-    pmb.aportgen.core.rewrite(args, pkgname, "main/gcc", fields,
+    pmb.aportgen.core.rewrite(args, pkgname, based_on, fields,
                               replace_simple=replace_simple,
                               below_header=below_header)
diff --git a/pmb/build/_package.py b/pmb/build/_package.py
index c1c42b19fdd2ba776ea4c0340590c0adae136c67..d8e48a5983ab0c6a167c79c1086f58786f47eb99 100644
--- a/pmb/build/_package.py
+++ b/pmb/build/_package.py
@@ -190,8 +190,12 @@ def init_buildenv(args, apkbuild, arch, strict=False, force=False, cross=None,
 
     # Cross-compiler init
     if cross:
-        pmb.chroot.apk.install(args, ["gcc-" + arch, "g++-" + arch,
-                                      "ccache-cross-symlinks"])
+        cross_pkgs = ["ccache-cross-symlinks"]
+        if "gcc6" in depends:
+            cross_pkgs += ["gcc6-" + arch]
+        else:
+            cross_pkgs += ["gcc-" + arch, "g++-" + arch]
+        pmb.chroot.apk.install(args, cross_pkgs)
     if cross == "distcc":
         pmb.chroot.distccd.start(args, arch)