summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorkhorben <khorben@pkgsrc.org>2017-11-07 16:49:22 +0000
committerkhorben <khorben@pkgsrc.org>2017-11-07 16:49:22 +0000
commit099995545c532dad0aaffdf7129f55c750b70d1f (patch)
tree7af4fafc015db71b5f3930af2009b5c998a1727a /pkgtools
parentc0d23af736d1e5a215e6199b016f47286e6687ef (diff)
downloadpkgsrc-099995545c532dad0aaffdf7129f55c750b70d1f.tar.gz
Teach the wrapper for ld(1) about more cases
Building relocatable and omagic files are now recognized. They were previously recognized as executables, which may require a different behaviour in some environments (like when enforcing PIE). Committing this before joerg@'s approval since a call for testing PKGSRC_MKPIE has just been issued, and this helps with some packages.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/cwrappers/files/bin/common.h4
-rw-r--r--pkgtools/cwrappers/files/bin/normalise-ld.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/pkgtools/cwrappers/files/bin/common.h b/pkgtools/cwrappers/files/bin/common.h
index 1f1e26ceef3..a5126752640 100644
--- a/pkgtools/cwrappers/files/bin/common.h
+++ b/pkgtools/cwrappers/files/bin/common.h
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.7 2017/10/27 20:59:59 khorben Exp $ */
+/* $NetBSD: common.h,v 1.8 2017/11/07 16:49:22 khorben Exp $ */
/*-
* Copyright (c) 2009, 2017 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -50,6 +50,8 @@ enum operation_mode {
mode_assemble,
mode_compile,
mode_link_executable,
+ mode_link_omagic,
+ mode_link_relocatable,
mode_link_shared
};
extern enum operation_mode current_operation_mode;
diff --git a/pkgtools/cwrappers/files/bin/normalise-ld.c b/pkgtools/cwrappers/files/bin/normalise-ld.c
index 666a84d0dee..53421d2669d 100644
--- a/pkgtools/cwrappers/files/bin/normalise-ld.c
+++ b/pkgtools/cwrappers/files/bin/normalise-ld.c
@@ -1,4 +1,4 @@
-/* $NetBSD: normalise-ld.c,v 1.3 2017/06/11 19:34:43 joerg Exp $ */
+/* $NetBSD: normalise-ld.c,v 1.4 2017/11/07 16:49:22 khorben Exp $ */
/*-
* Copyright (c) 2009, 2017 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -44,6 +44,16 @@ operation_mode_ld(struct arglist *args)
TAILQ_FOREACH(arg, args, link) {
if (arg->val[0] != '-')
continue;
+ if (strcmp(arg->val, "-N") == 0 ||
+ strcmp(arg->val, "--omagic") == 0) {
+ current_operation_mode = mode_link_omagic;
+ continue;
+ }
+ if (strcmp(arg->val, "-r") == 0 ||
+ strcmp(arg->val, "--relocatable") == 0) {
+ current_operation_mode = mode_link_relocatable;
+ continue;
+ }
if (strcmp(arg->val, "-shared") == 0 ||
strcmp(arg->val, "-Bshareable") == 0) {
current_operation_mode = mode_link_shared;