The Algol 68 frontend adds a section with information on exported
modes and procedures to libraries and object files. Instead of
erroring out when encountering a Mach-O library keep reading it so the
frontend can find the exports section.
libiberty/ChangeLog:
* simple-object-mach-o.c (MACH_O_MH_DYLIB): New definition.
(simple_object_mach_o_match):
Signed-off-by: Pietro Monteiro <[email protected]>
---
Regtested on x86_64-darwin. Ok for trunk and backport to gcc-16 branch?
libiberty/simple-object-mach-o.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libiberty/simple-object-mach-o.c b/libiberty/simple-object-mach-o.c
index c6dfe697497..aaa9cbf3a06 100644
--- a/libiberty/simple-object-mach-o.c
+++ b/libiberty/simple-object-mach-o.c
@@ -78,6 +78,7 @@ struct mach_o_header_64
/* For filetype field in header. */
#define MACH_O_MH_OBJECT 0x01
+#define MACH_O_MH_DYLIB 0x06
/* A Mach-O file is a list of load commands. This is the header of a
load command. */
@@ -312,9 +313,9 @@ simple_object_mach_o_match (
b = &buf[0];
filetype = (*fetch_32) (b + offsetof (struct mach_o_header_32, filetype));
- if (filetype != MACH_O_MH_OBJECT)
+ if (!(filetype == MACH_O_MH_OBJECT || filetype == MACH_O_MH_DYLIB))
{
- *errmsg = "Mach-O file is not object file";
+ *errmsg = "Mach-O file is neither object file nor dylib";
*err = 0;
return NULL;
}
--
2.43.0