[PATCH] D154396: [clang] Add support for SerenityOS

Andrew Kaster via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 5 13:13:28 PST 2023


ADKaster added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Serenity.cpp:202
+  addSystemInclude(DriverArgs, CC1Args,
+                   concat(D.SysRoot, "/usr/local/include"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, "/usr/include"));
----------------
brad wrote:
> IMO if the library path is removed then the header path should be as well.
Fair. /usr/local is the prefix that all ports in the Ports/ tree are installed into by default (though some end up with files in /opt). We can for sure work a bit harder to make those headers/libs available to ports in our build infrastructure for them rather than putting that logic in the compiler.


================
Comment at: clang/lib/Driver/ToolChains/Serenity.cpp:211
+                          options::OPT_fno_use_init_array, true))
+    CC1Args.push_back("-fno-use-init-array");
+}
----------------
MaskRay wrote:
> This is for systems that historically support .ctors/.dtors https://maskray.me/blog/2021-11-07-init-ctors-init-array
> 
> If Serenity doesn't, this should be removed.
It's my understanding that we don't currently support .ctors/.dtors, though we did a few years ago. It is a bit confusing to me how those are related to .init/.fini though. We have some stubs here for `crti.S` and `crtn.S` https://github.com/SerenityOS/serenity/blob/cf3c8a216be5aa496844aadb43ca05ad5c47bb46/Userland/Libraries/LibC/arch/x86_64/crti.S which end up giving every .so and executable a DT_INIT section, but all the actual global ctors and dtors end up in .init_array/.fini_array.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154396/new/

https://reviews.llvm.org/D154396



More information about the cfe-commits mailing list